X
PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 24 Oct 2014 11:02 AM by  anon
Adding Geometry from Non-Closed Polygons
 4 Replies
Sort:
You are not authorized to post a reply.
Author Messages

anon



New Member


Posts:
New Member


--
24 Oct 2014 11:02 AM
    Hello, I am using the new ENVI API to import Shapefiles, create ROIs and then retrieve image pixel values. The Help documentation is here: https://www.exelisvis.com/docs/enviroi__addgeometry.html The documentation indicates that when using Polygons, they must be closed (i.e. the first and last vertices must be identical) and sure enough, when I execute the function which adds geometry (roi.AddGeometry in the Help), the function fails if the polygon is not closed. Is there another method for working with non-closed polygon shapefiles and/or will the API be made more flexible in the future? This can be somewhat limiting as this would preclude using multipart polygons or in my particular challenge, doughnut-shaped polygons (e.g. contour bands). Thank you.

    Deleted User



    New Member


    Posts:
    New Member


    --
    27 Oct 2014 07:03 AM
    Geometrically a polygon must be closed, otherwise it has no area. How can you possibly have non-closed polygons? Are you sure they're not actually lines? In which case set the LINE keyword instead of the POLYGON keyword. Josh

    Deleted User



    New Member


    Posts:
    New Member


    --
    27 Oct 2014 08:11 AM
    Hello Josh, True, a polygon must be closed by definition but the important distinction seems to be that in ENVI, the first and last vertices must be identical and that precludes using any multipart polygons. Take for instance, a doughnut-shaped polygon (which could represent, say, a contour band). For that polygon you have two concentric circles which delineate the polygon, so the first vertex would be one of the vertices on the outer edge and the last vertex would belong to the inner edge. Does that make sense? It seems that the ENVI API cannot handle that case. Michael

    Deleted User



    New Member


    Posts:
    New Member


    --
    27 Oct 2014 11:59 PM
    Ah, I get it now. A round about way might be to use the ILDanROI class. Here you can define a multipart roi using the /interior keyword. Add the geometry (in pixel units) of the whole polygon, then add the geometry of the interior polygon setting the interior keyword. You'll probably need to use ENVI_CONVERT_FILE_COORDINATES to get the pixel coordinates though. After which call the "ComputeMask" method providing the dimensions of your image of interest. Then use the WHERE function to return all the indices of your multipart (donut) polygon. That'll allow you to get the image values that you're after. http://www.exelisvis.com/...ut-ROI-with-IDL.aspx I don't have the new ENVI api, but this might be an easier way: http://www.exelisvis.com/...ibutetoroistask.html hope that helps Cheers Josh

    Deleted User



    New Member


    Posts:
    New Member


    --
    03 Nov 2014 11:01 AM
    Thank you, Josh. I didn't know about the objects in the IDLan* class. Thanks for making me aware of these and how to use them. Michael
    You are not authorized to post a reply.