Skip to main content
Solved

How to use the HTTPCaller to perform an Identify using a Polygon on an ESRI Image Server service? I am looking to extract heights from a DTM service for a polygon area, and then identify the lowest value of those heights.


stephstedman
Participant
Forum|alt.badge.img+4

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],[537707,180556],[537499,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

Best answer by ebygomm

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

View original
Did this help you find an answer to your question?

6 replies

nielsgerrits
VIP
Forum|alt.badge.img+54

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": [
		[
			[544283.5032959181384.0673218],
			[544368.8234863181180.0687256],
			[544234.6328735181180.9259033],
			[544155.6159058181407.8413086],
			[544283.5032959181384.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.


ebygomm
Influencer
Forum|alt.badge.img+33
  • Influencer
  • Best Answer
  • November 9, 2022

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


stephstedman
Participant
Forum|alt.badge.img+4
  • Author
  • Participant
  • November 9, 2022
nielsgerrits wrote:

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": [
		[
			[544283.5032959181384.0673218],
			[544368.8234863181180.0687256],
			[544234.6328735181180.9259033],
			[544155.6159058181407.8413086],
			[544283.5032959181384.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!


stephstedman
Participant
Forum|alt.badge.img+4
  • Author
  • Participant
  • November 9, 2022
ebygomm wrote:

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!


ebygomm
Influencer
Forum|alt.badge.img+33
  • Influencer
  • November 9, 2022
stephstedman wrote:

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

json["histograms"][0]["min"]

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


nielsgerrits
VIP
Forum|alt.badge.img+54
stephstedman wrote:

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

json["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


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings