Hi, You can also find the Well Known Text presentation of the polygon and use it as a geometry in PostGIS spatial query. Well known text is most easy to get by opening the shapefile with OpenJUMP, selecting the polygon and doing right click - Feature info.
I can't test the query right now, but see examples for example from http://www.cse.iitb.ac.in/dbms/cep/day8/lab/postgis.php You may need to give also SRID with the WKT polygon. And you can run the whole query with OpenJUMP and get the result directly as a map. -Jukka Rahkonen- Dan Lyke wrote Re: [Mapnik-users] extract names from roads within polygon > > On Fri, 17 Dec 2010 11:19:03 +0000 > Philip Stubbs <[email protected]> wrote: > > area of the shapefiles. What I would like to to is extract a list of > > names from all the roads that come from the PostGIS > database that are > > within the shapefile polygon. Is that possible? > > So presumably "shp2pgsql" will give you the right way to convert your > shapefile polygon into a PostGIS poly, at which point it's just: > > SELECT names FROM roads WHERE Within(roads.the_geom, yourpolygeom); > > And your road centers would be something like: > > SELECT names, Centroid(the_geom) FROM roads > WHERE Within(the_geom, yourpolygeom); > > What I'm less clear on (before 6AM local time, preparing to drive most > of the day...) is how to get from the shapefile to > yourpolygeom, but you > could easily just use shp2pgsql to load that shapefile into a 1 record > table. > > Dan > _______________________________________________ > Mapnik-users mailing list > [email protected] > https://lists.berlios.de/mailman/listinfo/mapnik-users > _______________________________________________ Mapnik-users mailing list [email protected] https://lists.berlios.de/mailman/listinfo/mapnik-users

