I am looking for a javascript library that supports the ability to pass a zipcode or city as a parameter, and get a list of x,y coordinates to draw a polygon using google maps?
Does this exist? Does the google maps API support such queries? I am looking for an array of coordinates similar to those that google uses to draw maps on a google query:
Google Maps API doesn't support that kind of solution. There are a couple other places from which you can get the coordinates, though:
Flickr API
There is a Flickr API based on photos that people tag, but it's only as accurate as the people who tag photos: so it's good enough for bootstrapping but probably not for production: http://karya-blog.blogspot.com/2012/12/fetching-city-polygons-with-flickr-api.html
Natural Earth Data
An accurate alternative is www.naturalearthdata.com. To get that data from there you just need to make two requests: one with the city name and one with their ID to get the parameters:
unlock.edina.ac.uk/ws/search?name=berlin&gazetteer=naturalearth&format=json
and then
unlock.edina.ac.uk/ws/footprintLookup?format=json&identifier=14126951
and you're set :)
Mapzen
If it's possible for you to pre-fetch the data, go for Mapzen, they have a full and pretty accurate database: https://mapzen.com/data/borders/
Short answer: I do not think there is any magical getZipCodeBoundaries method in the Google Maps API. However, what you want to do can and has been done. Please see the implementation, and this thread on Google groups concerning the process. Is the first link similar to what you're hoping to accomplish? Also, there is a neighborhood API offered from Zillow under the CC license. You might want to look into that and see if it breaks neighborhoods down by zipcode.
You can get polygon coordenates in json for using with googlemaps using openstreetmap.
Go to http://nominatim.openstreetmap.org/
search a place like "Partido de Ituzaingó"
Steps:
Click on "details"
Look for the OSM ID and copy it (control+c), example: 2018776
Go to http://polygons.openstreetmap.fr/index.py
Paste the ID in
Download the polygon
Look on this site Twitter geo api You have few modes of search, and it gives You boundary box for cities. I am using it now on My site. Try f.e. this link and U will see the results.
Related
I am trying to extract datetime of a location pin when it was added in Google maps.
For e.g. if I search McDonalds in an area then it should give datetime for all McDonald locations in that area with their datetime.
Is there a way to pull up that data.
P.S. This question may not belong here so apologies for that. I have tried other forums but I couldn't find any relevant information.
I hope you are using google maps API for development, so if you want to get place details then you can use Place API.
https://developers.google.com/maps/documentation/places/web-service
Nearby Search and Text Search allow additional parameters to filter results, (e.g. minprice, maxprice, opennow, and type).
PlaceOpeningHours is parameter from which you can get time for particular place
https://developers.google.com/maps/documentation/places/web-service/search-find-place#PlaceOpeningHours
I hope this answer is helpful to you.
Let me begin by saying, I have been searching for resources for this question for more than 3 days, so I truly hope I did not miss an "answer" anywhere.
Background:
I am working on a website/app built in HTML/CSS/Javascript that will use geolocation (Google Maps & Places API) to find a users location and return them the (for example) top 5 closest water parks to them at that location they are currently at.
Question:
I want to control the list of results the API picks from. So let's say, it'll only give them 5 out of 30 water parks that are near them and I have previously specified the names/locations of those 30 water parks.
The reason I want to do this is because after searching via Google Maps for "water parks nearby 123 Main Street, City, State" - it doesn't return all the results I want it to, just some.
As I stated, I have looked far and wide for this answer. I have read almost all of the relevant Google Places API and Maps API documentation with no clear cut answer. I have also found a few website that let you use a Google Docs spreadsheet to specify locations, but you can't get the code from them. And I have seen a few example using XML, but nothing exactly what I'm looking for.
I will also note that I am familiar with C# and PHP if that helps get me closer to my goal. But it seems like Javascript is the way to go.
Any help/hints/tips would be greatly appreciated! Thanks!!
Store the data in a database that supports spatial queries(may be a FusionTable for example), then you may use ST_DISTANCE to order the results by distance and LIMIT to limit the resultset.
I'm using Google Maps API to visualize some label on the map using google.maps.Polygon. I used this converter http://converter.mygeodata.eu/ to convert them in a GeoJSon format, but latitude and longitude coordinates where mistaken.
They should be centered in Florence, Italy, but actually i get this:
1680508.8375
4847672.484
I tried tho divide them by 10000 and i got:
16.805088375
48.47672484
wich alow me to show some results, but that was not the results I was looking for (I get them displayed in Austria instead of Florence)
Surfing the net I found this https://groups.google.com/forum/?fromgroups#!topic/d3-js/H0zE7slqV0g that describe my problem and find a solution using d3.
Is there any way to do that just with google maps API and/or using some conversion?
Thanks
Ok seems that I found what the problem is. There are many different way to locate a point in a map. Google Maps uses a WGS84 encoding, but i got the data in EPSG:3003 encoding. So they didn't match.
I was able to find a js library that makes all the conversion you need.
http://trac.osgeo.org/proj4js/
The idea is simple, but I can't find information or examples. I want that the user to draw a route in the map and then be capable of getting the info of locations and addresses in data structure like an array, or json.
http://code.google.com/apis/maps/documentation/javascript/examples/polyline-complex.html
The above link is an example of what you're looking for, have a look at the source code it seems pretty straight forward. This example is for Google Maps api v3
You can retrieve the points using the Polyline,getPoints() method.
When one visits http://maps.google.com, they are able to type queries into the search field and receive results based on locations or places, and not hard search results, as they would in a normal Google Search query. They're a unique style of result (names of places, locations) suited to the Maps interface for obvious reasons.
I've been digging through both the Maps and standard Google Search API for a couple hours now, and have done multiple searches on this question, and I can't seem to find the answer.
They obviously have the Local Search, but that's been deprecated, and it only yields results if you provide an initial lat/long. I want to be able to find places or locations with no initial lat/long.
Essentially what I want to do is allow a user to type in an address, name of a place or name of a city or state or a zip code, or essentially any other kind of location that is allowable on Maps, and geocode it. I feel stupid because this seems like it has to be there, but nothing I've seen in the API seems to do this.
I don't need the AJAX suggested results, necessarily. Just a way for a user to type in a nice name and geocode from it, though results as a user types would be ideal.
What am I missing here?
What you are looking is Geocoding API from google maps.
Find Documentation here
UPDATE 5/12/2011
Google just opened up public access to their Places API. This is more to the heart of the original question request:
https://developers.google.com/maps/documentation/places/web-service/autocomplete
I think you're looking for the google.maps.Geocoder class:
A service for converting between an address and a LatLng.