OptionalcategoryCustom icons for specific place categories, which places in those categories use instead of the default style.
A place takes the entry for its own category. Otherwise, it takes the first entry for the map
category its category falls in, as the map's own POIs do. For example, RESTAURANT reaches an
ITALIAN_RESTAURANT, and CAFE a CAFE_PUB. That second match takes only entries with an
image, so the same list given to POIsModuleConfig.icon restyles both alike.
OptionaldefaultConfiguration for the default place icon.
OptionalmappingA custom mapping that picks the icon of each place.
fn receives places of the shape the module was created for, so your own properties
are typed. A poiCategory resolves through the marker type, as a place's own
category does.
// Direct image ID mapping
mapping: {
to: 'imageID',
fn: (place) => place.properties.poi?.name?.includes('urgent') ? 'urgent-icon' : 'default-icon'
}
// POI category mapping, from a property of your own
type Venue = CommonPlaceProps & { venueCategory?: MapStylePOICategory };
await PlacesModule.create<Venue>(map, {
icon: { mapping: { to: 'poiCategory', fn: (place) => place.properties.venueCategory ?? 'RESTAURANT' } },
});
The icons of place markers, including custom icons.
Example