Google Maps and GeoJSon: latitude and longitude conversion - javascript

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/

Related

get coordinates of places in Google Mp API

I'm trying to extract the list of coordinates of places (polling stations) shown on a dynamic map using the Google API
http://psleci.nic.in/Default.aspx
After I have selected a particular State, district and AC, the map displays all corresponding places.
My question is : how do I retrieve these places coordinates in a form of a table?
I've no knowledge of javascript, so I don't understand the associated scripts.
Thanks
For getting the coordinates of different places, you can use Geocoding Service in Google Maps JavaScript API.
Geocoding is the process of converting addresses (like "1600 Amphitheatre Parkway, Mountain View, CA") into geographic coordinates (like latitude 37.423021 and longitude -122.083739), which you can use to place markers or position the map.
It explains here what parameter you need to use, also it has a code example that can serve you as a guide.
For storing the coordinates or your data, you can check this documentation Creating a Store Locator with PHP, MySQL & Google Maps, that has a tutorial about Populating the table.

Geocoding information from a web crawler with Javascript

I've built some web crawlers to gather information about Hijacking Hotspots in South Africa... I've retrieved location information, but its all listed in a vague format, e.g.: "The William Nicol Drive offramp from the N1 from the Sandton side" ... Each location is formatted in JSON format right now.
My Problem:
I want to iterate through a list of all these descriptions/locations and retrieve rough GPS coordinates for each one. Would using the Google API with Javascript be the best option for achieving this? And does anyone have some code examples to demonstrate how I should go about getting this done with Javascript. Please keep in mind that I'm only an intermediate Javascript coder.
I need the quickest most efficient method of getting this done because I'm on a tight deadline and I'll have to use this method for a few other purposes as well.
Sample JSON Data:
{"data":{"area":"Cape Town","location":"Corner of Alice St and Voortrekker Road", "gps":"?"}}
It would be great if you can provide a sample of your JSON response.
The Getting Started page for Maps API have samples that will guide you through the whole process of what you want to develop.
The easiest way to do it is if the JSON response you have have lat/long coordinates. This way, you iterate through the items and place Markers to the map.
If no coordinates are available, but there's a placeId on the response, you can try out the Places API. You'll just need to provide the placeId in PlacesService.getDetails() and the response will contain an object with the lat/long coordinates - which you'll add into the marker.

Fetch Longitudes and Latitudes by walkthrough the MAP

I have a question and I don't know that is feasible or not. I tried hard but I am not getting any idea. Actually what I am doing is I am collecting the data for doing a load test. For that I am collecting several address. I got some of the longitudes and latitudes from one of the website. Based on these longitudes and latitudes I generated the address by using the Google Places API. But I need more data but I don't have any geolocations.
Here my questions are
Is there any way to get the address without mentioning the latitude and longitude by using google maps.?
Is there any way to get the addresses by walk through the google maps.? Say for example, in the google maps if I click San Jose, CA, United States we can see a mark in the google maps (Mark represents boarders of that place). Is there any way to get all the addresses from that mark. Say for example, I will mention one of the geolocation and based on that I will move north side by slightly increasing the longitude and latitude and in the same way after some time I will move some other side etc.
Is there any way to know the boarders of that place.?
Is there any way to get the address without mentioning the latitude and longitude by using google maps.?
You can try out Google Places API to search based on the address. You can search for places there and return Places that are likely to match the query.
Is there any way to get the addresses by walk through the google maps.? Say for example, in the google maps if I click San Jose, CA, United States we can see a mark in the google maps (Mark represents boarders of that place). Is there any way to get all the addresses from that mark. Say for example, I will mention one of the geolocation and based on that I will move north side by slightly increasing the longitude and latitude and in the same way after some time I will move some other side etc.
I think you may be referring to the oogle Maps Geocoding API for this one. It can convert addresses to coordinates and vice-versa (reverse geocoding)
Is there any way to know the boarders of that place.?
It seems to not be possible based on this SO ticket. However it did provide an alternative solution that may be similar to what you want to do.
Hope this helps!

map city/zipcode polygons using google maps

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.

Google Maps Api, get locations from a route drawed on a map

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.

Categories