Map Marker Icon API generates custom PNG icons for maps

Marker Icon API: Custom Map Markers as PNG

Generate markers as PNG from a URL for Leaflet, MapLibre, Google Maps and OpenLayers

Map Marker Icon API lets you create fully customizable map marker icons using simple URL parameters. Generate PNG marker images with custom colors, sizes, text or icon content, and more — no design skills needed.

Use the generated icons in Leaflet, MapLibre GL, Google Maps, OpenLayers, or embed them into static images with the Static Maps API. Whether you're building a POI map, store locator, or delivery dashboard, the API helps you create clean, branded visuals.

Choose icons from Material, Material Symbols, Font Awesome, Lucide, Tabler, Phosphor or Material Design Icons, pick one of 9 shapes, and add outlines and shadows. Every response tells you the marker's size and anchor point. Use icons via URL or download them — attribution is required on the free plan.

Features and Capabilities

Customizable Marker Styles

The Map Marker Icon API lets you choose from multiple marker styles to match your map’s purpose and design. Available styles include:

  • Material Design (type=material, default) — a clean, modern pin-style icon
  • Font Awesome (type=awesome) — shaped like the classic map marker
  • Circle (type=circle) — simple, round map marker icons ideal for category or status indicators
  • Plain (type=plain) — displays icon or text without any background shape
  • Library pins (type=tabler, phosphor, lucide, material-symbols, material-symbols-rounded) — the map-pin shape of that icon library, so the pin matches the icons inside it
Map marker icon types: Material pin, Font Awesome pin, circle and plain marker

You can fully customize each marker with background color (color), content color (contentColor), outline (strokeColor, strokeWidth), and shadow (shadowType, shadowColor). This flexibility helps you create consistent, branded map marker PNGs for any use case.

Outlines and Shadow Styles

Two parameters change how a marker stands out from the map:

  • strokeWidth adds an opaque outline from 0 to 10 CSS pixels, at most size / 6. The outline is drawn outside the shape, and the shape shrinks so the marker keeps its size. Set its color with strokeColor. Without strokeWidth, the marker gets a thin semi-transparent outline.
  • shadowType selects the shadow: ellipse (the default ground shadow), ellipse-dark, ellipse-soft, floating (a detached shadow that makes the marker look lifted), drop (a blurred shadow under the whole shape), or glow (a blurred halo). shadowColor sets its color, and noShadow removes it. Circle markers have no shadow unless you set shadowType.
Marker Icon API coffee markers: the nine marker types in the top row, and a Tabler pin with each shadow style in the bottom row, every pin anchor on the same dashed line

Example (Phosphor pin with a green glow):

https://api.geoapify.com/v2/icon/?type=phosphor&icon=tree&color=%232e7d32&shadowType=glow&shadowColor=%232e7d32&size=64&contentSize=26&scaleFactor=2&apiKey=YOUR_API_KEY

The shadow is part of the PNG, so it changes the image size and the position of the pin tip. The size and anchor headers tell you both.

Icon or Text Content

Use either an icon or text as the marker’s inner content:

When you omit iconType, the library follows the shape: material for material, circle and plain markers, awesome for awesome markers, and the library of the same name for the library pins. You can also mix them, for example a Font Awesome pin with a Material Design Icons bicycle: type=awesome&iconType=mdi&icon=bicycle.

Icon or text content for map markers

You can also control the inner content size (contentSize) and color (contentColor) independently from the background.

Custom Icon Size and Content Size

You can control the overall size of the map marker icon using the size parameter, which sets the height of the marker shape in pixels, without the shadow. Additionally, the contentSize parameter lets you independently adjust the size of the icon or text displayed inside the marker. The default contentSize doesn't grow with size, so set both for larger markers.

This gives you full control over the proportions of the marker — whether you want a compact icon for dense maps or a large, eye-catching marker for key locations.

Different map icon sizes

Example:

  • size=64 makes the marker shape 64 pixels high (the shadow adds a few pixels to the image)
  • contentSize=32 makes the inner icon 32 pixels tall

