Geotab Support Forum


Address
Last Post 25 May 2010 09:35 AM by Mauricio. 9 Replies.
Printer Friendly
Sort:
PrevPrev NextNext
Author Messages
Tonny
Posts:155

--
08 May 2010 03:59 PM QuoteQuote ReplyReply
Sir

Using ESRI map and checkmate SDK, how can i get an address when i have x and y coordinates, same as in Activity and Trips report. Advise on appropriate SDK code to use.


Thank you

Tonny
Mauricio
Moderator
Posts:239

--
11 May 2010 10:05 AM QuoteQuote ReplyReply
Hi Tonny,

A quick look at the SDK help file (checkmatesdk.chm) which is included in the SDK archive will show that for a reverse address lookup you require the following function:

IAddressFromCoordinate
Tonny
Posts:155

--
12 May 2010 03:00 PM QuoteQuote ReplyReply
Hello Mauriciomuniz

I found the IAddressFromCoordinate command in help file, but do not know how to use it. IAddressFromCoordinate.GetAddresses seems to be my solution, but I cannot initialize the command with my x,y coordinates. Send a sample code, assuming I have x, y coordinates in SimpleCordinate SDK Geotab format.

Thank you

Tonny
Mauricio
Moderator
Posts:239

--
14 May 2010 10:41 AM QuoteQuote ReplyReply
Try something like below:
GetAddresses(new PointF[] { new PointF((float)simpleCoordinate.X, (float)simpleCoordinate.Y) });
Tonny
Posts:155

--
14 May 2010 12:21 PM QuoteQuote ReplyReply
Hello

Before doing addr.GetAddresses(new PointF[] { new PointF((float)simpleCoordinate.X, (float)simpleCoordinate.Y) });, I need to initialize an IAddressFromCoordinate variable as follows :
IAddressFromCoordinate addr = something

I do not know what code to replace with "something". Once this is initialized, i think i will be able to proceed. The help file does not explain how to initialize/configure the command IAddressFromCoordinate.

Following the examples in the SDK, I was able to initialize a DataStore, but I do not know what else is needed. As such, so far I used only the DataStore command.

Please advise

Tonny
Mauricio
Moderator
Posts:239

--
20 May 2010 01:03 PM QuoteQuote ReplyReply
IAddressFromCoordinate addressGeocoder = mapEngineFactory.GeocoderFactory.GetReverseGeocoder(GeocoderType.VirtualEarth);
Tonny
Posts:155

--
21 May 2010 03:58 AM QuoteQuote ReplyReply
Hello

This time, it seems that we either need to initialize mapEngineFactory, or GeocoderFactory, and still, I do not know how to initialize them. It seems that only GeocoderFactory needs to be initialized.
I get the following message
System.NullReferenceException was unhandled
Message="Object reference not set to an instance of an object."

Thank you

Tonny
Mauricio
Moderator
Posts:239

--
21 May 2010 09:39 AM QuoteQuote ReplyReply
This is how it works:
ICollection GetAddresses(DataStore dataStore, IWebProxy webProxy, IEnumerable simpleCoordinates)
{
ICollection addresses = new List();
using (MapEngineFactory mapEngineFactory = new MapEngineFactory(dataStore, webProxy))
{
mapEngineFactory.Load(new MapView("world", new RectangleF(-180, 90, 180, -90)));
IAddressFromCoordinate addressGeocoder = mapEngineFactory.GeocoderFactory.GetReverseGeocoder(GeocoderType.VirtualEarth);
foreach (SimpleCoordinate simpleCoordinate in simpleCoordinates)
{
IGeocodeResult[] geocodeResults = addressGeocoder.GetAddresses(new PointF[] { new PointF((float)simpleCoordinate.X, (float)simpleCoordinate.Y) });
IGeocodeResult result = geocodeResults[0];
if (result.Exception != null)
{
addresses.Add("");
}
else
{
addresses.Add(result.StreetAddress);
}
}
}
return addresses;
}
Tonny
Posts:155

--
22 May 2010 04:34 AM QuoteQuote ReplyReply
Great, it works. Thank you.

Once I loaded the mapEngineFactory with mapEngineFactory.Load, I got the right results.

Once again, thank you very much.

I read from other topics that version 5.5 is on its way. How can we download and test it?

Tonny
Mauricio
Moderator
Posts:239

--
25 May 2010 10:52 AM QuoteQuote ReplyReply
The official Checkmate 5.5 release will not be until July, however, Checkmate 5.5 beta will be available soon.
If you would like to try out Checkmate 5.5 Beta then please e-mail our sales department(geosales@geotab.com), please mention your reseller information in the e-mail.


Quick Reply
toggle
  Username:
Subject:
Body:
Security Code:
CAPTCHA image
Enter the code shown above in the box below

Submit
Active Forums 4.2