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 |
---|---|---|---|
| String | Yes | Your API key for authentication. |
| Float64 | Yes | Latitude of the marker. |
| Float64 | Yes | Longitude of the marker. |
| Integer | No | Width of the map image in pixels (default: |
| Integer | No | Height of the map image in pixels (default: |
| Integer | No | Zoom level of the map (default: |
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 |
---|---|---|
| Invalid Parameters | Missing or invalid parameter values. |
| Invalid API Key | The provided API key is invalid or expired. |
| Server Error | Failed to render or encode the map image due to server-side processing errors. |
Restrictions and Notes
-
Width and Height:
-
Minimum:
100
pixels. -
Maximum:
3000
pixels.
-
-
Zoom Levels:
-
Minimum:
1
(world view). -
Maximum:
20
(close-up view).
-
-
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.