Adding an interactive distance calculator to an elevation map without using directions service.

120 views
Skip to first unread message

LostInMaps

unread,
Dec 21, 2010, 10:05:56 AM12/21/10
to google-map...@googlegroups.com
Hello,

I am attempting to build an app based on this example -

http://gmaps-samples-v3.googlecode.com/svn/trunk/elevation/elevation-profile.html

- but with only the direct route as an option as this is intended for giving approximate route info for things like cross country running - across fields etc and not sticking to roads or walking routes, so I cannot use the directions service to return a distance as some start and end points simply are not recognised, others will take enormous detours around the nearest roads etc in some case more than doubling the total journey so using the directions service is not an option.

All routes will have a start and end point, some will have several marker points along the way and I want to retain the drag and drop functionality so an event listener to calculate the new distance is also required.

I have the basic script to calculate the distance between two lat,long points but wondered if something already exists to render this functionality before I set off and script it from scratch?

Thanks.

geoco...@gmail.com

unread,
Dec 21, 2010, 10:13:20 AM12/21/10
to Google Maps JavaScript API v3
On Dec 21, 7:05 am, LostInMaps <peter.jorgen...@freestart.com> wrote:
> Hello,
>
> I am attempting to build an app based on this example -
>
> http://gmaps-samples-v3.googlecode.com/svn/trunk/elevation/elevation-...
>
> - but with only the direct route as an option as this is intended for giving
> approximate route info for things like cross country running - across fields
> etc and not sticking to roads or walking routes, so I cannot use the
> directions service to return a distance as some start and end points simply
> are not recognised, others will take enormous detours around the nearest
> roads etc in some case more than doubling the total journey so using the
> directions service is not an option.
>
> All routes will have a start and end point, some will have several marker
> points along the way and I want to retain the drag and drop functionality so
> an event listener to calculate the new distance is also required.
>
> I have the basic script to calculate the distance between two lat,long
> points but wondered if something already exists to render this functionality
> before I set off and script it from scratch?

You mean something like this?
http://www.geocodezip.com/v3_GenericMapBrowser.asp?filename=RiverWalk080702e.xml

-- Larry

>
> Thanks.

LostInMaps

unread,
Dec 21, 2010, 10:21:58 AM12/21/10
to google-map...@googlegroups.com
No. On your link you cannot move or add markers and it does not display elevation.

geoco...@gmail.com

unread,
Dec 21, 2010, 10:43:59 AM12/21/10
to Google Maps JavaScript API v3
On Dec 21, 7:21 am, LostInMaps <peter.jorgen...@freestart.com> wrote:
> No. On your link you cannot move or add markers and it does not display
> elevation.

But it does calculate the length of the polyline, which was what you
were asking about.

-- Larry

LostInMaps

unread,
Dec 21, 2010, 10:56:40 AM12/21/10
to Google Maps JavaScript API v3
Thanks for the input Larry, I already know how to do that part, I'm
just struggling with building this slickly into the interactive
functionality shown on the link above.
If it were a static polyline with no moveable markers I'd be flying!

I need the use to be able to move the markers - any number between 1
and 10 and for the new elevation and distance to show simultanoeously
so the script needs to chug out a new distance on the fly by adding
the distance between an unknown number of markers as they are moved or
dropped into the map.

geoco...@gmail.com

unread,
Dec 21, 2010, 11:03:13 AM12/21/10
to Google Maps JavaScript API v3
So what problem are you having with doing that?
(a link to _your_ map that shows how far you have gotten will prevent
me from wasting any more of your or my time)

-- Larry

geoco...@gmail.com

unread,
Dec 21, 2010, 12:58:59 PM12/21/10
to Google Maps JavaScript API v3
On Dec 21, 8:03 am, "geocode...@gmail.com" <geocode...@gmail.com>
wrote:
I think this is what you are looking for:
http://www.geocodezip.com/v3_elevation-profile_distance.html

  -- Larry
Reply all
Reply to author
Forward
0 new messages