How to extract lat and long of all points on Google map? - google-maps

Suppose i searched for ATM's in india, How can i get the coordinates of all the points in the map...?
I found one of the solution as getting kml file and from there i can parse it...but when i added &output=kml to the link...i am unable to get the kml file...not even kml file option.
URL after appending &output=kml
Please can any one help me in solving this...

I clicked the link you provided and I was able to download the KML file. I then opened the KML file in Google Earth which showed all the ATM's in India. I was then also able to find all the coordinates of each ATM.
See this screen shot-
Surprised why that wasn't possible with you..

output=kml no longer works. It was removed (probably because of abuse). You can get some of the ATM's using the Places API, but the results are limited to 60, returned 20 at a time.

Related

Google Maps mangling KML

I've created KML files of some world regions for display using the Google Maps API. This has been working fine, but one region has recently started displaying as if the data's corrupt. You can see what I mean here:
https://drive.google.com/file/d/0B9u3tNbtEyFRMTdwQTdEa0U5S2s/view?pli=1
If I load the same KML in Google My Maps it still displays correctly:
https://www.google.com/maps/d/viewer?mid=z8mYjxPmAgBQ.kGn7mza0JOSU
It used to display fine, but now even if I roll back to previous versions of the file it displays in this weird way.
The KML regions are created using QGIS's Vector > Geoprocessing Tools > Dissolve tool to merge countries (to shp files), which I then save off as KML. Data is from Natural Earth's ne_50m_admin_0_countries data set.
Does anyone know what might be going wrong?
I would say that the Google Maps KML rendering engine has some issues. It works when I use the geoxml3 third party parser to render it, but not when I use the Google Maps Javascript API v3 KmlLayer to render it.
rendered with geoxml3
Note that the performance with third party parsers will depend on the complexity of the KML. Tile base rendering like used in KmlLayer will almost always perform better.
issue #8003 in the Google Maps Javascript API ve issue tracker
I thought I was going crazy. This was working for years until some days ago.
I agree it seems to be where polygons cross the "international date line" or anti-meridian. I see straight lines horizontally across the map.
Furthermore I swapped out my KML file for another from a different source, SAME problem. Thanks for restoring my sanity, I wasted a stressful day trying to fix this, I think it is a Google problem. ps. they work fine in Google Earth.

KML file from Massachusetts GIS - display in Google Maps API

I've been pulling KML files from the Mass GIS service via their export feature:
http://maps.massgis.state.ma.us/map_ol/oliver.php
For example, a KML output of Population Density per Square Mile looks like this when exported:
http://evrkusd.fatcow.com/populationpersquaremile.kml
I try to add it to my Google Map and nothing shows up, although this code works fine with other kml files from other sources.
var NewLayer = new google.maps.KmlLayer('http://evrkusd.fatcow.com/populationpersquaremile.kml');
NewLayer.setMap(map);
I'm getting the idea that some of the kml tags are outdated or are not accepted by Google Maps API.
Is anyone able to get this file to work for them? Any ideas how I can (preferably easily) update this file to work with Google Maps? I'm going to be using multiple KML files like this, so I'm hoping I can do a fairly quick fix.
Your KML file is still too big:
http://www.geocodezip.com/geoxml3_test/v3_geoxml3_kmltest_linktoB.html?filename=http://www.geocodezip.com/geoxml3_test/populationpersquaremile.kml
If you click on the "load KmlLayer" button, it will show you the status return by attempting to load that file in KmlLayer:
Kml Status:DOCUMENT_TOO_LARGE
Your "partial" KML files are not valid xml, if I make the one you posted valid, it works with geoxml3, but the Google Maps API v3 KmlLayer still says it is too big.
See the documentation, the maximum fetched size of a raw KML file is 3M, your file is 7M+.
Fusion Tables can handle much larger KML than client-side maps, up 100MB total (though some limits apply to features). So that might be a solution.

How to improve KML performance

