Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

Is it possible to generate a kml file of searched items in Google Maps. For example:

  • Search for highschools in Virginia
  • Return the results as a kml file with the schoolname address and location
share|improve this question
add comment

2 Answers 2

up vote 1 down vote accepted

I can't quite figure out what the second set of coordinates are in the search string Mapperz provided, but if you look at the page source you can see urls for subsequent pages in the maps search

so for the first 10 results

http://maps.google.com/maps?f=q&source=s_q&hl=en&geocode=&q=high+schools+in+Virginia&sll=37.0625,-95.677068&sspn=40.409448,92.109375&ie=UTF8&cd=1&hq=high+schools&hnear=Virginia&sa=N&start=0

results 11 to 20

http://maps.google.com/maps?f=q&source=s_q&hl=en&geocode=&q=high+schools+in+Virginia&sll=37.0625,-95.677068&sspn=40.409448,92.109375&ie=UTF8&cd=1&hq=high+schools&hnear=Virginia&sa=N&start=10

results 21 to 30

http://maps.google.com/maps?f=q&source=s_q&hl=en&geocode=&q=high+schools+in+Virginia&sll=37.0625,-95.677068&sspn=40.409448,92.109375&ie=UTF8&cd=1&hq=high+schools&hnear=Virginia&sa=N&start=20

etc.

You could build a scraper with this (just add the &output=kml to the end of the string as Mapperz suggested, it appears the coordinates are only in the kml file, not in the original url source) but the problem is that the query itself only returns at max 200 results. You could add to this a spatially varying search term (i.e. plus or minus the latitude and longitude) to cover the whole state. (Also I thought at first you could just save all of the data if you used Google Earth directly, but this is not the case and it is exactly the same as using the Google Maps search.) I wouldn't be surprised if there is more magic in the url that you could use to your advantage in building a scraper that I am unaware of.

This map comparing density of grocery stores to bars uses data collected from Google, so maybe you could ask the makers how they pulled the data.

share|improve this answer
add comment

Yes, click the Link on Google Maps to expose the full url of the map location and search. add '&output=kml' to the end >save file open in Google Earth or overlay on Google Maps

http://maps.google.com/maps?f=q&source=s_q&hl=en&geocode=&q=high+schools+in+Virginia&sll=37.0625,-95.677068&sspn=40.409448,92.109375&ie=UTF8&cd=1&hq=high+schools&hnear=Virginia&ll=37.753344,-78.409424&spn=1.209552,2.318115&z=9&output=kml

[Note I don't think this is officially accepted - just possible]

share|improve this answer
    
although this method works fine, it'll only return the list of points with a label on them, i.e. the first 10 points. The second thing is, it'll display items outside of the region / state, which is not a real issue, but the first issue is crucial –  dassouki Nov 12 '10 at 15:57
    
You can use The Google AJAX API & Google Maps API to display 20 markers[limitation] code.google.com/apis/ajax/playground/#localsearch_with_markers –  Mapperz Nov 12 '10 at 18:52
1  
@dassouki, I was able to find the coordinates in that file, they are within the placemark tag. It still sucks though that you can only export 10 at a time. I also see you can only have a search at max return 200 results. –  Andy W Nov 13 '10 at 3:04
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.