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

3

0

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.

Katelin answered 5/9, 2016 at 7:31 Comment(0)
R
3

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.

Reiter answered 9/9, 2016 at 8:31 Comment(4)
actually when? the doc said 2048 4 days ago... :/Katelin
There was a public issue tracker issue filed in On April 13, 2016, and marked as fixed on August 29, 2016.Reiter
Looking at the docs, it seems some non-English versions are still lagging behind, and still mention the 2048 character limit. But based on the headers, the English version has been last modified on: Tue, 16 Aug 2016 01:13:06 GMT. Perhaps you got a cached version of the page. Or were you reading a non-English version?Reiter
Yes, the spanish version says the limit is 2048 developers.google.com/maps/documentation/static-maps/…. I have seen that it is different in the english version. I have updated my question. ThanksKatelin
B
1

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: https://i.sstatic.net/FyjaW.jpg

I hope you find this information helpful.

Bacciform answered 7/9, 2016 at 17:21 Comment(0)
S
0

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

Supernal answered 28/3, 2020 at 15:48 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.