This flexibility allows you to match different zoom levels, styles, and device resolutions with precision.

Dynamic URL-Based Generation

No build process or image editor needed — just construct a URL with the desired parameters. The API returns a ready-to-use marker PNG. You can use icons dynamically in your app or save them locally for reuse.

Example URL:

https://api.geoapify.com/v2/icon/?type=material&color=%23ffd150&size=80&icon=landmark&iconType=awesome&contentSize=28&contentColor=%234f4f4f&apiKey=YOUR_API_KEY

Retina-Ready PNG Output

The Map Marker Icon API generates high-quality PNG images, optimized for both standard and high-resolution (retina) displays. To create retina-ready icons, simply add the scaleFactor=2 parameter to your API request.

This ensures that your map marker PNGs look sharp and crisp on all screens — whether they’re used in a web app, mobile app, or desktop interface.

Example (2× retina icon):


https://api.geoapify.com/v2/icon/?type=awesome&color=%23ff5050&size=80&icon=paw&contentSize=35&contentColor=%23294685&scaleFactor=2&apiKey=YOUR_API_KEY

You can use these icons directly via URL or download and embed them into your application — ideal for modern, pixel-perfect maps.

Works with All Major Map Libraries

The Map Marker Icon API is compatible with all popular JavaScript mapping libraries. You can use the generated map marker PNGs directly as custom icons:

  • Leaflet – Use L.icon() and L.marker() to display custom icons.
  • MapLibre GL – Create an HTML element and use it with new maplibregl.Marker().
  • Google Maps – Pass an <img> with the PNG as the content of an AdvancedMarkerElement.
  • OpenLayers – Use ol.style.Icon for adding custom image markers to vector layers.

Every response returns the marker's display size and anchor point, so you place each map marker icon exactly, without measuring the image.

Size and Anchor in Response Headers

The PNG includes the marker's shadow, so the pin tip is not at the bottom edge of the image, and the image grows with shadows such as drop or glow. Instead of guessing, read these response headers:

HeaderMeaning
Icon-Width, Icon-HeightDisplay size in CSS pixels, including the shadow (the PNG size divided by scaleFactor)
Icon-Anchor-X, Icon-Anchor-YThe point that touches the map location, measured from the top-left corner: the pin tip for pins, the center for circles without a shadow
Icon-Marker-StyleThe same marker as Static Maps API marker options, so you can draw it on a static map too

A HEAD request with the same parameters returns only the headers, without the image:

curl -I "https://api.geoapify.com/v2/icon/?type=awesome&size=60&scaleFactor=2&apiKey=YOUR_API_KEY"

For this marker the headers return Icon-Width: 46, Icon-Height: 67, Icon-Anchor-X: 23, and Icon-Anchor-Y: 60.52: display the PNG at 46 × 67 px and put the point 23 px from the left and 60.52 px from the top on the location. The values depend on the shape parameters (type, size, strokeWidth, shadowType, scaleFactor), not on the icon or color, so one request per marker style is enough. The headers are exposed through CORS, so browser code can read them with fetch().

See Shadows and map placement in the documentation for the sizes of every shape and shadow style.

Free to Use with Attribution

You can use the Map Marker Icon API for free under the Geoapify Free Plan — all you need to do is include proper attribution. The generated map marker PNGs can be used directly via URL or downloaded and included in your projects without any additional restrictions from Geoapify.

