On 17 December 2010 13:55, Dan Lyke <[email protected]> wrote:
> 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

Yay! This pointed me in the right direction. I am really pleased with
the end result, even if the it is not a perfect implementation.

http://goo.gl/WLE6A

What would really help is a way to query in python if a street is long
enough to accept a text label. Then I could know which roads I then
have to number. At the moment what I do is work out the scale from the
size of the bounding box and the size of the image, so that I get a
value of meters per pixel. Then I divide the road length in meters by
the scale to get it in pixels, then divide this by the number of
characters in the name to give me an approximation of available pixels
per char. Anything above a certain value I use the line placement for
the name, anything below a certain value, that is within my polygon, I
number.

Anyhow, for now I have the result that I want. :-)

-- 
Philip Stubbs
_______________________________________________
Mapnik-users mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/mapnik-users

Reply via email to