How to convert geometry extent to geometry (polygon)?
Hello,
Does anyone have any examples or ideas on how to create geometry from a geometry's extent? I can get the extent, just not sure how to turn it into a geometry.
Specifically, I'm trying to take the resulting geometry from a buffer, get the extent of it, and replace the geometry with the square extent.
The concept would be analogous to this ArcGIS workflow to create square buffers around a point:
https://support.esri.com/en/technical-article/000012502
Thanks in advance!
Matt
-
An Extent is a geometry, just a different sub-class than a Polygon. If all you need this for is to draw, the extent will work just fine.
0 -
Thanks for the quick reply Zack. I actually need to create a feature and add it to an existing feature class. I tried adding the extent from the Get Geomtery Extent activity (example : $geometryExtent1.extent) as an input to the 'Create Feature' activity, but it fails. It works fine if I pass it the output of the buffer geomtery.
0 -
So the Esri example is for drawing an square extent around a point. If that is all you are doing, the easiest way is to take the point and create a square around it by adding/subtracting the distance to the XMIN, XMAX, YMIN, and YMAX.
If you are doing this with multiple other features that will result in a non-square extent, this gets a little more complex. If you do this in code, you would need to compare the length of the North/South and East/West sides and find the longest length, then add half to each side of the shorter length. You need to watch out for potentially changing unit directions (e.g. in Lat/Lon crossing the equator or meridian).
DDS has a free Workflow Activity Pack that you use to do this. It returns a true square. You can learn more about it at https://www.geowidgets.io/docs/geocortex-workflow-activities/turf-activity-reference/square/. To use the Activity Pack, instructions are at https://www.geowidgets.io/products/geowidgets-workflow-activities/
Best,
-Tom
0 -
I should have been more specific in my post. Yes, in this case, it will always be a point. I've shared the workflow in case you want to take a look or make a copy. Basically it is a simple buffer tool, but I'm trying to add the option for the user to select a square extent of the buffer or the circular buffer itself.
https://geoportal.dudek.com/arcgis/home/item.html?id=fb2cf199ae4543b28651c22dbd3e5284
0 -
There is a cast geometry activity, but I haven't gotten it to work with extents. You may need to create a feature's json manually using the extent's xy properties.
0 -
Zack - good idea, I didn't consider that. I'll give that a try with the 'Get Geometry from JSON' activity.
0 -
have you seen this post, which has an example workflow with the 'Get Geometry from JSON' activity in it:
0
Bitte melden Sie sich an, um einen Kommentar zu hinterlassen.
Kommentare
7 Kommentare