Re: [postgis-users] polygon with equally spaced points from an existing polygon

2013-03-12 Thread Paolo Corti
On Tue, Mar 12, 2013 at 5:22 AM, Luis Tavares  wrote:
> Hi,
>
> How do I create a polygon with equally spaced points from an existing
> polygon?
>
> I know that more the curvature or concavity changes sign more points are
> needed. So one solution would be to calculate the minimum of all distances
> between two consecutive points in the original polygon and use that distance
> to build my polygon with equally spaced points. Is this correct? If so, How
> do I proceed from here? Any ready made solution?
>

What about ST_Simplify?
regards
p

-- 
Paolo Corti
Geospatial software developer
web: http://www.paolocorti.net
twitter: @capooti
skype: capooti
___
postgis-users mailing list
postgis-users@lists.osgeo.org
http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users


Re: [postgis-users] polygon with equally spaced points from an existing polygon

2013-03-12 Thread Nicolas Ribot
Hi,

Try st_segmentize (http://postgis.net/docs/manual-2.0/ST_Segmentize.html)

Nicolas


On 12 March 2013 09:08, Paolo Corti  wrote:

> On Tue, Mar 12, 2013 at 5:22 AM, Luis Tavares  wrote:
> > Hi,
> >
> > How do I create a polygon with equally spaced points from an existing
> > polygon?
> >
> > I know that more the curvature or concavity changes sign more points are
> > needed. So one solution would be to calculate the minimum of all
> distances
> > between two consecutive points in the original polygon and use that
> distance
> > to build my polygon with equally spaced points. Is this correct? If so,
> How
> > do I proceed from here? Any ready made solution?
> >
>
> What about ST_Simplify?
> regards
> p
>
> --
> Paolo Corti
> Geospatial software developer
> web: http://www.paolocorti.net
> twitter: @capooti
> skype: capooti
> ___
> postgis-users mailing list
> postgis-users@lists.osgeo.org
> http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
>
___
postgis-users mailing list
postgis-users@lists.osgeo.org
http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users


Re: [postgis-users] polygon with equally spaced points from an existing polygon

2013-03-12 Thread Sandro Santilli
On Mon, Mar 11, 2013 at 09:22:09PM -0700, Luis Tavares wrote:

> How do I create a polygon with equally spaced points from an existing polygon?

Looks like a two steps process:

 1) drop vertices that are too close (st_simplify may help)
 2) add vertices where missing (st_simplify)

> I know that more the curvature or concavity changes sign more points are 
> needed. So one solution would be to calculate the minimum of all distances 
> between two consecutive points in the original polygon and use that distance 
> to build my polygon with equally spaced points. Is this correct? If so, How 
> do I proceed from here? Any ready made solution?

Calculating the minimum of all distances between two consecutive
points could be a useful standalone function. Don't you also need
minimum distance between any two points ? I'm curious about the
use case for the "consecutive only" approach.

--strk;
___
postgis-users mailing list
postgis-users@lists.osgeo.org
http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users


Re: [postgis-users] polygon with equally spaced points from an existing polygon

2013-03-12 Thread Luis Tavares
Hi all,

Thanks for your suggestions,

What I really need is a polygon that have exactly the same geometric center 
(centroid) of the original polygon. I don´t know If generalization algorithms 
(like st_simplify) have this property. Same for st_segmentize. I need to make 
some tests first.

strk,
The use case is precisely calculating the polygon´s centroid by averaging the 
coordinates of all the points of the polygon. In order to perform this I think 
I need to have equally spaced points. Note that I´m working on the ellipsoid so 
st_centroid no good to me...and I don´t want to project coordinates.  

Thanks


Luis Tavares


 From: Sandro Santilli 
To: Luis Tavares ; PostGIS Users Discussion 
 
Sent: Tuesday, March 12, 2013 8:50 AM
Subject: Re: [postgis-users] polygon with equally spaced points from an 
existing polygon
 
On Mon, Mar 11, 2013 at 09:22:09PM -0700, Luis Tavares wrote:

> How do I create a polygon with equally spaced points from an existing polygon?

Looks like a two steps process:

1) drop vertices that are too close (st_simplify may help)
2) add vertices where missing (st_simplify)

> I know that more the curvature or concavity changes sign more points are 
> needed. So one solution would be to calculate the minimum of all distances 
> between two consecutive points in the original polygon and use that distance 
> to build my polygon with equally spaced points. Is this correct? If so, How 
> do I proceed from here? Any ready made solution?

Calculating the minimum of all distances between two consecutive
points could be a useful standalone function. Don't you also need
minimum distance between any two points ? I'm curious about the
use case for the "consecutive only" approach.

--strk;___
postgis-users mailing list
postgis-users@lists.osgeo.org
http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users


Re: [postgis-users] polygon with equally spaced points from an existing polygon

2013-03-12 Thread Sandro Santilli
On Tue, Mar 12, 2013 at 10:16:20AM -0700, Luis Tavares wrote:

> The use case is precisely calculating the polygon´s centroid by averaging the 
> coordinates of all the points of the polygon. In order to perform this I 
> think I need to have equally spaced points. Note that I´m working on the 
> ellipsoid so st_centroid no good to me...and I don´t want to project 
> coordinates.  

ST_Simplify does indeed work on the cartesian plane, but you don't
really need to drop existing vertices for the above computation, do you ?

You can use ST_Segmentize(geography) to augment vertices density on the
ellipsoid.

--strk; 

 http://www.cartodb.com - Map, analyze and build applications with your data

   ~~ http://strk.keybit.net 

___
postgis-users mailing list
postgis-users@lists.osgeo.org
http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users