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.
Related
I am working with leafletjs.com and added MAP. I want to get elevation from current latitude and longitude or current place only, but it will return whole path elevation.
var el = L.control.elevation();
el.addTo(map);
var gjl = L.geoJson(geojson,{
onEachFeature: el.addData.bind(el)
}).addTo(map);
map.addLayer(service).fitBounds(bounds);
How can I find the elevation with either mapbox or leafletjs.
Leaflet is a map display library, not a data API, not a elevation raster query library.
For this, you will have to rely in some kind of elevation dataset (which one is "better" depends on your definition of "better").
For example, see Getting Altitude(height from sea level) of my location in iphone SDK
Whether to use a service like that or whether you should have your own elevation dataset is up to you. In any case, Leaflet does not provide a favourite elevation query service by default (contrary to what Google Maps does, as it relies on Google's elevation datasets).
Extending on #IvanSanchez's answer, you'll need to integrate a service to grab the elevation from your point. One such library which will do this with Mapbox is https://github.com/mcwhittemore/mapbox-elevation
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!
I'm trying to implement a Google Map.
Part one is centering the map to a specific address, which works quite nice.
My next problem is that I have to place a marker for a store on the map, based on a search on the store name. The marker should probably be connected to a search result in order to display a info bubble when clicked. How to get about and do this, I'm totally qlueless about.
Your steps seem ok to me, I assume that the search for store name goes to your server and you return some result with store names and addresses, then you look that up using Google Geocoding API and fetch the lat/lng coordinates and place the markers on the map, here are the steps that I would probably use:
Create a map
Center on a specific address
Search for a store
If the result has geocode associated with it then just use that to place a marker.
If the result does not have lat/lng then make a request to Google Geocoding API to get the lat/lng coordinates. After that place the marker, store the received geocode to your database (by using some background Ajax request).
The Google Geocoding API best practices suggest that you should store the geocodes so that you don't have to query each time to Google's servers. In order to do that you will need to modify your backend so that it also stores Geocode along with the store details, and in search result you can return the geocodes if available.
On a side note, you can use GMaps JavaScript library for easy map manipulation.
Update
The above solution works perfectly in your revised scenario. Let me rephrase the flow again:
The backend would return a list of stores when searched by a store name (this should be pretty easy I guess)
If results are not empty then loop through the list and see if all of them has a lat/lng value associated with.
If you do not find a lat/lng value for a record then make a Geocode request to Google's server passing the address of the store (you need to have at least the address of the store else you can't get the lat/lng value from Google) as a parameter. If the record has a lat/lng value then just go ahead and place a marker on the map.
Once you receive the response from Geocode API then go ahead and place a marker on the map using the maps library API as provided. For GMaps it is map.addMarker({...}).
Once all the the requests are complete then you can consider optimizing a bit which was suggested earlier where you can store the received geocodes in your own server, so that you don't have to fetch them again and again.
To implement the above steps you need to have familiarity with the Maps JS library as well as JavaScript and Ajax/JSONP. Remember that all your Geocode requests(JSONP I think) are asynchronous and you should invoke the marker placement code only when the response is available to you (typically inside a callback). The GMaps library examples are very easy and simple to start with. I hope this explanation should be enough to solve your problem and if it helps you then you can consider marking this an answer.
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/
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.