StylesOptions Object

Note

Bing Maps Web Control SDK retirement

Bing Maps Web Control SDK is deprecated and will be retired. Free (Basic) account customers can continue to use Bing Maps Web Control SDK until June 30th, 2025. Enterprise account customers can continue to use Bing Maps Web Control SDK until June 30th, 2028. To avoid service disruptions, all implementations using Bing Maps Web Control SDK will need to be updated to use Azure Maps Web SDK by the retirement date that applies to your Bing Maps for Enterprise account type. For detailed migration guidance, see Migrate from Bing Maps Web Control SDK and Migrate Bing Maps Enterprise applications to Azure Maps with GitHub Copilot.

Azure Maps is Microsoft's next-generation maps and geospatial services for developers. Azure Maps has many of the same features as Bing Maps for Enterprise, and more. To get started with Azure Maps, create a free Azure subscription and an Azure Maps account. For more information about azure Maps, see Azure Maps Documentation. For migration guidance, see Bing Maps Migration Overview.

Setting the options for an individual shape is easy to do. However, sometimes you need to load a collection of shapes from a module. To set the style for these, one option would be to loop through each shape and set the style for that shape individually. This means writing extra code and looping through all of the entities in your high-volume data. To make it easier to set the default styles for loaded entities, many of the modules allow you to pass in an StylesOptions object. Some of the modules that support this include GeoJSON, Well Known Text, and the Spatial Data Services modules.

Properties

This IStylesOptions object has the following properties.

Name Type Description
pushpinOptions PushpinOptions Sets the options for all pushpins.
polylineOptions PolylineOptions Sets the options for all polylines.
polygonOptions PolygonOptions Sets the options for all polygons.

Example

var style = {
    pushpinOptions: {
        color: 'pink'
    },
    polylineOptions: {
        strokeColor: 'green'
    },
    polygonOptions: {
        fillColor: 'red',
        strokeColor: 'blue'
    }
};