Sending requests with SLD_BODY - Precisely Data Integrity Suite

Data Integrity Suite APIs

Product
Data_Integrity
Spatial_Analytics
Data_Enrichment
geo_addressing_1
Services
Spatial Analytics
Data Enrichment
Geo Addressing
ft:title
Data Integrity Suite APIs
ft:locale
en-US
PublicationType
pt_developer
copyrightfirst
2023
copyrightlast
2026

Encoding JSON Strings

When passing JSON in the SLD_BODY parameter, it must be URL-encoded.

For Windows, you can use PowerShell to encode a JSON string:

powershell -Command "[uri]::EscapeDataString('{\"name\":\"Alice\",\"age\":30}')"

This will output a URL-encoded version of the JSON, which you can paste into the SLD_BODY parameter in your GetMap request.

Alternatively, if you are using a JavaScript application to consume the WMS below is a code snippet that can be used to encode the JSON within the application itself.
// Add SLD_BODY here
const SLD_BODY = JSON.stringify({
  styleDetails: [
    {
      themeList: {
        theme: [
          {
            type: "OverrideTheme",
            style: {
              type: "MapBasicCompositeStyle",
              PointStyle: {
                type: "MapBasicPointStyle",
                MapBasicSymbol: {
                  type: "MapBasicFontSymbol",
                  shape: 36,
                  size: 12,
                  color: "255",
                  fontName: "MapInfo Symbols",
                  rotation: 0,
                  bold: false,
                  dropShadow: false,
                  border: "NONE"
                }
              }
            }
          }
        ]
      }
    }
  ]
});

// Build the POST body
const body = `SLD_BODY=${encodeURIComponent(SLD_BODY)}`;

Get Request for one layer

GET URL Format with SLD_BODY

https://api.cloud.precisely.com/v1/Spatial/WMS?VERSION={version}&SERVICE=WMS&REQUEST=GetMap&{SRS or CRS}={namespace}:{identifier}&BBOX={min_x},{min_y},{max_x},{max_y}&WIDTH={output_width}&HEIGHT={output_height}&Layers={layer1},...,{layerX}&STYLES={style1},...,{styleX}&FORMAT={output_format}&TRANSPARENT={TRUE or FALSE}&BGCOLOR={color_value}&RESOLUTION={resolution}&EXCEPTIONS={exception_format}&SLD_BODY={style_description}    

Example request

https://api.cloud.precisely.com/v1/spatial/wms?SERVICE=WMS&VERSION=1.3.0&REQUEST=GetMap&BBOX=37.78662956646336823%2C-122.2745967175037549%2C37.81410536165775227%2C-122.2403683391127061&CRS=EPSG%3A4326&WIDTH=1062&HEIGHT=853&LAYERS=buildings&STYLES=&FORMAT=image%2Fpng&DPI=96&MAP_RESOLUTION=96&FORMAT_OPTIONS=dpi%3A96&TRANSPARENT=TRUE&SLD_BODY=%7B%22styleDetails%22%3A%20%5B%7B%22themeList%22%3A%20%7B%22theme%22%3A%20%5B%7B%22type%22%3A%20%22OverrideTheme%22%2C%22style%22%3A%20%7B%22type%22%3A%20%22MapBasicCompositeStyle%22%2C%22AreaStyle%22%3A%20%7B%22type%22%3A%20%22MapBasicAreaStyle%22%2C%22MapBasicPen%22%3A%20%7B%22width%22%3A%201%2C%22pattern%22%3A%202%2C%22color%22%3A%20%22%23964B00%22%2C%22unit%22%3A%20%22PIXEL%22%7D%2C%22MapBasicBrush%22%3A%20%7B%22pattern%22%3A%202%2C%22foregroundColor%22%3A%20%22%23E0AB8B%22%2C%22backgroundColor%22%3A%20%22%23C0C0C0%22%7D%7D%7D%7D%5D%7D%7D%5D%7D

Post Request for one layer

The following format is used for HTTP POST requests:

HTTP POST:
https://api.cloud.precisely.com/v1/Spatial/WMS?VERSION={version}&SERVICE=WMS&REQUEST=GetMap&{SRS or CRS}={namespace}:{identifier}&BBOX={min_x},{min_y},{max_x},{max_y}&WIDTH={output_width}&HEIGHT={output_height}&Layers={layer1},...,{layerX}&STYLES={style1},...,{styleX}&FORMAT={output_format}&TRANSPARENT={TRUE or FALSE}&BGCOLOR={color_value}&RESOLUTION={resolution}&EXCEPTIONS={exception_format}POST BODY (sent with header Content-Type: application/x-www-form-urlencoded)SLD_BODY={style_description}

Example request

POST

