To display a point on a static map/with-point endpoint from the ArcGIS Static Maps servicex and y parameters to define the point location. You can also specify the marker style using a pin, square, or circle marker, with optional color and label. Additionally, specify the image width and height in pixels, along with the output format (png, jpeg, or webp).
How to display a static map with a point
The typical workflow to display a static map with a point is:
- Map: Define the
basemapand map area withStyle centerandX center, andY zoomorradius. - Geometry: Define point location with
xandycoordinates and thesymbol.Style - Image: Specify the image
height,width,format, andattributionstyle. - Request: Send a
GETrequest to the/with-pointendpoint to generate the static map.
Service URL
https://static-maps-api.arcgis.com/arcgis/rest/services/static-maps-service/v1/static-mapsPath parameters
These are required parameters to specify the style to access.
https://static-maps-api.arcgis.com/arcgis/rest/services/static-maps-service/{version}/static-maps/{basemapStyle}/with-point| Name | Description | Example |
|---|---|---|
{version} | Required: The API version. | v1 |
{basemap | Required: The basemap style for the static map. | arcgis/navigation, arcgis/navigation-night, arcgis/imagery, arcgis/streets-night, or arcgis/streets |
Query parameters
| Name | Type | Required | Default value | Description |
|---|---|---|---|---|
token | string | | An access token with the static maps service privilege. To pass the token as an authorization header, see HTTP authorization headers. | |
x | number(double) | | X-coordinate of a point in WGS84 decimal degrees. Values range from | |
y | number(double) | | Y-coordinate of a point in WGS84 decimal degrees. Values range from | |
format | ImageFormat | webp | Output image format of the map. Supported formats include | |
height | ImageDimensionHeight | 400 | Height of the map image in pixels. Values must be between | |
width | ImageDimensionWidth | 400 | Width of the map image in pixels. Values must be between | |
padding | ImagePadding | 10 | Padding percentages around the map extent. Accepts an array of 1–4 values; default is | |
symbolColor | HexColor | 007 | Point symbol color in hexadecimal format with an optional alpha value. | |
symbolScale | SymbolScale | 1 | Scale factor applied to the point symbol size. Values range from | |
symbolStyle | SymbolStyle | pin | Style applied to the point symbol. Supported values include | |
symbolLabel | SymbolLabel | | Label displayed on the point symbol. Accepts 1–2 alphanumeric characters ( | |
centerX | number(double) | | X-coordinate of the map center in WGS84 decimal degrees. Values range from | |
centerY | number(double) | | Y-coordinate of the map center in WGS84 decimal degrees. Values range from | |
zoom | ZoomLevel | | A number that defines the level of detail of the map. Values range from | |
radius | RadiusDistance | | A number (in meters) that defines the minimum geographic area around a center point of the map. If no center point is supplied, the radius is applied to the geometry. Values range from | |
attribution | string | auto | Attribution footer style. To learn more about attribution requirements for static maps, see Esri and data attribution. | |
referenceDetails | string | all | A basemap option that controls the visibility of labels and feature symbology. This parameter is currently supported only for the |
Code examples
Display a point with a default symbol
Use the Static Maps service to generate a static map with the location of the Esri headquarters in Redlands, California. The map uses the ArcGIS Navigation basemap style and has the default blue pin symbol at the center.
Steps
- Reference the service.
- Set the API key in the
Authorizationrequest header using theBearerauthentication scheme. - Define the coordinate, symbol style, and other parameters for the request.
- Send the request to the Static Maps service to generate the static map.
const basemapStyle = "arcgis/navigation";
const accessToken = "YOUR_ACCESS_TOKEN";
const lat = 34.0567;
const lon = -117.1956;
const width = 350;
const height = 500;
fetch(
`https://static-maps-api.arcgis.com/arcgis/rest/services/static-maps-service/v1/static-maps/${basemapStyle}/with-point?x=${lon}&y=${lat}&symbolStyle=pin&symbolColor=007AC2&zoom=11&width=${width}&height=${height}`,
{
headers: {
Authorization: `Bearer ${accessToken}`,
},
}
)
.then((response) => response.blob())
.then((blob) => {
document.getElementById("staticMap").src = URL.createObjectURL(blob);
});
REST API
curl -X GET 'https://static-maps-api.arcgis.com/arcgis/rest/services/static-maps-service/v1/static-maps/arcgis/navigation/with-point?x=-117.1956&y=34.0567&symbolStyle=pin&symbolColor=007AC2&zoom=11&width=350&height=500&token=<ACCESS_TOKEN>'Display a map without a point
Use the Static Maps service to generate a static map centered in Yuma City, California using the ArcGIS Imagery basemap style. The map will not display a point symbol at the center.
Steps
- Reference the service.
- Set the API key in the
Authorizationrequest header using theBearerauthentication scheme. - Define the coordinate and set
symbolparameter toStyle noneto display the map without a point. - Send the request to the Static Maps service to generate the static map.
fetch(
`https://static-maps-api.arcgis.com/arcgis/rest/services/static-maps-service/v1/static-maps/${basemapStyle}/with-point?x=${x}&y=${y}&format=jpeg&height=400&width=600&symbolStyle=none&zoom=14`,
{
headers: {
Authorization: `Bearer ${accessToken}`,
},
}
)
.then((response) => response.blob())
.then((blob) => {
document.getElementById("map").src = URL.createObjectURL(blob);
});
REST API
curl -X GET 'https://static-maps-api.arcgis.com/arcgis/rest/services/static-maps-service/v1/static-maps/arcgis/imagery/with-point?format=jpeg&height=400&width=600&symbolStyle=none&zoom=14&x=-121.67579933611826&y=39.17655859425453&token=<ACCESS_TOKEN>'Display a geocoded point
Use the Static Maps service together with the Geocoding service to display a location from a geocoding result. First, create a search box with autosuggest to help users select an address. Then, geocode the selected address to obtain its coordinates, and pass those coordinates to the Static Maps service to generate a static map centered on the location.
Steps
- Reference the Static Maps service and the Geocoding service endpoints.
- Set the API key in the
Authorizationrequest header using theBearerauthentication scheme. Your API key needs both the Geocoding and Static Maps services privileges. - Use user input to call
/suggestand display address suggestions. - Get the coordinates of the selected location with
/find.Address Candidates - Pass the coordinates to the Static Maps service to generate the static map centered at the location.
async function showStaticMap(lon, lat) {
const width = Math.max(64, Math.min(mapDiv.clientWidth, 1024));
const height = Math.max(64, Math.min(mapDiv.clientHeight, 1024));
const symbolColor = "007AC2";
const response = await fetch(
`https://static-maps-api.arcgis.com/arcgis/rest/services/static-maps-service/v1/static-maps/${basemapStyle}/with-point?x=${lon}&y=${lat}&symbolStyle=pin&symbolColor=${symbolColor}&radius=2500&width=${width}&height=${height}`,
{
headers: {
Authorization: `Bearer ${accessToken}`,
},
}
);
const blob = await response.blob();
const img = document.createElement("img");
img.src = URL.createObjectURL(blob);
img.alt = "Static map showing selected location";
img.onload = () => {
mapContainer.style.width = width + "px";
mapContainer.style.height = height + "px";
};
mapDiv.innerHTML = "";
mapDiv.appendChild(img);
}
REST API
curl -X GET "https://static-maps-api.arcgis.com/arcgis/rest/services/static-maps-service/v1/static-maps/arcgis/navigation/with-point?x=-105.121300465018&y=39.970184671679&symbolStyle=pin&symbolColor=007AC2&radius=2500&width=800&height=300&token=<ACCESS_TOKEN>"Tutorials
