Re: [OSM-talk] OpenHikingMap - OpenCycleMap

2009-02-05 Thread Dave Stubbs
2009/2/5 Stéphane Brunner stephane.brun...@gmail.com:
 Hello,

 Thanks for this file,
 I have try last evening but I have a problem to run correctly the svn
 version of mapnik, I try again this evening.

 But I have a question, how to include the generated file in a mapnik
 style file, should I copy it or is there an import tag ?


either cut  paste (it will be very big!),
or follow the instructions here:
http://trac.mapnik.org/wiki/ManagingLargeXmlFiles#ExternalEntities

you'll need compile mapnik with the libxml2 support (also explained
further up that page) for it to work.

Dave

___
talk mailing list
talk@openstreetmap.org
http://lists.openstreetmap.org/listinfo/talk


Re: [OSM-talk] OpenHikingMap - OpenCycleMap

2009-02-04 Thread Steve Hill
On Wed, 4 Feb 2009, Dave Stubbs wrote:

 For the contours we haven't figured out how to prevent those
 irritating joins on the srtm tile boundary yet. They're not that
 noticable. If you figure it out do let me  andy know  :-)

This shouldn't be too hard - possibly even as a post-processing step once 
the contour lines are in a PostGIS table:

- For each tile boundary, select all the contours that intersect it. 
- Iterate through all the contour lines which extend away from one side of 
the boundary line and match them up with the lines that extend away from 
the other side by looking at their heights (and probably also the heights 
of the surrounding contours).
- Trim off the ends and glue the matched up lines together.

  - Steve
xmpp:st...@nexusuk.org   sip:st...@nexusuk.org   http://www.nexusuk.org/

  Servatis a periculum, servatis a maleficum - Whisper, Evanescence


___
talk mailing list
talk@openstreetmap.org
http://lists.openstreetmap.org/listinfo/talk


Re: [OSM-talk] OpenHikingMap - OpenCycleMap

2009-02-04 Thread Dave Stubbs
2009/2/4 Stéphane Brunner stephane.brun...@gmail.com:
 Hello,

 With Sylvain Letuffe we progress to create an OpenHikingMap but we
 have some  technical problem.
 He succeed to create geoTiff files for 1°x1° but if we generate a map
 of the total world we have thousands of files. And how to include it
 in the mapnik style file ?
 For contour generation we should generate if world wide in one time if
 we don't want to have some brake on the 1°x1° tiles borders.

 Where is it possible to download the mapnik style file (osm.xml) used
 to create OpenCycleMap it can be a good base.


We have a python script that creates a layer for each tiff produced.
I've attached it, it has some hardcoded paths so you'll need to edit
it. The generated file is then included into the mapnik style sheet --
you can use XML entities to do that [1]. Make sure you're using a
recent version of Mapnik (svn version 789 or later) because otherwise
it can't handle the thousands of layers efficiently due to a bug.

For the contours we haven't figured out how to prevent those
irritating joins on the srtm tile boundary yet. They're not that
noticable. If you figure it out do let me  andy know  :-)

Thanks
Dave

[1] http://trac.mapnik.org/wiki/ManagingLargeXmlFiles
#
# Copyright David Stubbs  Andy Allan
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# 
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see http://www.gnu.org/licenses/.
#

from mapnik import *
from PIL import Image, ImageFilter
import glob, os

cleanup = True
shaded = False

y = 0
prj_str = +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 +nadgri...@null +no_defs +over
prj = Projection(prj_str)

storagedir = '/mnt/shape-resources/SRTM3_fix/tiffs/'

f = open('../osm-cycle/rasters.include', 'w')
for X in glob.glob(storagedir+'*/*.final.tif'):
  ew = int(X[-13:-10])
  if X[-14] == 'W':
ew = 0 - ew
  ns = int(X[-16:-14])
  if X[-17] == 'S':
ns = 0 - ns

  merc = prj.forward(Coord(ew, ns))
  lox = merc.x
  loy = merc.y
  merc = prj.forward(Coord(ew + 1, ns + 1))
  hix = merc.x
  hiy = merc.y


  f.write(Layer name=\raster+`y`+\ status=\on\\n)
  f.write(  StyleNameraster/StyleName\n)
  f.write(  Datasource\n)
  f.write(Parameter name=\type\raster/Parameter\n)
  f.write('Parameter name=file' + X + /Parameter\n)
  f.write(Parameter name=\format\tiff/Parameter\n)
  f.write('Parameter name=lox%s/Parameter' % lox)
  f.write('Parameter name=loy%s/Parameter' % loy)
  f.write('Parameter name=hix%s/Parameter' % hix)
  f.write('Parameter name=hiy%s/Parameter' % hiy)
  f.write(  /Datasource\n)
  f.write(/Layer\n)
  y = y + 1


f.close

___
talk mailing list
talk@openstreetmap.org
http://lists.openstreetmap.org/listinfo/talk