https://api.cloud.precisely.com/v1/spatial/wms?SERVICE=WMS&VERSION=1.3.0&REQUEST=GetMap&BBOX=37.78662956646336823%2C-122.2745967175037549%2C37.81410536165775227%2C-122.2403683391127061&CRS=EPSG%3A4326&WIDTH=1062&HEIGHT=853&LAYERS=buildings&STYLES=&FORMAT=image%2Fpng&DPI=96&MAP_RESOLUTION=96&FORMAT_OPTIONS=dpi%3A96&TRANSPARENT=TRUE     

HEADER

Content-Type: application/x-www-form-urlencoded

BODY

SLD_BODY=%7B%22styleDetails%22%3A%20%5B%7B%22themeList%22%3A%20%7B%22theme%22%3A%20%5B%7B%22type%22%3A%20%22OverrideTheme%22%2C%22style%22%3A%20%7B%22type%22%3A%20%22MapBasicCompositeStyle%22%2C%22AreaStyle%22%3A%20%7B%22type%22%3A%20%22MapBasicAreaStyle%22%2C%22MapBasicPen%22%3A%20%7B%22width%22%3A%201%2C%22pattern%22%3A%202%2C%22color%22%3A%20%22%23964B00%22%2C%22unit%22%3A%20%22PIXEL%22%7D%2C%22MapBasicBrush%22%3A%20%7B%22pattern%22%3A%202%2C%22foregroundColor%22%3A%20%22%23E0AB8B%22%2C%22backgroundColor%22%3A%20%22%23C0C0C0%22%7D%7D%7D%7D%5D%7D%7D%5D%7D

The style used in the above requests, when decoded, is as follows and defines a solid brown fill with darker brown outline for the layer buildings.

{
  "styleDetails": [
    {
      "themeList": {
        "theme": [
          {
            "type": "OverrideTheme",
            "style": {
              "type": "MapBasicCompositeStyle",
              "AreaStyle": {
                "type": "MapBasicAreaStyle",
                "MapBasicPen": {
                  "width": 1,
                  "pattern": 2,
                  "color": "#964B00",
                  "unit": "PIXEL"
                },
                "MapBasicBrush": {
                  "pattern": 2,
                  "foregroundColor": "#E0AB8B",
                  "backgroundColor": "#C0C0C0"
                }
              }
            }
          }
        ]
      }
    }
  ]
}

The resulting image is below for both GET and POST requests

City map with building footprints in light brown, outlined in dark brown.

Get Request for two layers

Where two or more layers are specified in the request URL an array of themes can be sent in the SLD_BODY for each layer. In these cases the layer name that the themes relates to must also be included in the JSON style definition.

https://api.cloud.precisely.com/v1/spatial/wms?SERVICE=WMS&VERSION=1.3.0&REQUEST=GetMap&BBOX=37.78662956646336823%2C-122.2745967175037549%2C37.81410536165775227%2C-122.2403683391127061&CRS=EPSG%3A4326&WIDTH=1062&HEIGHT=853&LAYERS=buildings,address_fabric&STYLES=&FORMAT=image%2Fpng&DPI=96&MAP_RESOLUTION=96&FORMAT_OPTIONS=dpi%3A96&TRANSPARENT=TRUE&SLD_BODY=%7B%22styleDetails%22%3A%20%5B%7B%22layer%22%3A%20%7B%22name%22%3A%20%22address_fabric%22%2C%22type%22%3A%20%22NamedLayer%22%7D%2C%22themeList%22%3A%20%7B%22theme%22%3A%20%5B%7B%22type%22%3A%20%22OverrideTheme%22%2C%22style%22%3A%20%7B%22type%22%3A%20%22MapBasicCompositeStyle%22%2C%22PointStyle%22%3A%20%7B%22type%22%3A%20%22MapBasicPointStyle%22%2C%22MapBasicSymbol%22%3A%20%7B%22type%22%3A%20%22MapBasicFontSymbol%22%2C%22shape%22%3A%2036%2C%22size%22%3A%2012%2C%22color%22%3A%20%22255%22%2C%22fontName%22%3A%20%22MapInfo%20Symbols%22%2C%22rotation%22%3A%200%2C%22bold%22%3A%20false%2C%22dropShadow%22%3A%20false%2C%22border%22%3A%20%22NONE%22%7D%7D%7D%7D%5D%7D%7D%2C%7B%22layer%22%3A%20%7B%22name%22%3A%20%22buildings%22%2C%22type%22%3A%20%22NamedLayer%22%7D%2C%22themeList%22%3A%20%7B%22theme%22%3A%20%5B%7B%22type%22%3A%20%22OverrideTheme%22%2C%22style%22%3A%20%7B%22type%22%3A%20%22MapBasicCompositeStyle%22%2C%22AreaStyle%22%3A%20%7B%22type%22%3A%20%22MapBasicAreaStyle%22%2C%22MapBasicPen%22%3A%20%7B%22width%22%3A%201%2C%22pattern%22%3A%202%2C%22color%22%3A%20%22%23964B00%22%2C%22unit%22%3A%20%22PIXEL%22%7D%2C%22MapBasicBrush%22%3A%20%7B%22pattern%22%3A%202%2C%22foregroundColor%22%3A%20%22%23E0AB8B%22%2C%22backgroundColor%22%3A%20%22%23C0C0C0%22%7D%7D%7D%7D%5D%7D%7D%5D%7D

