Parameters example for using the REST export map
Are there any examples of the expected inputs for the various options of the REST export map utility? I can run an empty request and get an image response. Some of the inputs are self explanatory, but others like custom graphics and layers are not clear.
0
-
Hi Marc,
Unfortunately we do not have an example of how to use the Export tool in the Essentials REST endpoint. However, we do model our tool closely to Esri's export map tool so you can take a look at this link for more information: http://resources.arcgis.com/en/help/rest/apiref/index.html?mapserver.html
The Custom Graphics text area refers to whether you want to add in your own markup of some sort. This would be equivalent to using the Drawing Tools to draw some geometry on the map before printing. The Layers parameter refers to which layers you want to show and hide in the map for printing.
I hope this helps.
Carmen0 -
Hi Marc
here is the construction of an url from a C# based application that calls the print function of a map template.
reqUrl = LIM_Map_Builder.Properties.Settings.Default.geocortexPrintTemplateUrl + templateId + "/print?" +
"bbox=" + mapSheetEnvelope.xMin + "," + mapSheetEnvelope.yMin + "," + mapSheetEnvelope.xMax + "," + mapSheetEnvelope.yMax +
"&bboxSR=2193" +
"&layers=" + layers +
"&layerDefinitions={1:{%2211%22:%22id in %28" + sueListString + "%29%22},22:{%220%22:%22id in %28" + sueListString + "%29%22,%221%22:%22id not in %28" + sueListString + "%29%22,%222%22:%221=1%22}}" +
"&dpi=250" +
"&outputFormat=Pdf" +
"&graphics=" +
"&tf__Title=" + sheetTitle +
"&f=pjson";
Which translates to in the browser:
http://gisagslive.rdc.govt.nz/Geocortex/Essentials/REST/sites/GV4/printtemplates/1/print?bbox=1882913,5773910,1883273,5774352&bboxSR=2193&layers=1(show:14,16,17);3(hide:*);4(hide:*);5(hide:*); 6(hide:*);7(hide:*);8(hide:*);9(hide:*);10(hide:*);11(hide:*);12(hide:*);21(hide:*);22(show:0,1,2,3)&layerDefinitions={1:{"11" :"id in '4413251'"},22:{"0":"id in '4413251'","1":"id not in '4413251'","2":"1=1"}}&dpi=250&outputFormat=Pdf&graphics=&tf__Title=Locality Map&f=pjson
The layers parameter needs to be something along these lines:
1(show:16,17);3(show:*);4(hide:*);5(hide:*);6(hide:*);7(show:*);8(hide:*);9(hide:*);10(hide:*);11(hide:*);12(hide:*);21(hide:*);22(show:0,1)
ie mapserviceId(show: layerId1,layerId2);
and the layersDefinition is effectively a filtering mechanism:
layerDefinitions={1:{"11" :"id in '4413251'"},22:{"0":"id in '4413251'","1":"id not in '4413251'","2":"1=1"}}
in the example above I want to highlight a parcel(s) (layer 11 in mapservice 1) which has labelling and turn off all other parcels in that mapservice PLUS use another mapservice in the site and use a parcel layer (layer 0) that has a thick boundary symbolisation, all other parcels (layer 1) with a thin boundary and show all lakes (layer 2).
I have yet to figure out the custom graphics parameter as yet. I did post a question to try to get an example but have yet to get an answer: https://support.geocortex.com/essentialsGSCForum?sub-nav=forum&main-nav=essentials&#!/feedtype=SINGLE_QUESTION_DETAIL&id=9066000000008q9AAA
Regards
Ralph Price0 -
Example of use of customGraphics parameter: customgraphics = "{""layers"": [{""elements"":[ {""geometry"":"& geometry1Line.ToJson().Replace("}","") &",""spatialReference"":28992},""symbol"":{""color"":[0,0,255,255],""width"":1,""type"":""esriSLS"",""style"":""esriSLSSolid""}}]}]}"0 -
Awesome! Thanks for helping put the pieces together!
--Marc0 -
Thanks Nico
here is a cleaned up version of your Custom Graphics just to make it a little clearer without doubled up " characters etc.:
{
"layers": [{
"elements": [{
"geometry": {
"spatialReference": {
"wkid": 2193
},
"paths": [
[
[1882913,5773910],
[1883273,5774352]
]
]
},
"symbol": {
"color": [0, 0, 255, 255],
"width": 1,
"type": "esriSLS",
"style": "esriSLSSolid"
}
}]
}]
}
and an example request:
http://gisagslive.rdc.govt.nz/Geocortex/Essentials/REST/sites/GV4/printtemplates/1/print?bbox=1882913%2C5773910%2C1883273%2C5774352&bboxSR=2193&targetSR=&time=&graphics=%7B%22layers%22%3A+%5B%7B%22elements%22%3A+%5B%7B%22geometry%22%3A+%7B%22spatialReference%22%3A+%7B%22wkid%22%3A+2193%7D%2C%22paths%22%3A+%5B%5B%5B1882913%2C5773910%5D%2C%5B1883273%2C5774352%5D%5D%5D%7D%2C%22symbol%22%3A+%7B%22color%22%3A+%5B0%2C+0%2C+255%2C+255%5D%2C%22width%22%3A+1%2C%22type%22%3A+%22esriSLS%22%2C%22style%22%3A+%22esriSLSSolid%22%7D%7D%5D%7D%5D%7D&layers=1%28show%3A14%2C16%2C17%29%3B3%28hide%3A*%29%3B4%28hide%3A*%29%3B5%28hide%3A*%29%3B+6%28hide%3A*%29%3B7%28hide%3A*%29%3B8%28hide%3A*%29%3B9%28hide%3A*%29%3B10%28hide%3A*%29%3B11%28hide%3A*%29%3B12%28hide%3A*%29%3B21%28hide%3A*%29%3B22%28show%3A0%2C1%2C2%2C3%29&layerDefinitions=%7B1%3A%7B%2211%22%3A%22id+in+%284413251%29%22%7D%7D&opacity=&mapServiceOptions=&featureLayerOptions=&grid=&scale=&dpi=250&outputFormat=Pdf&tf__Title=Locality+Map&f=pjson#
and this request correctly created a pdf with a diagonal line from min x,y to max x,y
Thanks for your help.
Regards
Ralph Price0 -
Thanks for cleaning up :-) 0 -
This has been very helpful, thank you.
Are Dynamic Sercvices required in order to use the layer definitions in the Export Map Service activity or using the REST Export Map function?
Thank you
AC0
Please sign in to leave a comment.
Comments
7 comments