On Wed, Jul 22, 2009 at 09:55:19PM +0200, Ramón Pérez wrote: > Subject: [Mapnik-users] Howto transform 4326 to 900913 > > Hi, > > I am newest in mapnik. Sorry for the question! > > It is possible reproject geometry 4326 in 900913 through mapnik?? > > I have all data in srs 4326 in a postgis database and i would like > project it in 900913 directly with mapnik, but i don't know how. I want > to show osm data with custom data in openlayer.
I created a view using ST_Transform to return 900913 data from an 4326
source in the Databae ...
This is the table:
osm=> \d completeborders
Table "public.completeborders"
Column | Type | Modifiers
------------+-------------------+-----------
id | bigint |
name | character varying |
complete | integer |
adminlevel | integer |
border | geometry |
path | character varying |
Check constraints:
"enforce_dims_border" CHECK (ndims(border) = 2)
"enforce_srid_border" CHECK (srid(border) = 4326)
I created the view like this:
create view completebordersm AS
SELECT completeborders.id,
completeborders.name,
completeborders.complete,
completeborders.adminlevel::character varying AS admin_level,
st_transform(completeborders.border, 900913) AS geom
from completeborders;
The trick is though that mapnik wont work like this as it wont be able to find
the geom column from the view. It uses the geometry_columns table for it - so
i added this:
insert into geometry_columns ( f_table_catalog, f_table_schema, f_table_name,
f_geometry_column, coord_dimension, srid, type )
values ('', 'public', 'completebordersm', 'geom', '2', 900913,
'GEOMETRY');
Done
Flo
--
Florian Lohoff [email protected]
Those who would give up a little freedom to get a little
security shall soon have neither - Benjamin Franklin
signature.asc
Description: Digital signature
_______________________________________________ Mapnik-users mailing list [email protected] https://lists.berlios.de/mailman/listinfo/mapnik-users

