<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<TITLE></TITLE>
<META content="MSHTML 6.00.6000.16764" name=GENERATOR></META></HEAD>
<BODY>
<DIV><FONT face=Arial color=#0000ff size=2></FONT> </DIV>
<DIV><FONT face=Arial color=#0000ff size=2></FONT> </DIV>
<P><SPAN class=125394913-29122008></SPAN><FONT face=Arial><FONT size=2><SPAN
class=125394913-29122008>If I understand correctly </SPAN>I<SPAN
class=125394913-29122008> think that you want to use the method Regina is
suggesting to group points nearest your line parts and then use ST_collect
and ST_convexhull to make polygons out of your point
groups.</SPAN></FONT></FONT></P>
<P><SPAN class=125394913-29122008></SPAN><SPAN
class=125394913-29122008></SPAN><FONT size=2>-<SPAN
class=125394913-29122008>Eric</SPAN></FONT><BR><FONT face=Tahoma><BR><FONT
size=2><SPAN class=125394913-29122008><FONT
face=Arial> </FONT></SPAN>-----Original Message-----<BR><B>From:</B>
postgis-users-bounces@postgis.refractions.net
[mailto:postgis-users-bounces@postgis.refractions.net]<B>On Behalf Of
</B>nicklas.aven@jordogskog.no<BR><B>Sent:</B> Monday, December 29, 2008 7:28
AM<BR><B>To:</B> PostGIS Users Discussion<BR><B>Subject:</B> RE: [postgis-users]
Dividing an area to closest line<BR><BR></P></FONT></FONT>
<BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px">
<DIV> </DIV>
<DIV>Thanks for the answer.</DIV>
<DIV>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.</DIV>
<DIV> </DIV>
<DIV>/Nicklas<BR><BR>2008-12-29 Obe Regina wrote:<BR><BR>></DIV>
<DIV align=left><SPAN
style="FONT-SIZE: 10pt; COLOR: #0000ff; FONT-FAMILY: Arial">Why wouldn't you
use a nearest neighbor calculation as demonstrated here (using DISTINCT
ON)?</SPAN></DIV>>
<DIV align=left><SPAN
style="FONT-SIZE: 10pt; COLOR: #0000ff; FONT-FAMILY: Arial"></SPAN> </DIV>>
<DIV align=left><SPAN
style="FONT-SIZE: 10pt; COLOR: #0000ff; FONT-FAMILY: Arial"><A
href="http://postgis.refractions.net/documentation/manual-svn/ST_DWithin.html">http://postgis.refractions.net/documentation/manual-svn/ST_DWithin.html</A></SPAN></DIV>>
<DIV align=left><SPAN
style="FONT-SIZE: 10pt; COLOR: #0000ff; FONT-FAMILY: Arial"></SPAN> </DIV>>
<DIV align=left><SPAN
style="FONT-SIZE: 10pt; COLOR: #0000ff; FONT-FAMILY: Arial">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.</SPAN></DIV>>
<DIV align=left><SPAN
style="FONT-SIZE: 10pt; COLOR: #0000ff; FONT-FAMILY: Arial"></SPAN> </DIV>>
<DIV align=left><SPAN
style="FONT-SIZE: 10pt; COLOR: #0000ff; FONT-FAMILY: Arial">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,</SPAN></DIV>>
<DIV align=left><SPAN
style="FONT-SIZE: 10pt; COLOR: #0000ff; FONT-FAMILY: Arial">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.</SPAN></DIV>>
<DIV align=left><SPAN
style="FONT-SIZE: 10pt; COLOR: #0000ff; FONT-FAMILY: Arial"></SPAN> </DIV>>
<DIV align=left><SPAN
style="FONT-SIZE: 10pt; COLOR: #0000ff; FONT-FAMILY: Arial">Hope that
helps,</SPAN></DIV>>
<DIV align=left><SPAN
style="FONT-SIZE: 10pt; COLOR: #0000ff; FONT-FAMILY: Arial">Regina</SPAN></DIV><BR>>>
<DIV align=left>
<HR>
<SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"><B>From:</B>
postgis-users-bounces@postgis.refractions.net
[mailto:postgis-users-bounces@postgis.refractions.net] <B>On Behalf Of
</B>nicklas.aven@jordogskog.no<BR>><B>Sent:</B> Monday, December 29, 2008
3:18 AM<BR>><B>To:</B>
postgis-users@postgis.refractions.net<BR>><B>Subject:</B> [postgis-users]
Dividing an area to closest line<BR>></SPAN><BR>></DIV>>
<DIV> </DIV>>
<DIV>Hallo</DIV>>
<DIV> </DIV>>
<DIV>My first time writing here.</DIV>>
<DIV> </DIV>>
<DIV>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.</DIV>>
<DIV> </DIV>>
<DIV>The only solution I can see is making a raster of small rektangels that I
bind to my roadparts using nearest neighbour-calculations.</DIV>>
<DIV> </DIV>>
<DIV>My question is if someone has a more efficient and better
solution.</DIV>>
<DIV> </DIV>>
<DIV>Sorry for my bad english</DIV>>
<DIV> </DIV>>
<DIV>Thanks</DIV>>
<DIV>/Nicklas Avén</DIV></BLOCKQUOTE></BODY></HTML>