I prefer to do the JSON route. This way the service returns the boundingbox coordinates of the returned image. You can parse those and use a RasterGeoreferencer to place the image on coordinates.
The reason for this is in the documentation:
...
The extent displayed in the exported map image may not exactly match the extent sent in the box parameter when the aspect ratio of the image size does not match the aspect ratio of the box. The aspect ratio is the height divided by the width. In these cases, the extent is resized to prevent map images from appearing stretched. The exported map's extent is sent along with the JSON and HTML responses, and may be used in client-side calculations. It's important that the client-side code update its extent based on the response.
...
See the smaller requested and the bigger returned boundingboxes
You can find the documentation of the export service here.
Sample workspace attached.
I prefer to do the JSON route. This way the service returns the boundingbox coordinates of the returned image. You can parse those and use a RasterGeoreferencer to place the image on coordinates.
The reason for this is in the documentation:
...
The extent displayed in the exported map image may not exactly match the extent sent in the box parameter when the aspect ratio of the image size does not match the aspect ratio of the box. The aspect ratio is the height divided by the width. In these cases, the extent is resized to prevent map images from appearing stretched. The exported map's extent is sent along with the JSON and HTML responses, and may be used in client-side calculations. It's important that the client-side code update its extent based on the response.
...
See the smaller requested and the bigger returned boundingboxes
You can find the documentation of the export service here.
Sample workspace attached.
Thank you - this is exactly what I needed! Thank you for taking the time to send the example.
I prefer to do the JSON route. This way the service returns the boundingbox coordinates of the returned image. You can parse those and use a RasterGeoreferencer to place the image on coordinates.
The reason for this is in the documentation:
...
The extent displayed in the exported map image may not exactly match the extent sent in the box parameter when the aspect ratio of the image size does not match the aspect ratio of the box. The aspect ratio is the height divided by the width. In these cases, the extent is resized to prevent map images from appearing stretched. The exported map's extent is sent along with the JSON and HTML responses, and may be used in client-side calculations. It's important that the client-side code update its extent based on the response.
...
See the smaller requested and the bigger returned boundingboxes
You can find the documentation of the export service here.
Sample workspace attached.
@nielsgerrits Can you give some tips on your wksp? 1. If doing more than 1 export don't you need to use the (for export) service? 2. Did you just hard code the same bbox the op was requesting? I will need to parameterize that.
and the creator/reprojector/geometry coercer at the bottom. What is that doing? Thanks.
@nielsgerrits Can you give some tips on your wksp? 1. If doing more than 1 export don't you need to use the (for export) service? 2. Did you just hard code the same bbox the op was requesting? I will need to parameterize that.
and the creator/reprojector/geometry coercer at the bottom. What is that doing? Thanks.
The initial issue had to do with how the export works. It returns a tile with a different extend than the request. The boundingboxes are just there to visualize that very thing.
If you change the requestparameter f(format) = image to f=json, the service returns not an image but a piece of json:
{
"href": "https://services.arcgisonline.com/arcgis/rest/directories/arcgisoutput/World_Topo_Map_MapServer/_ags_map7a13981e88d54f628297b46ee25ee1f0.jpg",
"width": 400,
"height": 400,
"extent": {
"xmin": -9777852.893384967,
"ymin": 3638067.233321921,
"xmax": -9751729.1032025442,
"ymax": 3664191.0235043438,
"spatialReference": {
"wkid": 102100,
"latestWkid": 3857
}
},
"scale": 2314110.6438344717
}
In this reply you can find the link to the image and the boundingbox coordinates. With these coordinates you then can georeference the image.
I think you want to download a large area? You then need to tile (tiler) the area you need, extract boundingboxes (boundsextractor), and concatenate a request for each tile. Then use the sample and merge the referenced images (rastermosaiker).
@nielsgerrits Can you give some tips on your wksp? 1. If doing more than 1 export don't you need to use the (for export) service? 2. Did you just hard code the same bbox the op was requesting? I will need to parameterize that.
and the creator/reprojector/geometry coercer at the bottom. What is that doing? Thanks.
thank you so much for that explanation. I am not so savy at this type of coding. I did ask another question.
Am I supposed to us the arcgisonline service for these types of requests? For some reason i thought i had to use the tiled service. https://tiledbasemaps.arcgis.com/arcgis/rest/services/USA_Topo_Maps/MapServe
and if so do you recommend just using the exporttiles endpoint? get the tiles and then get the images for those tiles?
The problem with the tiledbasemaps is token is required. so i am having difficulty passing a token into my _response_body attribute.