Skip to main content

Hi forum

 

Looking for a bit of help with the using the HTTPCaller to query a polygon area on an Image Service.

 

Points

I’ve got the DTM image service from the Environment agency, which I’ve been using to extract the DTM height value for certain points.

I’ve been using the “identify” function through the HTTPCaller in FME, and then some JSON extraction to get out the height value. All great and working.

 

Polygons

I’ve now got some polygons, and I want to find the lowest height within the polygon footprint (added bonus, maybe also the lowest point on the perimeter too. Not essential).

Looking at the ESRI documentation you can do Identity with a point or a polygon, but I’m getting a bit stuck on the polygon.

For the points data I tested in service identify window, and then copied and pasted the query from the URL into my HTTPCaller and then amended it to take XY attributes etc in FME.

I tried to test for a polygon by inputting a list of coordinates in here and swapped the type to polygon, but I get an error. Presumably I’m meant to update some of these other fields too.

Can anyone help with the text I should be using in the HTTP caller to extract all the values within a polygon?

polygonqueryerror 

Polyline

Identify does not support polylines, so if I wanted to get the lowest height on the perimeter of the polygon I can’t just input a line to the Identify function. I wondered about converting the Polygon into a polyline, and then adding enough vertexes and then running those as points, might be a way around this? See sample workbench, but any suggestions?

 

I’ve linked a sample FME workbench and data, you can see what I’ve done successfully for points data, and what I’ve been trying for the polygon data (and potentially for the polyline (lowest value on perimeter) data.

Comments in red where I think help is needed.

Example 4 x coords for a polygon in BNG if that’s helpful

537671,180693], 537783,180674],5537707,180556],5537499,180645]

 

Happy to hear of any alternative workflows to achieve my goal of lowest point in polygon and lowest point on permimeter too!

 

Thanks,

Steph

First, hats off on you excellent documented question.

For polygons, the syntax for the input is off. Try something like:

{
"hasZ": false,
"hasM": false,
"rings": l
>
544283.5032959, 181384.0673218],
3544368.8234863, 181180.0687256],
1544234.6328735, 181180.9259033],
8544155.6159058, 181407.8413086],
1544283.5032959, 181384.0673218]
]
]
}

You can get this from the GeometryExtractor, set the encoding to Esri JSON. I had to remove the coordinatesystem from the feature before feeding it to the GeometryExtractor to get the API to accept it.


I don't think using the input polygon will give you the output you are expecting. It looks like if you provide a polygon you are returned the pixel value at the centre point of the polygon.

 

I think you perhaps want to look at compute histograms for your requirements

https://environment.data.gov.uk/image/rest/services/SURVEY/LIDAR_Composite_1m_DTM_2020_Elevation/ImageServer/computeHistograms


First, hats off on you excellent documented question.

For polygons, the syntax for the input is off. Try something like:

{
"hasZ": false,
"hasM": false,
"rings": l
>
544283.5032959, 181384.0673218],
3544368.8234863, 181180.0687256],
1544234.6328735, 181180.9259033],
8544155.6159058, 181407.8413086],
1544283.5032959, 181384.0673218]
]
]
}

You can get this from the GeometryExtractor, set the encoding to Esri JSON. I had to remove the coordinatesystem from the feature before feeding it to the GeometryExtractor to get the API to accept it.

Thanks @nielsgerrits​  (more detail the better right!!!)

Yes your new syntax has worked, but as pointed out below I only get a value for the centrepoint of the polygon which isn't really what I was after. Getting closer though!


I don't think using the input polygon will give you the output you are expecting. It looks like if you provide a polygon you are returned the pixel value at the centre point of the polygon.

 

I think you perhaps want to look at compute histograms for your requirements

https://environment.data.gov.uk/image/rest/services/SURVEY/LIDAR_Composite_1m_DTM_2020_Elevation/ImageServer/computeHistograms

Thanks @ebygomm​ yes that's great, that's giving me the min and max values when I input my polygon ESRI JSON (checked the values and they're as I'd expect - perfect!)

 

For some reason my JSONExtractor I run afterwards now isn't working, even though I've changed to look for "min". I'm getting a rejection of "NO_RESULT"

I may just use some Regex intsead, that's much more my realm!

 

min_no_result 

thank you!


Thanks @ebygomm​ yes that's great, that's giving me the min and max values when I input my polygon ESRI JSON (checked the values and they're as I'd expect - perfect!)

 

For some reason my JSONExtractor I run afterwards now isn't working, even though I've changed to look for "min". I'm getting a rejection of "NO_RESULT"

I may just use some Regex intsead, that's much more my realm!

 

min_no_result 

thank you!

The json result is within an array under histograms so you need something like this

jsonn"histograms"]r0]h"min"]

Not sure if it would ever return multiple items (the 0 specifies the first item in the array)


Thanks @ebygomm​ yes that's great, that's giving me the min and max values when I input my polygon ESRI JSON (checked the values and they're as I'd expect - perfect!)

 

For some reason my JSONExtractor I run afterwards now isn't working, even though I've changed to look for "min". I'm getting a rejection of "NO_RESULT"

I may just use some Regex intsead, that's much more my realm!

 

min_no_result 

thank you!

You need

jsonn"histograms"]
  • >"min"]
  • An easy way to get the path is to create a sample json file and select this in the JSONExtractor, then you can use the tree view to select the object you need and get the path.

    2022-11-11_06h40_16


    Reply