The icons are based on open-source libraries and come with the following attribution requirements:

  • Geoapify Attribution: If you're on the Free Plan (3,000 credits per day; 1 icon request = 1 credit), you must display The map marker icons are generated with Geoapify. Paid plans with the White Label option remove this requirement.

  • Font Awesome Attribution
    If you use Font Awesome icons (iconType=awesome) or the Font Awesome pin shape (type=awesome, based on the Font Awesome location-dot icon), attribution to Font Awesome is required: Font Awesome Free icons are licensed under CC BY 4.0, the fonts under the SIL OFL 1.1. See the Font Awesome Free license.

  • Material Design Attribution
    Material icons are licensed under the Apache License 2.0 and do not require attribution.

  • Material Symbols Attribution: Material Symbols (iconType=material-symbols, material-symbols-rounded, and the pins of the same names) are licensed under the Apache License 2.0 and do not require attribution.

  • Lucide, Tabler, Phosphor and Material Design Icons: Lucide (ISC), Tabler Icons (MIT), Phosphor Icons (MIT) and Material Design Icons (Pictogrammers Free License) don't require visible attribution on your map. If you redistribute the icon files, keep the library's license notice.

This means you can generate icons dynamically or download and bundle them with your app — even on the free plan — as long as the attribution terms are followed.

You can find the full list of available features, customization options, and parameter details in the Map Marker Icon API documentation →

Consistent Marker Icon Sets

A map with several place categories reads best when every marker has the same shape and size, and only the symbol and color change. With the Marker Icon API, that's one URL template: keep type, size, contentSize and scaleFactor fixed, and set icon and color per category.

Five PNG map markers from one URL template: cafe, museum, park, pharmacy and hotel

All five markers above come from this template, with size=60 and scaleFactor=2:

https://api.geoapify.com/v2/icon/?type=awesome&color={color}&size=60&icon={icon}&contentSize=24&contentColor=%23ffffff&noWhiteCircle&scaleFactor=2&apiKey=YOUR_API_KEY
Categoryiconcolor
Cafemug-saucer%23c0732e
Museumlandmark%237b5cd6
Parktree%2339a845
Pharmacyprescription-bottle-medical%23e04f5f
Hotelbed%232f7bd9

Because every marker in the set has the same size (46 × 67 px, displayed at 2× resolution), one anchor setting works for all of them in your map library. You can request the set once, store the markers PNG files with your app and serve them yourself: stored icons have no usage limits from Geoapify.

For a full walkthrough with Places API data, Leaflet and MapLibre GL, see the how-to Build a Consistent Marker Icon Set for Place Categories.

Code Examples: Using Marker PNGs in Map Libraries

Pin markers have a ground shadow by default, and the shadow is part of the PNG. Its size depends on the shape, the size and the shadowType, so the pin tip sits a few pixels above the bottom edge of the image. Take the display size and the anchor from the Icon-* response headers and pass them to your map library:

  • In Leaflet, set iconSize to [Icon-Width, Icon-Height] and iconAnchor to [Icon-Anchor-X, Icon-Anchor-Y].
  • In MapLibre GL or Mapbox GL, size the marker element to Icon-Width × Icon-Height and use anchor: "top-left" with offset: [-Icon-Anchor-X, -Icon-Anchor-Y].
  • In Google Maps, set anchorLeft and anchorTop on the AdvancedMarkerElement so the pin tip, not the image corner, sits on the coordinate.
  • In OpenLayers, set anchor in ol.style.Icon (in image pixels, or as fractions of the image size).

You can preview your marker icons in the Marker Icon Playground, which also shows the image dimensions and the shadow offset.

For step-by-step walkthroughs, see the how-tos Add Custom Marker Icons to Leaflet, MapLibre GL, and OpenLayers Maps and Add Markers to a Map. Ready-to-run examples that read the headers with a HEAD request and switch shapes and shadow styles are available for Leaflet, MapLibre GL, and OpenLayers.

If you prefer a flat icon with no shadow, add the noShadow parameter to your API request. A pin without a shadow is exactly size pixels high, and its anchor is at the bottom center:

https://api.geoapify.com/v2/icon/?type=awesome&color=%23ff50bb&size=40&icon=tree&contentSize=18&contentColor=%2334811a&noShadow&noWhiteCircle&scaleFactor=2&apiKey=YOUR_API_KEY

Now let’s look at examples for using map marker PNGs in each of the most popular mapping libraries.

Leaflet Custom Marker

