Use SVG export for Openlayer


I’ve discovered openlayer recently,
actually i’m working on it to do some drawing stuff.
All my map are on a local server (I use Tilecache).

My goal for now is trying to add an “export” option, just as openstreetmap does, in order to export and save what i see in my browser in SVG.

I would like to know if this is possible ,
and globally what I have to do for this (if I have to make a Mapserver or if it’s okay with Tilecache …).

Anyway, any tips would be very apreciated, I’m really new to mapping stuff, but I’d like to learn more!

I’m not sure if I’m asking the good question here, and apologise if flooding this forum.

And sorry if my english is not that good…

If you want the export functionality then the best place is to look at the source of the main OSM website.

The export function is a mismatch of things.

  2. The Mapnik library is used directly to render images directly. see the python script
  3. osmarender export is probably done by joining images. In a script called MapOf… that I don’t know anything about. But you can use it here:

I think your english is fine and you aren’t flooding the forum at all… Very nice question, have been thinking of this myself.

ok, thank you for these infos.
I’m not very use of ruby scripts but i’ll try to do my best.

There’s just something hard for me to understand.

There is lots of ways to make your maps appear on openlayer, now i’m using the Tilecache projection witch takes .png tiles on my local server and do all the work (the files are keep in directories like “map/1/2/1.png” which means “map/zoom/x/y .png”) .

My question is : do i have a possibility to make export work with this projection, or do I have to change my projection and use Mapnik generated images?

By projection you mean e.g. EPSG:4326 that tells you how what the meter/pixel ratio is, right?

I don’t know how tilecache operates but I guess it’s downloading tiles from Openstreetmap. In that case you should use the MapOf script (which is PHP).

If you have a copy of database then it 's the same as the main site. The Openstreetmap site use the Mapnik map drawing library to export what it has in the postgreSQL database it will set a projection like this:

  prj = mapnik.Projection("+proj=merc +a=6378137
      +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 
      +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs +over");

You can change this to what ever you want and probably use shortcuts/presets like EPSG:4326…