Google Maps - Scraping KML / extract overlays data ( coordinates ) - google-maps

I would like to understand how to scrape / extract KML data from a google map overlay.
I have been trying for last few month without success. I did try using fiddler and my console developer tools to look into the site's source code.
I went through almost every line of Javascript and I still cannot figure out how to intercept the KML data or extract it from these maps (see below).
Target Maps
Here is an Overlay that consists of one Satellite footprint.
and Here you can find much more examples of similar maps.
I am not even sure if this is possible and how it can be achieved.
Has anyone been able to do a similar task ? Please I need guidance on how to achieve this.
Thank you for your time.

I take a look and tn the overlay there aren't data to scrap...
For the KML is simple you can do it server side. opend then kml like an xml file and the scan this dom for placemark, polygon and lineaRing tag inside you find the coordinates in lng, lat format..
Client side you can do this whit jquery loading the xml file and scan for node you need ...
The kml struct is standard...
<Document>
<Folder>
<name>Full Satellite Footprint - EIRP</name>
<Placemark>
<name>Atlantic Ocean EIRP 40dBW</name>
<styleUrl>https://www.telesat.com/kml/TelesatKMLStyles.kml#coverageArea</styleUrl>
<Polygon>
<outerBoundaryIs>
<LinearRing>
<coordinates>36.826,55.201,0 37.0055090185901,55.2151134621769,0 36.8423211206917,55.6055987892911,0 36.5363438121321,56.3253739818074,0 36.2041398771245,57.1121727752464,0 35.6982976142624,58.2038341375218,0 35.4781980136987,58.66035224623429,0 35.2392363744069,59.1245171274041,0 34.991585220959,59.5937508918316,0 34.7381410580738,60.0586398991811,0 34.4948230756851,60.5170059779041,0 34.2134913653683,60.9937069314964,0 33.9399744247826,61.4547783456267,0 33.6430131750038

You can use pjscrape..
It has a cool WebKit engine which can run the Javascript and render the page. Maybe that's the thing you're asking.

Related

Convert Google map with huge amount of data to a static using Google Static Maps

I need to convert a map built with Google Maps to a static map.
The problem is that map has an amount of data (mainly circles), and its representation has to be doing a path description of its circunference, and I need some kind of accurate, a pure circle has to be displayed in the static mode, so each circle description is about 500 chars (encoded).
The Google Static Maps url limit is 8192 and its not enough for rendering those shapes.
There is another way for doing it? I also tried to use html2canvas, but it is forbidden by Google.
Google actually recently extended the URL limit to 8192, but if you need more than that you probably need to resort to taking a screenshot of a Google Maps JavaScript API map, as suggested by xomena.
A tool like PhantomJS [1] can help you write a script to automatically take a screenshot of a webpage (which you've drawn using the Google Maps JavaScript API).
[1] https://github.com/ariya/phantomjs/wiki/Screen-Capture
I have a small example that uses PhantomJS to take a screenshot of the page.
Here's the JavaScript Map with some information: http://jsbin.com/pevizusana/2/edit
Here's the PhantomJS code that will take a screenshot on this site: http://pastebin.com/gEXhG1dP
And here's the result: http://i.imgur.com/Mj951aP.jpg
I hope you find this information helpful.
I'm the author of osm-static-maps, It's an open source project that you can use as a cli or js library or self-hosted http server. It mimics google static maps and you can pass any amount of data to the map as a geojson.
See the project here for more instructions https://github.com/jperelli/osm-static-maps

Get coordinates from a Google Maps Embed Link

I'm developing an app for iPhone that uses Mapkit and I want to include the coordinates used in this Google Maps Embed Link (I'm not the author).
The map is very simple and doesn't show the coordinates (At least I couldn't find them), so I think that analysing the link there might be useful parameters that would allow me to dump or export them. Is it possible?
Any help will be much appreciated.
Download the KMZ for the map, the archive contains a KML-file with all the data:
https://www.google.com/maps/d/kml?mid=zZY3Uui1vIqo.khcCc7obcc5U

Best way to display 100k+ points on map

I have a dataset with several hundred thousand lat/long points. I would like to render these points on a map for info-graphic purposes (as small dots or something similar).
This is not something that necessarily has to be interactive, or rendered in a browser. It's okay if it's just an image.
I know that attempting this with markers and Google maps would be tough... any other tools out there that would generate this type of map? Preferably free/open source?
Or, do you have a method to make this work with something like Google maps? I don't want to use a marker clusterer... I need to be able to see all of the points.
In short :)
Download and fire-up Quantum GIS
Add some background map (e.g. OSM WMS layer from http://129.206.228.72/cached/osm)
Have your data in a CSV file, in WKT format, and load it on top (using add delimited text layer)
Save as image
You might want to peek what stackexchange.com has on GIS, too.

Query existing, public Google Map via the Google Maps API v3

I am trying to embed an existing, public Google Map into a website. Specifically this one:
http://goo.gl/maps/cHf2
Of course I could use the iframe embed to achieve this, but I would like a little more control over the map … I imagined being able to pull all the markers from the map and display them as an index next to the map. Kind of like Google already does, but embedded in my page with my own styles and images.
I have been digging through Google, Stack Overflow and the API instructions and couldn’t find any relevant posts. In the GET string of the map on Google we can see this chunk:
&msid=212828439842926497866.0004bfae4da003d8ffd1f&mid=1341413217
I thought in there might be a maps ID and I could use it to query the content of the map through the API? The intention is using Google Maps as a CMS for less technical minded people and not dealing with geo data in our own CMS.
Any help would be greatly appreciated. Maybe I am just missing the forest for the trees.
You can download the kml that specifies the markers in that page and display that on your API based map. This example defaults to displaying it using geoxml3, but you can hide that and display the KmlLayer version.
You should be able to just point KmlLayer to the link (I downloaded the kml and put it on my server so it would work with geoxml3).
Here is an example (taken directly from the documentation) that does that
here is the original

google maps: find out coordinates

i'm parsing some html data which has google maps embedded (displaying just one certain point) and i was wondering:
how can i find out the exact geographic coordinates of that point?
thx
I will look into this further but if you are able to see the Google Maps representation, you can type this into your browser and it will pinpoint the exact center location:
javascript:void(prompt('',gApplication.getMap().getCenter()));
Very useful if you want to get quick lat/long values. Is this the kind of info you need?
Parsing HTML files and want to find what point map is displaying?
This is likely not be possible (correct me if I am wrong). The map is a JavaScript object that only exists inside a browser - it is only text code in the html file. Map variables and data only exist inside the JavaScript engine running inside the browser, their dynamic variable state cannot be stored in a file ahead of time.
If the site is displaying a static map image then we have a different story. Just parse the URL to google static maps requesting the map image.
i found out that the actual coordinates were stored in the html :)
Have you tried the LatLng Marker lab in google map?