Post Request for two layers

POST

https://api.cloud.precisely.com/v1/spatial/wms?SERVICE=WMS&VERSION=1.3.0&REQUEST=GetMap&BBOX=37.78662956646336823%2C-122.2745967175037549%2C37.81410536165775227%2C-122.2403683391127061&CRS=EPSG%3A4326&WIDTH=1062&HEIGHT=853&LAYERS=buildings,address_fabric&STYLES=&FORMAT=image%2Fpng&DPI=96&MAP_RESOLUTION=96&FORMAT_OPTIONS=dpi%3A96&TRANSPARENT=TRUE      

HEADER

Content-Type: application/x-www-form-urlencoded

BODY

SLD_BODY=%7B%22styleDetails%22%3A%20%5B%7B%22layer%22%3A%20%7B%22name%22%3A%20%22address_fabric%22%2C%22type%22%3A%20%22NamedLayer%22%7D%2C%22themeList%22%3A%20%7B%22theme%22%3A%20%5B%7B%22type%22%3A%20%22OverrideTheme%22%2C%22style%22%3A%20%7B%22type%22%3A%20%22MapBasicCompositeStyle%22%2C%22PointStyle%22%3A%20%7B%22type%22%3A%20%22MapBasicPointStyle%22%2C%22MapBasicSymbol%22%3A%20%7B%22type%22%3A%20%22MapBasicFontSymbol%22%2C%22shape%22%3A%2036%2C%22size%22%3A%2012%2C%22color%22%3A%20%22255%22%2C%22fontName%22%3A%20%22MapInfo%20Symbols%22%2C%22rotation%22%3A%200%2C%22bold%22%3A%20false%2C%22dropShadow%22%3A%20false%2C%22border%22%3A%20%22NONE%22%7D%7D%7D%7D%5D%7D%7D%2C%7B%22layer%22%3A%20%7B%22name%22%3A%20%22buildings%22%2C%22type%22%3A%20%22NamedLayer%22%7D%2C%22themeList%22%3A%20%7B%22theme%22%3A%20%5B%7B%22type%22%3A%20%22OverrideTheme%22%2C%22style%22%3A%20%7B%22type%22%3A%20%22MapBasicCompositeStyle%22%2C%22AreaStyle%22%3A%20%7B%22type%22%3A%20%22MapBasicAreaStyle%22%2C%22MapBasicPen%22%3A%20%7B%22width%22%3A%201%2C%22pattern%22%3A%202%2C%22color%22%3A%20%22%23964B00%22%2C%22unit%22%3A%20%22PIXEL%22%7D%2C%22MapBasicBrush%22%3A%20%7B%22pattern%22%3A%202%2C%22foregroundColor%22%3A%20%22%23E0AB8B%22%2C%22backgroundColor%22%3A%20%22%23C0C0C0%22%7D%7D%7D%7D%5D%7D%7D%5D%7D
The style used in the above requests, when decoded, is as follows and defines a solid brown fill for buildings and blue star icon for addresses.
Note: The styleDetails has an array comprising the themeList and associated layer for each themeList.
{
  "styleDetails": [
    {
      "layer": {
        "name": "address_fabric",
        "type": "NamedLayer"
      },
      "themeList": {
        "theme": [
          {
            "type": "OverrideTheme",
            "style": {
              "type": "MapBasicCompositeStyle",
              "PointStyle": {
                "type": "MapBasicPointStyle",
                "MapBasicSymbol": {
                  "type": "MapBasicFontSymbol",
                  "shape": 36,
                  "size": 12,
                  "color": "255",
                  "fontName": "MapInfo Symbols",
                  "rotation": 0,
                  "bold": false,
                  "dropShadow": false,
                  "border": "NONE"
                }
              }
            }
          }
        ]
      }
    },
    {
      "layer": {
        "name": "buildings",
        "type": "NamedLayer"
      },
      "themeList": {
        "theme": [
          {
            "type": "OverrideTheme",
            "style": {
              "type": "MapBasicCompositeStyle",
              "AreaStyle": {
                "type": "MapBasicAreaStyle",
                "MapBasicPen": {
                  "width": 1,
                  "pattern": 2,
                  "color": "#964B00",
                  "unit": "PIXEL"
                },
                "MapBasicBrush": {
                  "pattern": 2,
                  "foregroundColor": "#E0AB8B",
                  "backgroundColor": "#C0C0C0"
                }
              }
            }
          }
        ]
      }
    }
  ]
}

The resulting image is below for both GET and POST requests

City map with tan building polygons and dense blue point geometries represented with star symbols..