Tutorial: addLayer

addLayer



Przykład wywołania metody ILITEAPI.addLayer:

Initcjalizacja mapy znajduje sie tutaj: init

Przyklad dodania nowej warstwy użytkownika. Przycisk "Dodaj warstwę", wykonuje następujący kod:

    
ILITEAPI.addLayer({
    "id": "myLayer",
    "name": "moja warstwa",
    "data": { "features": [{ "attributes": { "OBJECTID": 1, "TYP": "Papier", "OPIS": "pojemnik na papier" }, "geometry": { "type": "point", "x": 636857.2333962998, "y": 484962.8735556804, "spatialReference": { "wkid": 2180 } } }, ...] },
    "idField": "OBJECTID",
    "renderer": { "type": "uniqueValue", "field1": "TYP", "defaultSymbol": { "color": [0, 255, 255, 255], "size": 15, "angle": 0, "xoffset": 0, "yoffset": 0, "type": "esriSMS", "style": "esriSMSCircle" }, "uniqueValueInfos": [{ "value": "Szkło", "symbol": { "type": "esriPMS", "url": "images/UMWarszawa/S3/zielony.png", "width": 30, "height": 30 } }, { "value": "Plastik", "symbol": { "type": "esriPMS", "url": "images/UMWarszawa/S3/zolty.png", "width": 30, "height": 30 } }, { "value": "Papier", "symbol": { "type": "esriPMS", "url": "images/UMWarszawa/S3/niebieski.png", "width": 30, "height": 30 } }, { "value": "Metal", "symbol": { "type": "esriPMS", "url": "images/UMWarszawa/S3/czerwony.png", "width": 30, "height": 30 } }] },
    "clusterRenderer": { "type": "classBreaks", "field": "clusterCount", "defaultSymbol": { "color": [255, 255, 255, 64], "size": 12, "angle": 0, "xoffset": 0, "yoffset": 0, "type": "esriSMS", "style": "esriSMSCircle", "outline": { "color": [0, 0, 0, 255], "width": 1, "type": "esriSLS", "style": "esriSLSSolid" } }, "minValue": 2, "classBreakInfos": [{ "symbol": { "angle": 0, "xoffset": 0, "yoffset": -3.75, "type": "esriPMS", "url": "images/apple-touch-icon-57x57-precomposed_transparent_no_hole_green.png", "width": 45, "height": 45 }, "classMaxValue": 10 }, { "symbol": { "angle": 0, "xoffset": 0, "yoffset": -3.75, "type": "esriPMS", "url": "images/apple-touch-icon-57x57-precomposed_transparent_no_hole_blue.png", "width": 45, "height": 45 }, "classMaxValue": 30 }, { "symbol": { "angle": 0, "xoffset": 0, "yoffset": -3.75, "type": "esriPMS", "url": "images/apple-touch-icon-57x57-precomposed_transparent_no_hole_yellow.png", "width": 45, "height": 45 }, "classMaxValue": 60 }, { "symbol": { "angle": 0, "xoffset": 0, "yoffset": -3.75, "type": "esriPMS", "url": "images/apple-touch-icon-57x57-precomposed_transparent_no_hole_red.png", "width": 45, "height": 45 }, "classMaxValue": 200 }] },
    "popupTemplate": "Typ:<strong>{TYP}</strong><br />Opis:<strong>{OPIS}</strong>"
});