Select to view content in your preferred language

Export Web Map Operational Layers

1376
3
08-02-2012 12:59 PM
KevinGooss
Regular Contributor
I'm trying to export a map and have a definition query on one of the visible layers.
As my reference i'm using these two help files from esri:

http://resources.arcgis.com/en/help/rest/apiref/exportwebmap_spec.html
http://resources.arcgis.com/en/help/main/10.1/index.html#//0154000004w8000000

unfortunately, they differ. And i'm not sure why and which is correct.
I see the term "operational layers" used in one example but in another they just refer to "layer".

I'm fairly certain that my request will not work because even though I have defined a definition expression I haven't really said which layer it applies to.

Here is my request:

{
    "mapOptions": {
        "extent": {
            "xmin": -10277673.334899997,
            "ymin": 4527010.491500001,
            "xmax": -10276963.904200003,
            "ymax": 4527654.234599998,
            "spatialReference": {
                "wkid": 102100
            }
        },
        "scale": 13619.999999999998,
        "rotation": 0,
        "spatialReference": {
            "wkid": 102100
        }
    },
    "operationalLayers": [
        {
            "id": null,
            "url": "http://blah.com/ArcGIS/rest/services/MDC/MDC_Edit/MapServer",
            "title": "FGC_Edit",
            "opacity": 0.9,
            "layerDefinition": {
                "definitionExpression": "SHPID='1496E00C03C6494D8A6EDE861FDBA387'"
            },
            "visibleLayers": [
                5
            ]
        }
    ],
    "baseMap": {
        "title": "My Base Map",
        "baseMapLayers": [
            {
                "url": "http://services.arcgisonline.com/ArcGIS/rest/services/USA_Topo_Maps/MapServer"
            }
        ]
    },
    "exportOptions": {
        "dpi": 96,
        "outputSize": [
            500,
            500
        ]
    },
    "layoutOptions": {
        "titleText": ""
    }
}
Tags (2)
0 Kudos
3 Replies
SrinivasVinnakota
Esri Contributor
I modified the JSON that you posted at couple of places:
1. updated the map extent so that it displays San Francisco and neighboring areas.
2. Updated the operational layer URL to point to a public server.

Notice that "layers" array contains one layer object that is pointing to the first layer of the map service (layer id 0). In this layer object you pass in a definition expression.

{
    "mapOptions": {
        "extent": {
            "xmin": -126,
            "ymin": 27,
            "xmax": -108,
            "ymax": 44,
            "spatialReference": {
                "wkid": 4326,
                "latestWkid": 4326
            }
        },
        "rotation": 0,
        "spatialReference": {
            "wkid": 4326
        }
    },
    "operationalLayers": [
        {
            "id": null,
            "url": "http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/SanFrancisco/311Incidents/MapServer",
            "title": "FGC_Edit",
             "layers": [
                {
                    "id": 0,
                    "layerDefinition": {
                        "definitionExpression": "req_type like 'Graffiti%'"
                    }
                }
            ]
        }
    ],
    "baseMap": {
        "title": "My Base Map",
        "baseMapLayers": [
            {
                "url": "http://services.arcgisonline.com/ArcGIS/rest/services/USA_Topo_Maps/MapServer"
            }
        ]
    },
    "exportOptions": {
        "dpi": 96,
        "outputSize": [
            500,
            500
        ]
    },
    "layoutOptions": {
        "titleText": ""
    }
}
0 Kudos
KevinGooss
Regular Contributor
Humm... thank you for the suggestion, but it still not working for me as expected.
Even when my where clause is '0 = 0' (which returns all records in the REST layer call) I get no features returned.
The 0 in the id refers to the index of the layer in the service correct? Not an index of visible layers in the request?

I am attempting this against a 9.31 mapservice. Is it possible it is not supported because of that?

I took your request, replaced the operational layer url, the id, and the definitionExpression with my info but that results in no features being displayed.

I know the url, id and expression are valid because i am testing them with the REST api page. And i know the features are within my extent because without the definition query i see them all.

I'm stuck on what else to try.
0 Kudos
KevinGooss
Regular Contributor
I shifted some data around and setup the same service in 10.1 and the query now is working. So it must have been the fact that my original service was 9.31
thank you for the help
0 Kudos