To use a custom map marker in Leaflet, generate the icon with the Geoapify Marker Icon API and assign it using L.icon(). Leaflet allows you to control how the icon is positioned on the map with iconAnchor and how popups are displayed with popupAnchor.

In this example:

  • size=60 in the URL defines the marker height without shadow.
  • For this URL, the response headers return Icon-Width: 46, Icon-Height: 67, Icon-Anchor-X: 23, and Icon-Anchor-Y: 60.52.
  • iconSize: [46, 67] matches the display size (width × height).
  • iconAnchor: [23, 60.5] places the tip of the pin, above the shadow, on the coordinate.
  • popupAnchor: [0, -62] makes the popup open just above the top of the icon.

The marker uses a Font Awesome "paw" icon, custom background and icon colors, and is retina-ready via scaleFactor=2.

const markerIcon = L.icon({
  iconUrl: `https://api.geoapify.com/v2/icon/?type=awesome&color=%23ffc3e8&size=60&icon=paw&contentSize=29&contentColor=%2334811a&noWhiteCircle&scaleFactor=2&apiKey=${myAPIKey}`,
  iconSize: [46, 67],
  iconAnchor: [23, 60.5], // Icon-Anchor-X, Icon-Anchor-Y
  popupAnchor: [0, -62]
});

const zooMarkerPopup = L.popup().setContent("This is Munich Zoo");

const zooMarker = L.marker([48.096980, 11.555466], {
  icon: markerIcon
}).addTo(map).bindPopup(zooMarkerPopup);

Try this example live on JSFiddle →

MapLibre GL Custom Marker

This example demonstrates how to add a custom marker generated by the Geoapify Marker Icon API using a DOM element. The icon includes a shadow, and the popup is positioned above the visible part of the marker.

In this case:

  • size=60 in the URL defines the height of the icon (excluding shadow).
  • For this URL, the headers return a 46 × 67 px marker with the anchor at 23, 60.52; the shadow takes the bottom part of the image.
  • iconWidth and iconHeightWithShadow are Icon-Width and Icon-Height, and anchorY is Icon-Anchor-Y.
  • With anchor: 'bottom', the marker is moved down by the space below the pin tip (Icon-Height - Icon-Anchor-Y, about 6.5px here) so the tip sits on the coordinate. For other styles, use anchor: 'top-left' with offset: [-Icon-Anchor-X, -Icon-Anchor-Y].
  • The popup is offset to appear just above the actual icon (ignoring the shadow area).
const markerIconSize = {
  iconWidth: 46,
  iconHeight: 60,
  iconHeightWithShadow: 67,
  anchorY: 60.5, // Icon-Anchor-Y
}

const el = document.createElement('div');
el.className = 'marker';
el.style.backgroundImage = `url(https://api.geoapify.com/v2/icon/?type=awesome&color=%23c3e2ff&size=60&icon=monument&contentSize=25&contentColor=%232b2b2b&noWhiteCircle&scaleFactor=2&apiKey=${myAPIKey})`;
el.style.backgroundSize = 'contain';
el.style.backgroundRepeat = 'no-repeat';
el.style.width = `${markerIconSize.iconWidth}px`;
el.style.height = `${markerIconSize.iconHeightWithShadow}px`;

new maplibregl.Marker({
  element: el,
  anchor: 'bottom',
  offset: [0, markerIconSize.iconHeightWithShadow - markerIconSize.anchorY]
})
  .setLngLat(pinCoords)
  .setPopup(
    new maplibregl.Popup({
      offset: { bottom: [0, -markerIconSize.iconHeight] }
    }).setHTML("Statue of Liberty")
  )
  .addTo(map);

Try this example live on JSFiddle →

Google Maps Custom Marker (AdvancedMarkerElement)

This example shows how to use a Geoapify Marker Icon with the newer AdvancedMarkerElement from the Google Maps JavaScript API. We use a retina PNG marker, align it to the map coordinate, and show a popup on click.

  • The marker icon has a defined size of 60px in the URL; the headers return a 46 × 67 px image with the anchor at 23, 60.52.
  • We set anchorTop: "-60px" (about -Icon-Anchor-Y) so the pin tip, rather than the shadow below it, aligns with the map coordinate.
  • The popup (InfoWindow) is offset by -60px to appear above the visible icon.
