Kurt
Kurt

Reputation: 11

Moving to OpenLayers from Google maps

I'm looking for some help on comparative OpenLayer functions for the following Google maps functions, can someone please let me know what these would be?

I'm currently using

  1. For getting distance, using the distance matrix API:

http://maps.googleapis.com/maps/api/distancematrix

  1. For getting latitude and longitude of the current address:

http://maps.googleapis.com/maps/api/geocode/json?address

Kindly check the attachment which are using for getting latitude, longitude and distance matrix.

Function names:

  1. function getLatLng($add)

  2. function getRoadDistance($from, $to)

--

Upvotes: 1

Views: 556

Answers (1)

Hicham Zouarhi
Hicham Zouarhi

Reputation: 1060

things are a little bit more complicated in OL than they are with the google-api

  1. Routing: if you have a small road network you can consider creating a Database in PostGIS and use pgrouting to get routing functions, you can find more on it here

Or if you want to use it on a bigger scale there some APIs that do it for you, for example yourNavigator, you'll have to make a get request with your coordinates like this

http://www.yournavigation.org/api/1.0/gosmore.php?format=geojson&flat=startLatitude&flon=startLongitude&tlat=destLatitude&tlon=destinationLongitude

there is also the OSRM for the same purpose.

  1. to get the longitude and latitude based on an address you can use the geocoder for Openlayers 3

that's what I could think of right now, I hope it helps

Upvotes: 1

Related Questions