[GET] static

/static

Get a basic static map image with a red marker in middle.


Endpoint

GET https://get.freestaticmaps.com/v1/static

Method

  • GET

Response Format

  • PNG Image

Request Parameters

Parameter

Type

Required

Description

api_key

String

Yes

Your API key for authentication.

lat

Float64

Yes

Latitude of the marker.

lon

Float64

Yes

Longitude of the marker.

width

Integer

No

Width of the map image in pixels (default: 600, range: 100-3000).

height

Integer

No

Height of the map image in pixels (default: 400, range: 100-3000).

zoom

Integer

No

Zoom level of the map (default: 14, range: 1-20).


Example Request

Below is an example of how to request a static map using curl:

curl -G \
  --data-urlencode "api_key=your-api-key" \
  --data-urlencode "lat=12.9674527" \
  --data-urlencode "lon=77.7238487" \
  --data-urlencode "width=500" \
  --data-urlencode "height=300" \
  --data-urlencode "zoom=16" \
  https://get.freestaticmaps.com/v1/static -o output_map.png

Explanation

  • API Key: Replace your-api-key with your valid API key.

  • Latitude (lat): 12.9674527 (example).

  • Longitude (lon): 77.7238487 (example).

  • Width (width): 500 pixels.

  • Height (height): 300 pixels.

  • Zoom (zoom): 16 for a closer view.

  • Output: Saves the resulting map image as output_map.png.


Response

The API returns a PNG image of the requested static map, with a red marker at the specified latitude and longitude.


Error Responses

HTTP Status Code

Meaning

Description

400 Bad Request

Invalid Parameters

Missing or invalid parameter values.

401 Unauthorized

Invalid API Key

The provided API key is invalid or expired.

500 Internal Server Error

Server Error

Failed to render or encode the map image due to server-side processing errors.


Restrictions and Notes

  1. Width and Height:

    • Minimum: 100 pixels.

    • Maximum: 3000 pixels.

  2. Zoom Levels:

    • Minimum: 1 (world view).

    • Maximum: 20 (close-up view).

  3. Ensure your API key is valid and not shared publicly.


Swagger Integration

Explore the API with Swagger UI at:

GET https://get.freestaticmaps.com/swagger/index.html

For more details, visit FreeStaticMaps.

Updated on