A simple Google Maps tile downloader and stitcher.
Note: I've reimplemented (and significantly extended) this tool in Python – meet ærialbot. Despite having been designed to power a set of Twitter bots, if you configure it to download an area around a fixed point and leave the Twitter API credentials blank, it's essentially equivalent to this tool. Notably, as it uses a threadpool for tile downloading, it's significantly faster than this tool.
Since Gomati is a humble shell script, you'll need bash
, along with common command-line utilities – the only ones I'm not confident you already have are curl
and imagemagick
. Your package manager probably provides them.
Using this tool is as simple as entering your desired latitude and longitude in the source code, optionally taking a peek at the other parameters you can modify, and running:
bash gomati.sh
A more detailed list of requirements and usage/configuration instructions, along with a couple of tips and tricks, is located at the top of gomati.sh
.
Gomati stands for Google Maps Tiles and is apparently also a river in India.
Because satellite imagery can be extremely beautiful, and I was looking for a way of easily downloading high-resolution satellite views of arbitrary locations such as the center pivot irrigation farms of the American heartland.
Probably. I haven't checked. But they haven't banned my IP for downloading tens of thousands of map tiles during development and testing, so you're probably good as long as you don't go overboard downloading a centimeter-scale map of your country.
I'm not an ethicist, but consider this: Google is a stupendously profitable company that earns the bulk of its income via folks like you just going about their days surfing the ad-filled web.
The limiting factor is probably RAM during the stitching step: I've grabbed an 80-by-80 tile map (that's 6400 tiles for those of you keeping track at home) of my hometown, and ImageMagick ate about 12 GB of RAM while stitching them together into a 20480x20480, 420M pixel image.
(The effectively-free Google Maps Static API limits you to 1280x1280 pixels unless you're grandfathered into a discontinued premium plan, as I've learned after building Gomati.)
Since it's a shell script, there's zero multithreading and a whole bunch of context-switching overhead, plus I made a real fancy progress indicator that's updated in a tight loop (i.e. a lot of string manipulation happens frequently). I should have implemented this in Python – and I would've, if only I had anticipated the amount of feature creep I ended up sneaking in.
(The slowness isn't an issue if you use Gomati as I indend to use it: occasionally grabbing a 100ish tile map, which takes fewer than 30 seconds. Think of at as, uh, a totally intentional rate-limiting feature.)
By plugging them into the surprisingly simple Web Mercator Projection formulas.
Either by trial and error (will always work) or via this page (will work until Google significantly changes their documentation).
Not a question, but sure: 💵
Not a question, but sure: Meet @americasquared.
Possibly. Please feel free to file an issue – I'll be sure to take a look!