const { Map } = await google.maps.importLibrary("maps");
const { AdvancedMarkerElement } = await google.maps.importLibrary("marker");

const myAPIKey = "YOUR_API_KEY";

const map = new Map(document.getElementById("map"), {
    zoom: 10,
    center: { lat: 51.5073371, lng: -0.1276495 }, // London
    mapId: "DEMO_MAP_ID", // use your own map ID in production
});

const customMarkerIcon = document.createElement("img");
customMarkerIcon.src = `https://api.geoapify.com/v2/icon/?type=awesome&color=%23c3e2ff&size=60&icon=monument&contentSize=25&contentColor=%232b2b2b&noWhiteCircle&scaleFactor=2&apiKey=${myAPIKey}`;
customMarkerIcon.style.width = "46px";
customMarkerIcon.style.height = "67px";

const customMarker = new AdvancedMarkerElement({
    map,
    position: { lat: 51.5073371, lng: -0.1276495 },
    content: customMarkerIcon,
    anchorTop: "-60px",
    title: "A marker using a custom PNG image",
});

const infoWindow = new google.maps.InfoWindow({
    content: "City of London",
    pixelOffset: new google.maps.Size(0, -60), // move popup above icon
});

customMarkerIcon.addEventListener("click", () => {
    infoWindow.open({
    anchor: customMarker,
    map,
    });
});

This approach ensures the marker aligns precisely and remains visually crisp on retina displays.

OpenLayers Custom Marker

This example shows how to add a custom map marker PNG to OpenLayers using the Geoapify Marker Icon API, and position a popup above it.

  • The marker icon size is set to 60 in the API URL.
  • For this URL, the headers return a 46 × 67 px marker with Icon-Anchor-Y: 60.52.
  • The anchor aligns the pin tip, above the shadow, as fractions of the image size: anchor: [0.5, 60.5 / 67]
  • The popup is positioned 8px above the icon top: offset: [0, -(60 + 8)]
const markerCoords = ol.proj.fromLonLat([2.2945, 48.85825]); // Eiffel Tower

const marker = new ol.Feature({
    geometry: new ol.geom.Point(markerCoords),
    name: 'Eiffel Tower',
});

marker.setStyle(new ol.style.Style({
    image: new ol.style.Icon({
    src: `https://api.geoapify.com/v2/icon/?type=awesome&color=%23fcd3b2&size=60&icon=monument&contentSize=25&contentColor=%232b2b2b&noWhiteCircle&scaleFactor=2&apiKey=${myAPIKey}`,
    width: 46,
    height: 67, // PNG image size: width × height
    anchor: [0.5, 60.5 / 67],  // Icon-Anchor-Y / Icon-Height
    anchorXUnits: 'fraction',
    anchorYUnits: 'fraction'
    })
}));

const vectorLayer = new ol.layer.Vector({
    source: new ol.source.Vector({
    features: [marker],
    }),
});

map.addLayer(vectorLayer);

    
// Create popup element
const popupElement = document.createElement('div');
popupElement.className = 'ol-popup';
popupElement.innerHTML = 'Eiffel Tower';
document.body.appendChild(popupElement);

const overlay = new ol.Overlay({
    element: popupElement,
    positioning: 'bottom-center',
    stopEvent: false,
    offset: [0, -(60 + 8 /* tooltip size */ )], // move above the marker
});

map.addOverlay(overlay);

// Show popup on click
map.on('click', function (event) {
    map.forEachFeatureAtPixel(event.pixel, function (feature) {
    if (feature === marker) {
        overlay.setPosition(markerCoords);
    }
    });
});

Try it on JSFiddle →

Guides

These guides show how to use marker PNGs from the Marker Icon API on interactive maps, with ready-to-run examples.