Hi
I'm having some issues with KML performance. At some times the KML markers only appear after a reload which may have to do with google caching the results. I think a better solution is needed perhaps something like displaying a total of markers for an area on a larger zoom level and then more detailed for levels that have more zoom. Is such a solution feasible and if so, how? Can you think of other ways how I can improve performance of my KML map? The links are http://www.koolbusiness.com and the KML file is http://www.koolbusiness.com/list.kml
I can load the KML file into maps.google.com with no problem however when trying to display it on my custom map the display sometimes won't load.
Thanks in advance for any suggestions.
UPDATE: I've updated to using a KMZ file with zip compression. The file is available via http://www.koolbusiness.com/list.kmz and the source and more info is available at http://montao.googlecode.com
don't know if it affects performance but it seems like you need to configure the mime types for kml files.
http://code.google.com/apis/kml/documentation/kml_tut.html#kml_server
Have you tried to compress the kml files as kmz files? You can do this with a zip program and just call the file kmz.
You repeat the style element in the placemarks but you can also create them under the doucment element and then just reference them with an id. http://code.google.com/apis/kml/documentation/kmlreference.html#style
I'm not sure if you've changed the KML yet to conform to some of the previous suggestions but...
The KML File seems to be pretty minimal which is good. I was going to suggest truncating the decimal points on the lat/lng.
You can compress like KML file to KMZ like the previous poster has mentioned. More information can be found here: http://code.google.com/apis/kml/documentation/kml_tut.html#kml_server You'll need to set up the KMZ MIME type on your server too.
You can reduce the amount of white space in your KML file. It seems to have additional spaces when not required...
You can configure your web server to send cached versions of the KML file... I'm not sure what kind of back end you're running though so I can't really give pointers. This might be a reason why the markers don't show. Google's server will time out your request if it takes too long.
As for your question about a solution to displaying total markers in an area for a zoom:
I was thinking you could for each zoom level, check the boundary of the map and then only display markers that have coordinates in that boundary. You'd probably have to write some kind of function that checks if it's in the boundary. I don't know of any way to retrieve the markers from the KML file as objects unless you manually parse the KML yourself using a client side parser.
To help determine why your markers don't load, try using FireBug to determine the requests to Google's servers. And see what kind of response is returning which might lead to more answers to your problem. I believe the one you should look for is KmlOverlayService.
Hope that helps.

How to extract the lat/lng of pins in google maps?

I want to extract the latitude and longitude of a set of about 50-100 pins in a Google maps web page. I don't control the page and I don't need to do it more than once so I'm looking for something quick and dirty. I've got FireFox with FireBug as well as Chrome and all I need is something that's easier than re typing all the numbers.
Simply click the link shortcut on the map to retreive a URL for the map with pins in.
Next add &output=kml to the end of this url and use the link to retrieve a kml file containing all the pin data.
This kml file is actually in xml format so parsing it should be easy, you just need to look for <coordinates> elements which contain the latitude and longitude data you need.
The kml format is documented here: http://code.google.com/apis/kml/documentation/kmlreference.html
Just saving the .html file and using regex works:
These two reg-ex might be good starting points:
#[0-9]+\.[0-9]+,-[0-9]+.[0-9]+",geocode:"",sxti:"[-#A-Za-z .]+"
{id:"[A-Zloc0-9]+",fid
Google has change a lot the way you can extract information about google.maps and has set some limitations like numbers of queries by day.
To extract the lat and lon of Google maps you need a bit of knowledge about HMTL code and manipulating JSON/XML files. (all can be found in many tutorials.
I recommend you to extrac the data using de "Google Places API" it's VERY EASY! and you can extract about 150k locations by day for free. You have to get an account, activate your privileges of API Places (turn on/off buttom), get you secret KEY and then use a simple URL to extract the JSON/XML file. Here are two great links for that:
[1] https://developers.google.com/places/documentation/search?hl=en
[2] https://developers.google.com/places/training/basic-place-search?hl=en
If you want DETAIL info about the coordinates that you'll get, go to the section "Requesting Place Details" in the second link, that gives you info about what kind of site is that, the phone number and all the comments that users has made, if they are available.
Great coding and greetings!
Depending on the type of the map and whether the pins are set by latitude and longitude or by address, it might even work to just get the link (click on "Link" at the Google Maps page, the URL in the browser might not be the sam) and look for the "sll=[...]" parameters.

google maps multiple line segments

this question is kind-of programming related but not exactly - see how we go...
I am trying to view a trip i have made using a gps tracking device onto google maps as one continuous line, however, when i upload the KML file onto google maps it is arbitrarily broken into about 7 different segments.
The trip was made in one go and when shown in google earth it is shown as one continuous line.
I have inspected the KML file and all coordinates are contained within the same single linestring element.
Does anyone know why this is occuring?
Regards
Grant.
It looks like other people have experienced the same problem that you're having, but I was unable to find a solution. It seems that this is just a bug in the Google Maps KML parser.
If you don't mind creating your own map with the Google Maps API, you should be able to parse the file with no problem. There are also some sites like this one which will create a map from your KML file.