[postgis-users] Extracting the Linestring Geometry from a BBox(noob)

Pedro Doria Meunier pdoria at netmadeira.com
Mon Nov 27 03:58:08 PST 2006

Hey Andrew,


I had to do a similiar thing

“Cut” the road segments belonging to a municipality
 and the query ended
like this:


create my_road_segment as

select intersection(r.geometry, f.geometry) as geometry,

r.name, r.sec_name, r.city, r.region, r.country, r.pcode, r.road_type,

r.route_class, r.speed_class, r.one_way, r.has_dir, r.toll, r.no_car,

r.no_bus, r.no_taxi, r.no_bic, r.no_truck, r.no_emerg, r.no_deliv,
r.no_pedes, r.classific

from rede_estradas as r, freguesias_ram as f

where r.geometry && f.geometry

and intersects(r.geometry, f.geometry)

and f.nome_freg like 'Fajã da Ovelha%';


the keyword here is INTERSECTS


This query creates a table based on a select. This select returns the road
segments *contained* in a polygon defining a municipality.


Hope this helps.


Pedro Doria Meunier

(351) 91 302 49 72 - (351) 96 247 99 12

MSN - pdoriam at hotmail.com

ICQ - 308-182-126

Skype: pdoriam



From: postgis-users-bounces at postgis.refractions.net
[mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of Andrew
Sent: segunda-feira, 27 de Novembro de 2006 7:22
To: postgis-users at postgis.refractions.net
Subject: [postgis-users] Extracting the Linestring Geometry from a


Hey All,

I'm trying to extract some linestrings from a collection of linestrings  and
conditional on being within a BBox.

I will try and explain this best with some images...

My input looks like:

My desired output looks like this:

(note that I DO want the point where it intersects the bbox)

Is this at all possible to do? or do I need to start writing my own postgis

Thanks  in advance


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20061127/3480308f/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.jpg
Type: image/jpeg
Size: 10360 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20061127/3480308f/attachment.jpg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image002.jpg
Type: image/jpeg
Size: 3670 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20061127/3480308f/attachment-0001.jpg>

More information about the postgis-users mailing list