RasterSymbolizer problem with OSGB 1936 projection

View: New views
2 Messages — Rating Filter:   Alert me  

RasterSymbolizer problem with OSGB 1936 projection

by Adnan Khan-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello All,

I am wondering if anyone can help me with a small problem. I'm having
difficulties using rasters (in OSGB 1936 projection) with
RasterSymbolizer().

Images are correctly geocoded and display fine in Mapnik when
converted to Lat/lon proj system but I get blank images when I try to
use OSGB 1936 proj system.

I was having same problems with drawing ESPG:27700 projection data
from PostGIS tables some time ago.

I have attached the code and uploaded the sample geocoded image (link
http://www.box.net/shared/b8z5fsg1fq), will greatly appreciate any
help/suggestions on this matter.

Many Thanks,

Adnan

--
Regards,

Adnan Khan

#!/usr/bin/env python

from mapnik import *
osgb = '+proj=tmerc +lat_0=49 +lon_0=-2 +k=0.9996012717 +x_0=400000 +y_0=-100000 +ellps=airy +datum=OSGB36 +units=m +no_defs'


m = Map(400,400,osgb)

m.background = Color('white')
s = Style()
r=Rule()
rs = RasterSymbolizer()
r.symbols.append(rs)
s.rules.append(r)
m.append_style('My Style',s)
lyr = Layer('world')
lyr.datasource = Gdal(file='c:\\temp\\london-20k9.tif',format='Gtiff')
lyr.styles.append('My Style')
m.layers.append(lyr)

m.zoom_to_box(lyr.envelope())
render_to_file(m, 'c:\\temp\\test.png')
_______________________________________________
Mapnik-users mailing list
Mapnik-users@...
https://lists.berlios.de/mailman/listinfo/mapnik-users

Re: RasterSymbolizer problem with OSGB 1936 projection

by Dane Springmeyer :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello Adnan,

Note that Mapnik does not support re-projection of rasters. So you  
have to make sure to:

1) reproject/warp your TIFF to the OSGB srs first (I use 'gdalwarp'  
for this)
2) remember to set the layer.srs parameter to the OSGB proj4 string

I noticed that you are not doing this in your attached script, so  
you'd need something like:

lyr = Layer('world')
lyr.datasource = Gdal(file='c:\\temp\\london-20k9.tif')
lyr.srs = osgb

or

lyr.srs = m.srs

Dane


On Jun 15, 2009, at 6:40 AM, Adnan Khan wrote:

> Hello All,
>
> I am wondering if anyone can help me with a small problem. I'm having
> difficulties using rasters (in OSGB 1936 projection) with
> RasterSymbolizer().
>
> Images are correctly geocoded and display fine in Mapnik when
> converted to Lat/lon proj system but I get blank images when I try to
> use OSGB 1936 proj system.
>
> I was having same problems with drawing ESPG:27700 projection data
> from PostGIS tables some time ago.
>
> I have attached the code and uploaded the sample geocoded image (link
> http://www.box.net/shared/b8z5fsg1fq), will greatly appreciate any
> help/suggestions on this matter.
>
> Many Thanks,
>
> Adnan
>
> --
> Regards,
>
> Adnan Khan
> <test.py>_______________________________________________
> Mapnik-users mailing list
> Mapnik-users@...
> https://lists.berlios.de/mailman/listinfo/mapnik-users

_______________________________________________
Mapnik-users mailing list
Mapnik-users@...
https://lists.berlios.de/mailman/listinfo/mapnik-users