I'm trying to implement "Measure Distance" in google maps v3, something like what we can do in Google Maps Web.
I wonder if there is a library that implmente this as a drawingMode of DrawingManager.
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.
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
Related
I've found an answer using Google Maps Marker but since its dead, I hit a dead end.
I was wondering if anyone would have any knowledge on how I would replicate this for a user on my website: https://www.google.ca/maps/place/Toronto,+ON+M4N+3M5/#43.7216028,-79.3771275,16z/data=!3m1!4b1!4m5!3m4!1s0x89d4cd2e4f1652cd:0xee93f0117ea5797d!8m2!3d43.7215696!4d-79.3768256
I would like to take the users postal code and outline there boundaries. I'm not sure if this a broad question but I need to stick with using Google Maps API in this case.
Currently Google Maps JavaScript API doesn't expose any boundaries of geographic features. There is very old feature request in the public issue tracker to add this functionality, however it looks like Google didn't set high priority on this task:
https://issuetracker.google.com/issues/35816953
Feel free to star the public feature request to express your interest and subscribe to further updates from Google.
You can get polygons from other sources and add them to Google maps as additional layers.
The nice workaround to get polygons in GeoJSON format from OpenStreetMap is described in the following answer:
https://stackoverflow.com/a/40172098/5140781
So, if you download the GeoJSON you will be able to add it to map using the data layer and its loadGeoJson() method:
https://developers.google.com/maps/documentation/javascript/datalayer#load_geojson
You can style colors of GeoJSON objects and create info windows. Just read the aforementioned documentation.
I hope this helps!
You can't get the boundaries directly from Google Maps API. Best option would be to have geojson files for each postal code and then load the relevant one as a geojson layer in Google Maps.
https://developers.google.com/maps/documentation/javascript/datalayer#load_geojson
The solution I ended up using was googles geo coding api: https://developers.google.com/maps/documentation/geocoding/intro
It gives the boundaries you need for a neighbourhood which then can be used against the google maps api to plot the area.
I'm looking to extract terrain information from Google (Maps or Earth). Currently I am using the Google Maps Elevation Service. I'm reading LineStrings from a KML document and making several calls to getElevationAlongPath. I then save the output elevations along with the input lat and long (converted to UTM) into a point cloud, mesh the point cloud and then can import into something like Rhino.
However I am concerned that I am going to very easily fall foul of the ElevationService usage limits even with a "Google Maps API for Work" license. If I look at other tools who have achieved this (Such as "Lands Design" for Rhino or "Terrain Plugin" for 3DS Max, they appear to be using Google Earth Plugin/API rather than Google Maps.
Can anyone please help and point me in the direction of the right calls to the Google Earth API - to extract terrain data.
For anyone else looking at this - Google Earth GEGlobe.getGroundAltitude(double lat, double lon) looks like it's the answer - though the general advice looks like it is "stick to the Maps Elevation Service"
I am trying to create a 3D map on a web page. Google Maps and Open Street Maps provide an API for using 2D maps. Are there any APIs available for 3D maps?
You probably want to take a look at WebGL Earth, an open source project based on WebGL. Here's a demo.
Here are other links which may be of interest to you:
Mapbox GL JS
Tangram, Open-Source OpenGL Maps
ArcGIS Web API support 3D maps.
wrld.js, also see on GitHub.
cesium.js, on GitHub as well.
see this question with other suggestions as well!
Edit (08/2017): removed dead links (thanks #Pang!), added newer ones.
I'm working on a personal project involving map-making tools for a tabletop game that I play. I've worked with Google Maps in the past before, and it looks like in version 3 of the API, they have removed the API key restriction.
I have done some research into making a custom map, and have come across this page on mapki, but the example seems to be focussed on creating new tiles for existing real-world coordinates.
Is it possible to make custom maps that are not dependent on real-world coordinates in the Google Maps API v3?
(Slight tangent: If it is not possible to do this, what other tools exist to make custom maps?)
You could look at OpenLayers. I get the impression it's used a lot in the OpenStreetMaps community.
OpenLayers makes it easy to put a
dynamic map in any web page. It can
display map tiles and markers loaded
from any source. OpenLayers has been
developed to further the use of
geographic information of all kinds.
OpenLayers is completely free, Open
Source JavaScript, released under the
2-clause BSD License (also known as
the FreeBSD).
You could use Mapnik to render the tiles and serve them yourself. The OSM wiki has lots of documentation on doing that sort of thing.
On maps.google.com you can see a brilliant example on how a google maps application can suddenly turn into a google earth application smoothly.
I'm developing a google maps application, working with API version 3. I read the following line in the Google Earth API summary
If you have an existing Maps API site,
you can 3D-enable your page with as
little as one line of code.
But I have searched for hours without finding any clue how to enable 3D in my application. I've built my application on the google.maps.Map constructor and included the google mas API from this url: http://maps.google.com/maps/api/js
Does anyone know what I'm talking about and/or know how to enable 3D in a google maps application in 1 line?
Codemonkey
The previous answer by Fraser is perfect for V2 of the Maps API. However it's strongly recommended to use V3 since V2 has been deprecated.
To get similar functionality in V3 you can use the utility library at http://google-maps-utility-library-v3.googlecode.com/svn/trunk/googleearth/ -- simply include the javascript library, and then in your code instantiate the Earth layer for your map:
var googleEarth = new GoogleEarth(map);
To add the Google Earth instance to your map, simply add the G_SATELLITE_3D_MAP to your map with GMap2.addMapType().
var map = new GMap2(document.getElementById("map_canvas"),{ size: new GSize(640,480) } );
map.setCenter(new GLatLng(42.366662,-71.106262), 11);
// Enable the Earth map type
map.addMapType(G_SATELLITE_3D_MAP);
var mapControl = new GMapTypeControl();
map.addControl(mapControl);
map.setMapType(G_SATELLITE_3D_MAP);
Here is the information on Integrating v2 of the maps Api with the Google Earth Plugin
http://code.google.com/apis/maps/documentation/javascript/v2/services.html#Earth
Maybe Google means using KML(KMZ) files?
This language supports by Googgle Earth and Google Map.
I can make mistake, but it link is helpful - http://sketchup.wikia.com/wiki/KML