Avatar

how to know location or zone with the help latitude and longitude

0

Hi, 

As i am building the application that uses Geotab API. I want to know how can i find the name of location with the given latitude and longitude ? as i see you are doing after i logged myself in to my.geotab.com 

But i don't see any example related to that. 

Also in my application i have also integrated the zone draw with the help of leaflet plugin. So i also want to know if the given latitude and longitude will fall in my zone. the way you have done in your real application. 

Can you please help me with that ? 

Thanks, 

Mauricio Muniz

Please sign in to leave a comment.

4 comments

0
Avatar

The reverse geocoding service (finding an address using the latitude and longitude) we use is only licensed for use on our own MyGeotab servers, and is not part of our public API. 

There are a few services that you may use (we use Bing): 

Google: https://developers.google.com/maps/documentation/geocoding/ 
Bing: http://msdn.microsoft.com/en-us/lib...01710.aspx 
Nokia Here: http://developer.nokia.com/Community/Wiki/HERE_Maps_API_-_Using_the_geocoding_service 

And OpenStreetMaps has a free reverse geocoding API: http://wiki.openstreetmap.org/wiki/Nominatim#Reverse_Geocoding_.2F_Address_lookup

Geotab Developers 0 votes
0
Avatar

Thanks, 
This was helpful. But can you also give me reference to check whether the given latitude-longitude lies between my created zone. 

For the creation of zone i use the leaflet zone plugin. 

Mauricio Muniz 0 votes
0
Avatar

So, these zones are completely on your end, correct? You're not creating a Zone in MyGeotab with them? 

If they are on your end only, there are a few examples of how to find a point inside a polygon: 

http://www.codeproject.com/Articles...gon-Method 
http://alienryderflex.com/polygon/ 

Otherwise, you can use Zones in MyGeotab, and create an Exception Rule when a device enters a Zone, and then get Exception Events.

Geotab Developers 0 votes
0
Avatar

If you were to go the Exception Rule route:

I would try the following: 
Create the zone in mygeotab using the interface or api. 

In your application, query the zones from Geotab and draw them on your map using the points given to you by the Geotab api for each zone. 

Create a web service request template, and a rule that uses that template for entry/exit into that zone type or that specific zone. 

Host a web service in your application that gets the requests of entry/exit from Geotab. You can get the zone name, device, driver, lat, long, date, time, etc from this web request. 

Process the data you receive for your application. 

Geotab Developers 0 votes