Static Maps

Static maps are standalone images (in JPG or PNG format) that can be displayed on web and mobile devices

Static maps can be displayed without the aid of a mapping library or API. Our Static Maps API returns an image in response to an HTTP request. For each request, you can specify the map's location, size of the image, zoom level, type of map. You can also place markers or draw paths at locations on the map.

๐Ÿ”‘

Do You Have Your Access Token?

Before you proceed, ensure you have your access token at hand. Can't find your token? No worries โ€” our guide will assist you in either creating a new one or finding your existing token.

Plot a Static Map

The basic syntax for a static map request using the LocationIQ API is as follows:

https://maps.locationiq.com/v3/staticmap?key=<YOUR_ACCESS_TOKEN>&center=<latitude>,<longitude>&zoom=<zoom>&size=<width>x<height>&format=<format>&maptype=<MapType>&markers=icon:<icon>|<latitude>,<longitude>&markers=icon:<icon>|<latitude>,<longitude>

Here's a breakdown of the parameters used in the API call:

  • https://maps.locationiq.com/v3/staticmap: The endpoint URL for the LocationIQ Static Maps API.
  • key: This required parameter specifies your LocationIQ API access token. Replace <YOUR_ACCESS_TOKEN> with your actual access token.
  • center: Specifies the center of the map using latitude and longitude coordinates.
  • zoom: Specifies the zoom level of the map.
  • size: Specifies the size of the map image in pixels.
  • format: Specifies the format of the map image (jpeg, jpg, or png).
  • maptype: Specifies the map theme/ style (streets, dark, or light)
  • markers: Allows you to add markers to the map. You can have multiple markers, each with its icon and coordinates.

๐Ÿ‘

Static maps are set to default to PNG format. JPG is recommended for optimal performance and reduced file size.

To generate a static map of New York City centered on Times Square with a zoom level of 16 and a size of 600ร—400 pixels in JPG format, you would use the following request:

https://maps.locationiq.com/v3/staticmap?key=<YOUR_ACCESS_TOKEN>&center=40.7128,-74.0060&zoom=16&size=600x400&format=jpg&maptype=streets

This request would return an image file of the static map that can be embedded in a web page or mobile app.


Available Themes

ThemeFormatImage
streetsraster (png/ jpg/jpeg)streets image
darkraster (png/ jpg/ jpeg)dark image
lightraster (png/ jpg/ jpeg)light image

Add marker

Here's an example of a static Map with a marker for Statue of liberty

https://maps.locationiq.com/v3/staticmap?key=<YOUR_ACCESS_TOKEN>&center=40.6892532,-74.0445482&zoom=16&size=600x600&format=jpg&markers=icon:large-blue-cutout%7C40.6892532,-74.0445482
  • The center parameter indicates the map's central point's latitude and longitude. In the provided URL, the center point is defined as 40.6892532,-74.0445482, which corresponds to the Statue of Liberty's location.
  • The markers parameter specifies the marker(s) to incorporate on the map. In the provided URL, we've included a single marker with the subsequent attributes:
  • icon:large-blue-cutout: This specifies the chosen marker icon โ€“ a large blue cutout icon.
  • 40.6892532,-74.0445482: These are the marker's latitude and longitude coordinates, set to match the map's central point, representing the Statue of liberty's location.