Render Map Using a Feature Service Response
This example of a Mapping Service POST request uses the response from a Feature Service request (a feature) as part of a RenderMap request.
POST Request to the Feature Service
POST http://hostname:port/rest/Spatial/FeatureService/tables/features.json?q=select%20Obj,Country,Capital%20from%20%22/Samples/NamedTables/WorldTable%22%20where%20Country=%27Andorra%27
Content-type: application/json
Authorization: <Basic or Spectrum Token>
You will receive a Feature Service response. However you only want to pass part of this response on to the RenderMap request, which is the complete FeatureCollection (the feature) that you want to render.
Example
{
"type": "FeatureCollection",
"Metadata": [
{
"type": "Geometry",
"name": "Obj",
"bbox": [
1.422111,
42.435081,
1.7793329999999998,
42.658695
],
"styleColumn": "MI_Style"
},
{
"type": "String",
"name": "Country"
},
{
"type": "String",
"name": "Capital"
}
],
"bbox": [
1.422111,
42.435081,
1.7793329999999998,
42.658695
],
"features": [
{
"type": "Feature",
"id": "9",
"geometry": {
"type": "MultiPolygon",
"coordinates": [
[
[
[
1.439917,
42.606499
],
[
1.4589999999999999,
42.609055
],
[
1.470056,
42.649775999999996
],
[
1.482194,
42.653721
],
[
1.495611,
42.650196
],
[
1.554417,
42.658695
],
[
1.5949719999999998,
42.639526
],
[
1.628722,
42.635777
],
[
1.6558329999999999,
42.626304999999995
],
[
1.695417,
42.634388
],
[
1.7015829999999998,
42.628029
],
[
1.736194,
42.617722
],
[
1.728333,
42.602554
],
[
1.730667,
42.598526
],
[
1.763861,
42.587112
],
[
1.7793329999999998,
42.572860999999996
],
[
1.742611,
42.565833999999995
],
[
1.7327219999999999,
42.557026
],
[
1.723528,
42.527054
],
[
1.7235,
42.503859999999996
],
[
1.701611,
42.4925
],
[
1.670833,
42.503307
],
[
1.6644999999999999,
42.485138
],
[
1.646444,
42.470054999999995
],
[
1.628528,
42.46825
],
[
1.589472,
42.453444999999995
],
[
1.571861,
42.454639
],
[
1.548417,
42.440166
],
[
1.515417,
42.435081
],
[
1.464778,
42.441139
],
[
1.452528,
42.448277
],
[
1.448361,
42.467804
],
[
1.430361,
42.485363
],
[
1.432167,
42.490776
],
[
1.459944,
42.508026
],
[
1.464361,
42.516945
],
[
1.447944,
42.540833
],
[
1.423889,
42.542221
],
[
1.422111,
42.554943
],
[
1.4327219999999998,
42.576363
],
[
1.4266109999999999,
42.59211
],
[
1.4355559999999998,
42.597332
],
[
1.439917,
42.606499
]
]
]
]
},
"properties": {
"Country": "Andorra",
"Capital": "Andorra La Vella"
}
}
]
}
Now you can use the Mapping Service RenderMap request to render the feature. The RenderMap request POST DATA are described under Render Map. The Feature Service response (as descibed above) will make up the json POST BODY of the REST request.
The below format is used for HTTP POST requests:
HTTP POST: /maps/image.image type;
POST DATA: w=width;h=height;c=x,y,srs;z=zoom;s=scale;b=x1,y1,x2,y2,srs;
[r=resolution];[l=locale];[bc=background color];[bo=background opacity];
POST BODY: Content-Type:application/json {FeatureCollection}
POST http://hostname:port/rest/Spatial/MappingService/maps/image.png;w=800;h=600;b=1.42,42.23,1.77,42.85,epsg:4326;
Content-type: application/json
Authorization: <Basic or Spectrum Token>
Body: <FeatureCollection returned from Feature Service response>