[postgis-users] Dividing an area to closest line

Obe, Regina robe.dnd at cityofboston.gov
Mon Dec 29 04:50:00 PST 2008


Nicklas,
 
Hmm still don't quite understand.  What do these road parts look like?  Do you have geometries at all for them?  Are they line strings or points?
 
Perhaps if you provide a sample like  The ST_AsText representation of one that would help us a bit to provide more useful suggestions.
 
If you are trying to make polygons of X width out of road line strings, then I have a function lying around somewhere that will given a linestring -- fatten it up to x thickness (which is pretty much what ST_Buffer(linestring, x/2) would do for you except my function won't create a hot dog - rounded edges), it will create a polygon where the centerline is the original line and edges are perpendicular to the center line.
 
Then you can use ST_Intersects to figure out which points fall in the road poly.
 
Hope that helps,
Regina
 
 

________________________________

From: postgis-users-bounces at postgis.refractions.net [mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of nicklas.aven at jordogskog.no
Sent: Monday, December 29, 2008 7:28 AM
To: PostGIS Users Discussion
Subject: RE: [postgis-users] Dividing an area to closest line


 
Thanks for the answer.
My problem is that I just have the roadparts and nothing to relate them to. I would like to create polygons with their borders between the roads so every possible point inside the polygon share the same closest road. But if it isnt possible I will have to build a raster of rectangels or just points and use the method you suggested on them.
 
/Nicklas

2008-12-29 Obe Regina wrote:

>
Why wouldn't you use a nearest neighbor calculation as demonstrated here (using DISTINCT ON)?
> 
 
> 
http://postgis.refractions.net/documentation/manual-svn/ST_DWithin.html
> 
 
> 
Keep in mind ST_DWithin and  ST_Distance don't care about whether a geometry is a line or polygon or point or collection or whatever.  They will always consider the minimum distance between 2 geometries.
> 
 
> 
ST_DWithin will use a spatial index where as ST_Distance will not.  So for ST_DWithin to work, you have to make the assumption,
> 
the closest road to any point is no more than X units away.  The bigger you make the X, the less efficient the index search, but the less likely you will leave a point out.
> 
 
> 
Hope that helps,
> 
Regina

>> 
________________________________

From: postgis-users-bounces at postgis.refractions.net [mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of nicklas.aven at jordogskog.no
>Sent: Monday, December 29, 2008 3:18 AM
>To: postgis-users at postgis.refractions.net
>Subject: [postgis-users] Dividing an area to closest line
>
>
> 
 
> 
Hallo
> 
 
> 
My first time writing here.
> 
 
> 
The case is that I need to find the closest road from every point in the terrain. The roads are defined in "roadparts". The very best thing would be to get polygons around every roadpart which I could use on other data to bind it to the right road.
> 
 
> 
The only solution I can see is making a raster of small rektangels that I bind to my roadparts using nearest neighbour-calculations.
> 
 
> 
My question is if someone has a more efficient and better solution.
> 
 
> 
Sorry for my bad english
> 
 
> 
Thanks
> 
/Nicklas Avén


-----------------------------------------
The substance of this message, including any attachments, may be
confidential, legally privileged and/or exempt from disclosure
pursuant to Massachusetts law. It is intended
solely for the addressee. If you received this in error, please
contact the sender and delete the material from any computer.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20081229/e92fb2ea/attachment.html>


More information about the postgis-users mailing list