My task is to generate a box that maps over the existing polygon, which I’ll call the level. What I’m doing is mapping buildings with geojson, which does so by using a set of lat/long coordinates as points to define the polygon that matches the walls.

To create the box, I currently have a script in place to find the furthest coordinates (on the level) in North/South/east/West directions. It then generates a line with those two coordinates and finds the intersection between the line in each direction. Essentially boxing in the entire level no matter what funky shape the building is in.

However, this only works when the building directly faces a cardinal direction. My question is, when the building is instead facing X degrees in a certain direction, how can I perform the same calculation that will generate the box for me?

  • Welcome to Geographic Information Systems! Welcome to GIS SE! We're a little different from other sites; this isn't a discussion forum but a Q&A site. Your questions should as much as possible describe not just what you want to do, but precisely what you have tried and where you are stuck trying that. Please check out our short tour for more about how the site works. – Ian Turton Dec 18 '20 at 17:45
  • Could you explain what you mean by "a box that maps over existing polygon"? What you described results in a bounding box. You might perhaps be interested in computing a minimum bounding rectangle (MBR)? – Jan Šimbera Dec 20 '20 at 17:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.