Google Maps API Postal Code Boundaries - javascript

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.

Related

Google Maps geometry library in Node.js

I'm having a lot of trouble integrating the Google Maps API into Node.js. I'm currently using the node-googlemaps library.
However, I can't seem to be able to use the Google Maps geometry library specifically within this API.
So far I've gotten the directions API working. I would like to construct a polyline from the result of directions response, and then see if the polyline contains coordinates.
I guess the geometry API isn't 100% necessary, but it's something that I know would work if I could just get it working through Node.
Thank you!
The spherical-geometry-js library ports the Google Maps geometry API, so you could use it alongside node-googlemaps in your code. (Disclaimer: I'm the author of spherical-geometry-js.)

Use Google My Maps Polygons in my API

Here is what I would like to achieve :
I have a Google My Maps map, with a few polygons over a city, representing districts.
On the server side of my application, I would like to create a tool that, when given a position, can return me the polygon it is into.
Is it even possible ?
Maybe My Maps is not the good service, if so, I am totally open to work with something else.
One option is to use the geoxml3 kmz branch with a binary proxy to access the .kmz data from Google MyMaps, that will render your data as native Google Maps Javascript API objects. Then you can use point in polygon tests to determine which polygon your input point is in.
Point in polygon example (using another third party library, a version of epoly, ported to the Google Maps Javascript API v3).
Example rendering MyMaps output using the kmz branch of geoxml3
(Note: I couldn't make your data work, there were character encoding issues that made the KML invalid).

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.
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

Finding terrain info using Google Earth API

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"

Is it possible to make a custom map in Google Maps API v3?

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.

Categories

Resources