-1

I'm hitting the 2048 size restriction on static map creation. I have upwards of 100,000 coordinates that I I'm plotting, and then have I have a button to take a screen shot of the map as it's viewed on the screen, Currently, I am doing this:

function plotMapPoints(locations) {
    var marker, i, pos;
    var image = "http://maps.google.com/maps/api/staticmap?sensor=false&center=0,0&zoom=" + map.getZoom() + "&size=512x512";

    for (i = 0; i < locations.length; i++) {
        pos = new google.maps.LatLng(locations[i][0], locations[i][1]);
        marker = new google.maps.Marker({
            position: pos,
            map: map
        });
        image += "&markers=" + pos.lat() + ',' + pos.lng();
    }
    console.log(image);
}

When I click on the link in my console, it appears to be formatted great, however, I receive this from Google:

413. That’s an error.

Your client issued a request that was too large. That’s all we know.

Does anyone else know of a way to capture the map as an image? I have tried html2canvas as well, however i was having cross origin canvas problems.

Any help would be great.

Shannon Hochkins
  • 11,763
  • 15
  • 62
  • 95

1 Answers1

0

If you use Selenium (or PhantomJS if you want to do it without starting a web browser) you can do it like this link suggests. The XPath of the element you would want to screenshot is: //*[@id="map"]

Community
  • 1
  • 1
djangofan
  • 28,471
  • 61
  • 196
  • 289
  • I'm not using either of these unfortunately, It's a local project, and it has to be standalone (giving this to a friend), so I don't want him to have to install anything if need be. – Shannon Hochkins Oct 10 '13 at 23:34
  • I understand you could probably hack something together that is easier. My suggestion could certainly be made to run standalone. First, run it with Maven and then run it later with the libraries included locally. The Maven run example would be: mvn.bat exec:java -Dexec.mainClass="com.test.foo.Main" -Dexec.args="arg1 arg2..." – djangofan Oct 11 '13 at 00:11
  • You lost me at Maven lol, sorry, a bit too much for something that should be so simple. – Shannon Hochkins Oct 11 '13 at 00:18