How to get minimal rectangles from building footprints using Python

684
11
10-13-2019 08:13 AM
Highlighted
New Contributor II

hi, i have been working on to get minimum bounding rectangles for my building polygons using python. i do get square rectangles but i need minimum rectangles to train YOLOv3. need help with it. Thanks in advance.

Reply
0 Kudos
11 Replies
Highlighted
Highlighted
Esri Esteemed Contributor

Hi hassan.rg ,

I have branched your question to a new question since the OP was about Arcade and the GroupBy function.

Have you tried the option "Rectangle by width"? Does that change the result? See for options: Minimum Bounding Geometry—Data Management toolbox | ArcGIS Desktop 

Highlighted
Frequent Contributor II

# Import arcpy module
import arcpy

#Circles being my polygon layer
# Local variables:
Circles = "Circles"
Circles_MinimumBoundingGeome = "C:\\Users\\<user>\\Documents\\ArcGIS\\Default.gdb\\Circles_MinimumBoundingGeome"

# Process: Minimum Bounding Geometry
arcpy.MinimumBoundingGeometry_management(Circles, Circles_MinimumBoundingGeome, "ENVELOPE", "NONE", "", "NO_MBG_FIELDS")

Highlighted
MVP Esteemed Contributor

rizwan gul‌, it helps if you explain what you are currently doing to get square rectangles, e.g., what geoprocessing tools or Python code.  Also, it is helpful if you can show an example (either screenshot or preferably data) that includes the footprint and current result.

Highlighted
New Contributor II

Hi, Joshua Bixby

i have got the python code. it gets me minimum bounding rectangles but only with given vertices not with polygons or point data. i am sharing it here. Error and screenshot is as under. i only can supply integer values to my function of Minimum rectangles not the polygon data. how i can extract all the values from polygon geometry into another variable as integer list? thank you

Reply
0 Kudos
Highlighted
Moderator

Hi rizwan gul‌.

I see you have a duplicate version of this question in another space. In order to avoid duplicate questions and answer threads in different product places if you have a question that you'd like to share in multiple places then you can easily do this.

Follow the steps in this document Sharing Content with Multiple Places‌ and this will help keep everyone's answers in the same question thread whilst allowing you to share it to multiple places. This make it easier for other members to find and gain value from answered questions. Hope this helps. 

Community Moderator, Esri Community Team.
Highlighted
Frequent Contributor II

Truthfully Louise ESRI needs to adjust the manner in which questions are structured in the question pane.

When the write gets to the selection to choose a location the instinct may be to select a group they feel matches what they are doing.

You may pick a group and see there are only 153 followers.  Well you may then think my question is only getting out to 153 people and that is if they log in on a regular basis. 

It would quite possibly be a better practice to allow a person to select 2 or more groups, OR better yet have a basic general discussion option and a notice telling people this question is posted here here and link all the answers together.

Highlighted
Moderator

Thanks for your suggestion Robert to make this more intuitive for members. At this time with our current platform we are not able to change the way this functions but we'll certainly take this suggestion on board and look for opportunities to improve this in the future. For now sharing to multiple places is the best way to ensure a question gets wide exposure to the greatest audience without creating duplicate threads. 

Community Moderator, Esri Community Team.
Reply
0 Kudos
Highlighted
New Contributor II

I will check it next time, sorry for inconvenience.