Solved

How to pull a raster from an ESRI basemap (https://services.arcgisonline.com/arcgis/rest/services/World_Topo_Map/) to use within FME workbench

  • 12 October 2020
  • 5 replies
  • 43 views

Badge +5

I am trying to connect to an ESRI basemap through a REST endpoint and utilize the resulting raster within a VectorOnRasterOverlayer, but I cannot get the raster within my workspace to work properly. Here is the URL that I pass into the ImageFetcher. This results in an image but it doesn't know its spatial placement and such. I have tried to return JSON but I don't really know what to do with it...

https://services.arcgisonline.com/arcgis/rest/services/World_Topo_Map/MapServer/export?bbox=-87.835947%2C31.067928%2C-87.601273%2C31.214859&bboxSR=4326&layers=&layerDefs=&size=&imageSR=&format=jpg&transparent=true&dpi=900&time=&layerTimeOptions=&dynamicLayers=&gdbVersion=&mapScale=&rotation=&datumTransformations=&layerParameterValues=&mapRangeValues=&layerRangeValues=&f=image

 

Any help on this would be greater appreciated.

icon

Best answer by nielsgerrits 12 October 2020, 11:59

View original

5 replies

Userlevel 6
Badge +33

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

 

2020-10-12_11h55_09

You can find the documentation of the export service here.

Sample workspace attached.

Badge +5

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

 

2020-10-12_11h55_09

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.

Badge +10

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

 

2020-10-12_11h55_09

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.

Userlevel 6
Badge +33

@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).

Badge +10

@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.

Reply