This API captures detailed images of an area using Google Maps Static API
This API is intended to be consumed by Capture Maps UI. However, it is may be consumed by other systems as is.
-
Create
configs/config.toml
in the project root and store Google Maps Static APIcd configs/; cp config.toml.template config.toml
-
Run project
go run src/main.go
Set GOOGLE_MAPS_API_KEY
in deploy/docker-compose.yml
cd deploy
docker compose up --build -d
Set GOOGLE_MAPS_API_KEY
in deploy/docker-compose.prod.yml
cd deploy
docker compose -f docker-compose.prod.yml up -d
POST /print
Content-Type: application/json
{
"lat": 30.316963,
"lng": 78.032560,
"zoom": 15,
"radius": 5
}
Access-Control-Allow-Origin: *
Content-Type: image/png
Transfer-Encoding: chunked
What about the watermark? According to Google Maps Platform Terms of Service, the branding, logos, and copyright and trademark notices can not be removed. :'(
- Latitude and longitudes are converted to Google maps tile coordinates (the first tile is the centre)
- The specification (the level of details and area it covers) is defined by the combination
of
zoom
,scale
, andpixels
(scale
andpixels
are internally configured) - The tiles coordinate around the center tile is calculated using the
radius
. Theradius
is number of tiles from the center tile (inclusive) - The tiles are then joined together and to construct a single detailed image
- Then do the same north and south to the center row
For example, the centre row of the complete grid consists individual tiles collected from west to
east with length 2 * radius - 1
c1 | c2 | c3 | c4 | c5 | c6 | c7 | c8 | c9 |
---|---|---|---|---|---|---|---|---|