Jump to content

 
Photo

Calculate polygon for given points

- - - - -

  • Please log in to reply
5 replies to this topic

#1
Samn

Samn

    Newbie

  • New Member
  • Pip
  • 2 posts
  • Gender:Male
  • United States

I'm looking for a library or software package that will take a group of points and give me the bounding box for those points.  I don't have a way of knowing beforehand which points are vertexes and which are inside the polygon.  I don't care about the points inside the polygon.

Let's say I have the following points:

 0,  0
 0, 10
10, 10
10,  0
 5,  5
 5, 15


I expect to get back a set of:

 0,  0
10,  0
10, 10
 5, 15
 0, 10


I'm having trouble coming up with good search terms for this problem; most of the solutions I'm finding would give me the bounding box--i.e. a rectangle of the min/max lat and lon.  Rather I want a polygon with jagged edges.

These are going to be plotted on a Google (web) Map or written to a KML file.  The server that I'm working with has PHP and NodeJS but I'm not opposed to working with other technologies for this project.



#2
Hans van der Maarel

Hans van der Maarel

    CartoTalk Editor-in-Chief

  • Admin
  • PipPipPipPipPipPipPip
  • 4,177 posts
  • Gender:Male
  • Location:The Netherlands
  • Interests:Cartography, GIS, history, popular science, music.
  • Netherlands

If you don't have a way of knowing which points are edge points and which ones are inside it'll be pretty much impossible I'm afraid.

 

Do you know whether the points will be supplied in any sort of order?


Hans van der Maarel - Cartotalk Editor
Red Geographics
Email: hans@redgeographics.com / Twitter: @redgeographics

#3
Luca

Luca

    Contributor

  • Validated Member
  • PipPip
  • 24 posts
  • Gender:Male
  • Location:Luzern
  • Switzerland

If I understand right you are looking for the convex hull:

 

http://wiki.gis.com/...php/Convex_hull


Mappuls AG | www.mappuls.ch
8°17'50"East / 47°3'2"North


#4
tangnar

tangnar

    Master Contributor

  • Validated Member
  • PipPipPipPip
  • 143 posts
  • Gender:Male
  • Location:South Carolina
  • Interests:Rivers, Urban Design, Geomorphology, Bicycling, Outdoors
  • United States

If Luca is correct and convex hull is what you're after, you could look into Turf JS. It is a JS library for geospatial operations, and includes a convex hull operation.  Or it might have what you're looking for, if it's not convex hull. 

 

It can be implemented with NodeJS on the server or can run in the browser. 



#5
david17tym

david17tym

    Master Contributor

  • Validated Member
  • PipPipPipPip
  • 123 posts
  • Gender:Male
  • Location:North Wales
  • United Kingdom

Hi Samn,

The ever useful ETGeoWizards plug-in for ArcGIS can handle this.

 

http://www.ian-ko.co...vexPolygons.htm

 

Dave



#6
Samn

Samn

    Newbie

  • New Member
  • Pip
  • 2 posts
  • Gender:Male
  • United States

Convex hull is exactly what I was looking for.  You guys are awesome!






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

-->