01

Put markers on a map

Add marker PNGs to Leaflet, MapLibre GL and OpenLayers maps.

Pricing and Licensing

The Map Marker Icon API is built on top of open-source icon libraries — Material Icons and Material Symbols, Font Awesome, Lucide, Tabler, Phosphor, and Material Design Icons — and we follow the same spirit of openness.

You can use the API in two ways:

  • Dynamic Use with API Key (Cloud Access)

    • Use icon URLs dynamically by including your Geoapify API key.
    • The Free plan includes 3,000 credits per day; each icon request costs 1 credit.
    • View pricing and upgrade options →
  • Generate Once, Host Yourself

    • You may generate marker icons using the API and store them locally in your app or website — with no usage limits from Geoapify.

Attribution Requirements

If you use the API on the Free plan, you must include the following attribution:

"The map marker icons are generated with Geoapify"

Additionally, when you use icons from third-party libraries:

See the attribution requirements in the documentation for details.

FAQ

What is the Map Marker Icon API?

The Map Marker Icon API allows you to generate custom map marker icons as PNG images using URL parameters. You can choose styles, colors, icons, and sizes — making it easy to create branded and retina-ready markers for web maps. All parameters are described in the Marker Icon API documentation.

What formats does the API support?

The API outputs high-resolution PNG images, optimized for both standard and retina displays. These markers can be used directly in web mapping libraries like Leaflet, MapLibre GL, Google Maps, Mapbox GL JS, and OpenLayers.

Do I need to attribute Geoapify when using the API?

If you're using the Free plan, yes — attribution to Geoapify is required. A suggested attribution is: "Map marker icons are generated with Geoapify." Paid plans with white-label support do not require attribution.

Are there any usage limits?

The Free plan includes 3,000 credits per day, and each icon request costs 1 credit. If you generate icons and host them yourself, there are no usage limits from Geoapify. You can find more details on the pricing page.

Can I use the icons offline or host them myself?

Yes. You can generate PNG icons using the API and store them locally for use in offline maps or static content. There are no restrictions from Geoapify on redistributing the rendered PNGs.

Are there any licensing requirements for the icon libraries?

Yes for Font Awesome: Font Awesome Free icons are licensed under CC BY 4.0 (the fonts under the SIL Open Font License 1.1), so markers with Font Awesome icons or the Font Awesome pin shape (type=awesome) need attribution to Font Awesome. Material Icons and Material Symbols (Apache License 2.0), Lucide (ISC), Tabler Icons (MIT), Phosphor Icons (MIT) and Material Design Icons (Pictogrammers Free License) don't require visible attribution; keep the license notice if you redistribute icon files. See the attribution requirements.

How do I get sharp markers on retina screens?

Add scaleFactor=2 to the icon URL. The API returns the PNG at twice the pixel size, and you display it at the normal size (for example, a size=60 marker is 92 × 134 px, shown as 46 × 67 px). scaleFactor accepts values from 0.5 to 10.

How do I use a marker PNG as a custom Leaflet icon?

Pass the icon URL to L.icon() as iconUrl, set iconSize to [Icon-Width, Icon-Height] and iconAnchor to [Icon-Anchor-X, Icon-Anchor-Y] from the response headers, then use it in L.marker(). See the Leaflet example above or the Add Custom Marker Icons guide.

Which icon libraries can I use in map markers?

Set iconType to material, material-symbols, material-symbols-rounded, awesome (Font Awesome 6 Free), lucide, tabler, phosphor or mdi (Material Design Icons), and icon to an icon name from that library. Pin shapes and icon libraries can be mixed, for example type=awesome&iconType=mdi&icon=bicycle. See the API reference for the icon catalogs.

How do I find a marker's size and anchor point?

Read the Icon-Width, Icon-Height, Icon-Anchor-X and Icon-Anchor-Y response headers. They give the display size in CSS pixels, including the shadow, and the point that touches the map location. A HEAD request with the same parameters returns only the headers. See Shadows and map placement.