Google Maps API - Find matching place between two points? -


i explain issue in below image (i'm sorry speak english not well).

i'm using google maps directions api calculate directions between start point , destination , there place between them (you see in map). how can know place on route?

enter image description here

the way can think of (and have used method) thus:

when make directions request, receive directionsresult object. if drill down result can latitudes , longitudes. if using javascript api, example:

// every step 22 latlngs per mile; we'll try 1 latlng per 3 // miles or so:     var specroute = directionresult.routes[0].legs[0].steps[i];     (var j = 0; j < specroute.path.length; j = j + 171) {         var lattotal = latarr.push(specroute.path[j].lat());         var lngtotal = lngarr.push(specroute.path[j].lng());     } 

in example formatting arrays of lats , lngs compared lot of other lats , lngs in php file elsewhere. sounds need check 1 latlng should simpler.

what did thereafter (and do) determine how close path point required be, , write logic check. straight latitude , longitude numbers, or convert distance measurement (miles, meters, etc).

there negative aspect in have deal converging longitude lines farther north go (in northern hemisphere). used regression fit workaround there better way.

there may better method doing this, way think of on past projects.


Comments

Popular posts from this blog

Delphi XE2 Indy10 udp client-server interchange using SendBuffer-ReceiveBuffer -

Qt ActiveX WMI QAxBase::dynamicCallHelper: ItemIndex(int): No such property in -

Enable autocomplete or intellisense in Atom editor for PHP -