|
View:
New views
3 Messages
—
Rating Filter:
Alert me
|
|
|
Getting SQLite WorkingHi, I am running Mapnik 0.6.0 on Windows XP. My data is in a SQLite
(Spatialite) database file and it is a simple linestring. When I try to render it I get a blank map. There are no errors or warnings on the output. Here is my script: from mapnik import * m = Map(800,600,"+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs") m.background = Color('white') sqlite_lyr = Layer('SQLite') sqlite_lyr.srs = "+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs" sqlite_lyr.datasource = SQLite(file='main.db', table='tours', key_field='ROWID', geometry_field='the_geom', extent='-110.801,32.2257,-110.799,32.2263') sqlite_style = Style() sqlite_rule_on = Rule() sqlite_rule_on.symbols.append(PolygonSymbolizer(Color(250, 190, 183))) sqlite_style.rules.append(sqlite_rule_on) m.append_style('test style', sqlite_style) sqlite_lyr.styles.append('test style'); m.layers.append(sqlite_lyr) m.zoom_to_box(Envelope(-110.801,32.2257,-110.799,32.2263)) im = Image(m.width,m.height) render(m, im) im.save('demo.png', 'png') # true-colour RGBA save_map(m,"map.xml") If I then export my data as a shapefile from the database and render that instead, then it works. I swap the datasource line for this one: sqlite_lyr.datasource = Shapefile(file='./shapefile', encoding='latin1') Everything else stays the same. Can anyone please give me some hints as to what step I might be missing or where I should look for troubleshooting? Thanks, Andy -- Andy PGP Key ID: 0xDC1B5864 _______________________________________________ Mapnik-users mailing list Mapnik-users@... https://lists.berlios.de/mailman/listinfo/mapnik-users |
|
|
Re: Getting SQLite WorkingHey Andy,
It looks like you need to specify: <Parameter name="wkb_format">spatialite</Parameter> As I've noted at http://trac.mapnik.org/ticket/362#comment:2 Dane On Jun 16, 2009, at 8:52 AM, Andrew Ayre wrote: > Hi, I am running Mapnik 0.6.0 on Windows XP. My data is in a SQLite > (Spatialite) database file and it is a simple linestring. When I try > to > render it I get a blank map. There are no errors or warnings on the > output. Here is my script: > > from mapnik import * > m = Map(800,600,"+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs") > m.background = Color('white') > sqlite_lyr = Layer('SQLite') > sqlite_lyr.srs = "+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs" > sqlite_lyr.datasource = SQLite(file='main.db', table='tours', > key_field='ROWID', geometry_field='the_geom', > extent='-110.801,32.2257,-110.799,32.2263') > sqlite_style = Style() > sqlite_rule_on = Rule() > sqlite_rule_on.symbols.append(PolygonSymbolizer(Color(250, 190, 183))) > sqlite_style.rules.append(sqlite_rule_on) > m.append_style('test style', sqlite_style) > sqlite_lyr.styles.append('test style'); > m.layers.append(sqlite_lyr) > m.zoom_to_box(Envelope(-110.801,32.2257,-110.799,32.2263)) > im = Image(m.width,m.height) > render(m, im) > im.save('demo.png', 'png') # true-colour RGBA > save_map(m,"map.xml") > > If I then export my data as a shapefile from the database and render > that instead, then it works. I swap the datasource line for this one: > > sqlite_lyr.datasource = Shapefile(file='./shapefile', > encoding='latin1') > > Everything else stays the same. Can anyone please give me some hints > as > to what step I might be missing or where I should look for > troubleshooting? > > Thanks, Andy > > -- > Andy > PGP Key ID: 0xDC1B5864 > > _______________________________________________ > 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 |
|
|
Re: Getting SQLite WorkingYay! Works! So to confirm I now use:
sqlite_lyr.datasource = SQLite(file='./mapniktest.db', table='tours', key_field='ROWID', geometry_field='the_geom', wkb_format='spatialite', extent='-110.801,32.2257,-110.799,32.2263') Thanks for the FAST help with this! Andy Dane Springmeyer wrote: > Hey Andy, > > It looks like you need to specify: > > <Parameter name="wkb_format">spatialite</Parameter> > > As I've noted at http://trac.mapnik.org/ticket/362#comment:2 > > Dane -- Andy PGP Key ID: 0xDC1B5864 _______________________________________________ Mapnik-users mailing list Mapnik-users@... https://lists.berlios.de/mailman/listinfo/mapnik-users |
| Free embeddable forum powered by Nabble | Forum Help |