SpatialStream® Code Examples

Basic Map

Adding layers to the map using the Map Composition file is most effective when you use it to load the layers and construct GetMap requests. The Map Composition File is a predefined xml file that contains information about all the layers to be loaded on the map, as well as the styling and display rules for those layers. The example below shows how to load a Neighborhood Boundaries layer with a predefined style of blue fill color, partial opacity, and black border color, to the map using the Map Composition File and the GetMap functional component.

The primary benefit of using the Map Composition File is that it externalizes the definition, styling and display parameters of layers on the map which make it far faster and easier to make changes to the layers or their styling, all without changing the application code. The Map Composition File also makes maintenance of your map layers convenient, by aggregating all layer information in one location.

Map Composition File | GetMap


//Load MapComposition file
var url = "LayerList.aspx?ListName=LayerLists/Samples/NeighborhoodsWithLabel.xml&output=jsonxml";
Dmp.Env.Connections["SS"].getJson(url, gotMapComp, failed);

//Success callback for MapComposition file load
function gotMapComp(xml) {

map.load(xml);
layer = map.getDmpLayerById("neighborhoodLayer");
}; //gotMapComp


Run Sample   View Video   Back To Index