I have another question about calculate distance. I have a database (in MySql) in which I store the lat/long coordinate of any POI (park). In my page, I would insert two form, one for departure address, the other for destination address and I would find two separate trip plan: - one from departure address to the POI (stored in my database) nearest to departure address - the second from that POI to the destination address (eventually with Google Transit)
So, to find the POI nearest to departure address I think translate this last to its latitude/longitude coordinate (with GClientGeocoder.getLatLng) (call this point A), then calculate the distance between A and all POI in the database (with the formula 6363*sqrt( ( RADIANS( 45.812775 ) - RADIANS( latitude ))^2 + (RADIANS( 9.035438 ) - RADIANS( longitude ))^2 ) ), and finally invoke Google Maps to get directions. Is it the right way? How can I show the maps togheter in the same page? Thanks! On 15 Ott, 17:30, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > On Oct 15, 6:36 am, Francesco <[EMAIL PROTECTED]> wrote: > > > Thanks Larry. > > > I would shortest driving distance, but if it is hard to find, closest > > point is fine too. > > You may want to find the 4 or 5 closest points, then refine using > driving distances (if the extra time is worth it) > > > There is a procedure to place the marker in an array, if they are > > already placed into the map? > > To do it in the API you would probably need to export your markers > from MyMaps as KML then use one of the third party parsers (EGeoXml or > GeoXml) which exposes the array of markers. > > > Also, distanceFrom works only with GLatLng class? > > Yes. As it says in the documentation. > > -- Larry > > > > > On 15 Ott, 15:19, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > > > > On Oct 15, 5:34 am, Francesco <[EMAIL PROTECTED]> wrote: > > > > > Hi! > > > > Sorry for my bad english, I'm an Italian student. > > > > I would know if there is a way (API) to find the nearest marker > > > > (placemark set in MyMap) from the departure address (so if departure > > > > address is set into the map, the method returns the nearest > > > > placemark). > > > > Yes. > > > Do you want shortest driving distance or closest point? > > > How many markers do you have? If you have a lot and a database, you > > > may want do do some of the work on the server. > > > > General concept, assuming an array of markers, iterate through the > > > array, find the point with the smallest value of .distanceFrom the > > > departure address. > > > > -- Larry- Hide quoted text - > > > - Show quoted text - --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Maps API" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/Google-Maps-API?hl=en -~----------~----~----~----~------~----~------~--~---
