[postgis-users] min distance to right and left

toni hernández toni at sigte.udg.edu
Mon Nov 23 23:48:10 PST 2015


I'll first approach it with topology. Sounds great! :)
(Also I hadn't thought about dead end streets.)

Thank you!

*Toni Hernández Vallès*
Servei de Sistemes d'Informació Geogràfica i Teledetecció
-
Universitat de Girona
*SIGTE*
-
Pl. Ferrater Mora 1
17071 Girona
Tel +34 972 418 039 (7026 intern)
toni at sigte.udg.edu <mailto:toni at sigte.udg.edu>

http://www.sigte.udg.edu
Twitter http://twitter.com/SIGTE_UDG

On 23/11/2015 21:59, Martijn Meijers wrote:
> Hi,
>
> Would http://postgis.net/docs/ST_ShortestLine.html help you in this case?
>
> I am not sure how important the distinction between left/right is, but 
> are you sure that this is always defined properly just by looking at 
> the street and building only? E.g. if you have the following: the 
> house (in the center) is it on the left or right of the small dead end 
> street?
>
> +-------------------+
> |                   |
> |  +===+            |
> |  +===+            |
> |                   |
> |    +              |
> |    |              |
> +----+--------------+
>
> One option: You could build explicit topology and then use information 
> of the faces and use left/right pointers on the edges (the streets) to 
> determine that a building is on the left/right of a street (road part) 
> - you can then also easily filter dead ends.
>
> Another (potentially less accurate) option: calculate orient2d 
> (https://www.cs.cmu.edu/~quake/robust.html) for every segment of the 
> street to every polygon vertex of the building (or even coarser 
> approximation, but much faster: use centroid of the house and one 
> segment that represents the street, e.g. vector from begin point 
> segment - end point segment). I think you have to make such an 
> orientation test in Postgres/PostGIS yourself by making a custom 
> database function. Note that this could give wrong results when 
> streets run around buildings (flipping of left/right as result).
>
>
> Martijn
>
> On 23-11-15 16:13, toni hernández wrote:
>> Hello everyone,
>>
>> I have two tables: streets and buildings.
>> streets with a linestring geometry and buildings with polygons geometry.
>>
>> I need to know what is the minimal distance from each street to a 
>> building on the right, and then, what is the minimal distance from 
>> the street to a building on the left.
>>
>> Any ideas on how I should approach this?
>>
>> Thank you!
>> -- 
>> *Toni Hernández Vallès*
>> Servei de Sistemes d'Informació Geogràfica i Teledetecció
>> -
>> Universitat de Girona
>> *SIGTE*
>> -
>> Pl. Ferrater Mora 1
>> 17071 Girona
>> Tel +34 972 418 039 (7026 intern)
>> toni at sigte.udg.edu <mailto:toni at sigte.udg.edu>
>>
>> http://www.sigte.udg.edu
>> Twitter http://twitter.com/SIGTE_UDG
>>
>>
>>
>> _______________________________________________
>> postgis-users mailing list
>> postgis-users at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/postgis-users
>
> _______________________________________________
> postgis-users mailing list
> postgis-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/postgis-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20151124/72cba51b/attachment.html>


More information about the postgis-users mailing list