[postgis-users] select AsSVG is beyond me, need some help
Bruce Bushby
bruce.bushby at rmsaudio.com
Wed Dec 20 04:47:45 PST 2006
Hello
I'm trying to display a map layer in an svg document but just can't seem to get
anything to work, any help would be much appreciated.
The map is in shape file format using decimal degrees. I imported the map (munbounds)
with the following command:
shp2pgsql -s 4326 -d munbounds munbounds | psql -d SANDTON -U webuser
The map imports perfectly and I can select it, but I can't select AsSVG, simply because
I don't know what I'm doing :) This is what I've done so far
I can view the extent like so:
[postgres at svg ~]$
[postgres at svg ~]$ psql -d SANDTON -U webuser -c "select astext(extent(the_geom)) from munbounds"
astext
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
POLYGON((27.9827041625977 -26.1347217559814,27.9827041625977 -25.9942073822021,28.1381454467773 -25.9942073822021,28.1381454467773 -26.1347217559814,27.9827041625977 -26.1347217559814))
(1 row)
and I get box information like so:
[postgres at svg ~]$ psql -d SANDTON -U webuser -c "select extent (the_geom) from munbounds"
extent
----------------------------------------------------------------------------
BOX(27.9827041625977 -26.1347217559814,28.1381454467773 -25.9942073822021)
(1 row)
then (and this is where I think I've got it all wrong) I take those values and use them in a select:
[postgres at svg ~]$ psql -d SANDTON -U webuser -c "SELECT AsSVG(intersection(Simplify(the_geom,80),
GeometryFromText('POLYGON((27.9827041625977 -26.1347217559814,27.9827041625977 -25.9942073822021,28.1381454467773 -25.9942073822021,28.1381454467773 -26.1347217559814,27.9827041625977 -26.1347217559814))',4326)),1,1)
FROM munbounds WHERE the_geom && setSRID('BOX3D(27.9827041625977 -26.1347217559814,28.1381454467773 -25.9942073822021)'::box3d,4326)"
assvg
-------
(1 row)
But I get nothing back.
If I do a simple select AsSVG I get rows of numbers, but they don't seem to work when I use them in an SVG document:
[postgres at svg ~]$ psql -d SANDTON -U webuser -t -c "select AsSVG(the_geom) from munbounds"
M 28.09089279176353 26.02902221677196 28.090887069700084 26.029689788796819 28.090881347636643.............lots of these
The map should be a simple municipal boundary about 7 Kilometres x 5 Kilometres. My svg document has a viewbox of 0 0 1024 768.
Is there something obvious that I'm not doing? besides not getting svg path results :)
Cheers
Bruce
More information about the postgis-users
mailing list