Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Maps draw mode measure distance

I'm trying to implement "Measure Distance" in google maps v3, something like what we can do in Google Maps Web.

Measure Distance

I wonder if there is a library that implmente this as a drawingMode of DrawingManager.

like image 687
José Ramírez Avatar asked May 29 '15 15:05

José Ramírez


2 Answers

You can now use this MeasureTool library for Google Maps JavaScript API v3 to do similar to what Google Maps offers.

Measurement tool for Google Maps API - project page

Here is a live demo.

like image 178
Downhillski Avatar answered Oct 06 '22 15:10

Downhillski


Here's an example I found of a simple ruler that measures distance between two markers:

http://www.barattalo.it/measure-distance-google-maps

The source code is available via a link on that page.

I hope to use the same basic idea in my own Topographic Maps to drag out a series of markers, then use the resulting PolyLine to draw an elevation profile, etc. I'll post a reference to my code here if I'm successful.

That said, since this "Measure distance" UI has been part of the standard desktop Google Maps since July 2014, I would hope that the Google team might share it via the published Google Maps API soon, simplifying our work (not to mention standardizing the UI for such user drawn paths).

FYI,

Chris

like image 29
Chris Schneider Avatar answered Oct 06 '22 16:10

Chris Schneider