Skip to main content

How to convert geometry extent to geometry (polygon)?

Comments

7 comments

  • Zack Robison

    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
  • Matt Palavido

    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
  • Permanently deleted user

    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
  • Matt Palavido

    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
  • Zack Robison

    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
  • Matt Palavido

    Zack - good idea, I didn't consider that. I'll give that a try with the 'Get Geometry from JSON' activity.

    0
  • Christopher Wiebke

    have you seen this post, which has an example workflow with the 'Get Geometry from JSON' activity in it:

    https://communities.geocortex.com/s/question/0D5f200005HcqYsCAJ/is-it-possible-to-draw-a-line-from-points

    0

Please sign in to leave a comment.