Hi All, I'm looking at projections now: I'm trying to use osm.xml for WMS script to display osm-like map via WMS requests, This is how I'm doing it: 1. Add Map object to my WMSFactory: 2. load_map(m,'osm.xml') 3. copy all styles and layers from m into wmsfactory, using register_style and .register_layer methods.
i'm getting empty png on output, but, I believe, this is all around projections, defined in osm.xml: "+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 [EMAIL PROTECTED] +no_defs +over" I'm replacing it for layer.src="+init=epsg:3395" to register layers properly in wmsfactory. This is wrong(but let me check, if python script works, etc), but I don't know how to generate right espg projection from one I have. I'd like to describe this on page, Leslie just created - to let other users go though projections much easier - but first, I have learn them ;) If someone has ideas, or some docs - it would be great. -- RO 2008/8/30 Dane Springmeyer <[EMAIL PROTECTED]>: > Hi Leslie, > Thanks for adding the page, I think thats a great idea. I've been working > with projections for a long time, errr... at least long enough that I am > able to confuse most people I try to help! > Oleg, have you made any progess? Figuring out the projection of your data > and then making sure to add the epsg code to you ogcserver.conf is all you > should need to do, then you can test the new url query string. > An example config with some code to turn on EPSG 3395 can be found here: > http://mapnik-utils.googlecode.com/svn/trunk/tutorials/wms/ > Cheers, > Dane > > > > > On Aug 29, 2008, at 1:30 PM, Leslie Wu wrote: > > I guess we could add some background GIS / info links to the Mapnik wiki. > I've been learning about projections myself recently. > Perhaps a proj.4 reference and a guide such as this? > http://www.manifold.net/doc/guide_to_selecting_map_projections.htm > I started a brief introduction to GIS page here: > http://trac.mapnik.org/wiki/IntroductionToGIS > > Please contribute :) > ~L > > On Fri, Aug 29, 2008 at 12:41 AM, Oleg Shaniuk <[EMAIL PROTECTED]> wrote: >> >> Hi Dane, >> >> Thanks for tip! It's really about projections. Looks like, time to >> learn more about geospatial systems. >> Also, as you might guess already, [>>> from mapnik.ogcserver import >> common] works well ;) >> >> Regards, >> Oleg >> >> 2008/8/28 Dane Springmeyer <[EMAIL PROTECTED]>: >> > Oleg, >> > >> > If you rebuild mapnik with the debug=y Scons flag, mapnik should output >> > a >> > variety of information to your apache logs such at the extent of the >> > data >> > and the map, and how many features are processed given the bounding box. >> > >> > I think if you do this what you will see is that no features are being >> > processed since they are not falling within the WMS query BBOX you are >> > testing. >> > >> > I think you must have downloaded that world_boundaries_m.shp from OSM? >> > If I >> > run ogrinfo on that shapefile I get: >> > >> > $ ogrinfo world_boundaries_m.shp -so -al >> > INFO: Open of `world_boundaries_m.shp' >> > using driver `ESRI Shapefile' successful. >> > >> > Layer name: world_boundaries_m >> > Geometry: Polygon >> > Feature Count: 3807 >> > Extent: (-20037400.000000, -19929239.110000) - (20037400.000000, >> > 18375854.709643) >> > Layer SRS WKT: >> > PROJCS["Mercator", >> > GEOGCS["GCS_WGS_1984", >> > DATUM["WGS_1984", >> > SPHEROID["WGS_1984",6378137,298.257223563]], >> > PRIMEM["Greenwich",0], >> > UNIT["Degree",0.017453292519943295]], >> > PROJECTION["Mercator_1SP"], >> > PARAMETER["latitude_of_origin",0], >> > PARAMETER["central_meridian",0], >> > PARAMETER["scale_factor",1], >> > PARAMETER["false_easting",0], >> > PARAMETER["false_northing",0], >> > UNIT["Meter",1]] >> > CAT: Real (16.0) >> > FIPS_CNTRY: String (80.0) >> > CNTRY_NAME: String (80.0) >> > >> > >> > It seems like for your testing script you will need a shapefile in true >> > unprojected WGS 84(EPSG:4326) coordinates, like the one here: >> > http://mapnik-utils.googlecode.com/svn/trunk/sample_data/ >> > >> > Otherwise you will need to modify your script >> > >> > such that this line: >> > >> >>>> lyr = Layer('world', '+init=epsg:4326') >> > >> > >> > becomes: >> > >> > lyr = Layer('world', '+init=epsg:3395') >> > >> > >> > Which will allow the WMS server to reproject your data. So, using the >> > same >> > query string you should get back a map in EPSG:4326. >> > >> > If you then want to get map tiles in mercator you'll need to add a line >> > to >> > your ogcserver.conf like: >> > >> > allowedepsgcodes=4326,3395, # trailing comma is essential >> > >> > and then test a WMS query string with a >> > bbox=-20037400.000000,-19929239.110000, 20037400.000000,18375854.709643 >> > and >> > EPSG=3395 >> > >> > something more like: >> > >> > >> > http://localhost/fcgi-bin/wms?LAYERS=world&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&EXCEPTIONS=application%2Fvnd.ogc.se_inimage&FORMAT=image%2Fpng&SRS=EPSG%3A3395&BBOX=-20037400.000000,-19929239.110000,%2020037400.000000,18375854.709643&WIDTH=256&HEIGHT=256 >> > >> > >> > Dane >> > >> > >> > On Aug 28, 2008, at 7:53 AM, Oleg Shaniuk wrote: >> > >> >> Hi Dane, >> >> >> >> I've checked log, even tried to run apache in debug mode with maximum >> >> verbose level (debug), but there is just nothing in log. When I set >> >> incorrect coastline file name, I've got an exception; so, it has >> >> access to file (I've checked rights for double-sure) >> >> My system is ubuntu 8.04, apache2 ( 2.2.8 ubuntu ). Mapnik works well. >> >> The confusing thing is white color - seems, it just render empty map, >> >> without any styles at all... >> >> >> >> which reasons at all can cause such behavior? >> >> >> >> Regards, >> >> Oleg >> >> >> >> 2008/8/28 Dane Springmeyer <[EMAIL PROTECTED]>: >> >>> >> >>> Hi Oleg, >> >>> >> >>> Your test configuration, including that URL, looks fine. >> >>> >> >>> My guess is that your apache user may not have read permissions for >> >>> '/var/mapnik/world_boundaries/world_boundaries_m' >> >>> Check your apache logs and if this is the case you'll likely see the >> >>> mapnik >> >>> output of 'got exception...' >> >>> Or perhaps the Mapnik WMS code is failing for some other reason, and >> >>> the >> >>> apache error logs should give you an idea. If you find anything you >> >>> don't >> >>> understand, paste a snippet back to the list. >> >>> >> >>> Also, what system are you running? >> >>> >> >>> Cheers, >> >>> >> >>> Dane >> >>> >> >>> On Aug 28, 2008, at 7:10 AM, Oleg Shaniuk wrote: >> >>> >> >>>> Hi All, >> >>>> >> >>>> I'm playing with mapnik's WMS features. And I'm getting empty image >> >>>> in >> >>>> browser. The interesting thing, if I use the same style and layer, >> >>>> but >> >>>> with Map object and render image in python script - it works correct. >> >>>> >> >>>> Fot the request: >> >>>> >> >>>> >> >>>> >> >>>> http://localhost/fcgi-bin/wms?VERSION=1.1.1&REQUEST=GetMap&LAYERS=world&FORMAT=image/png&SRS=EPSG:4326&STYLES=&&BBOX=-179,-83,179,83&EXCEPTIONS=application/vnd.ogc.se_inimage&width=600&height=300 >> >>>> >> >>>> I'm getting empty white picture 600x300pix. >> >>>> >> >>>> using mapnik 5.1.0 >> >>>> >> >>>> My scripts/config: >> >>>> >> >>>> ######## wms python script for fcgi ######### >> >>>> #!/usr/bin/python >> >>>> >> >>>> from mapnik.ogcserver.cgiserver import Handler >> >>>> import jon.fcgi as fcgi >> >>>> >> >>>> import sys >> >>>> sys.path.append('/var/mapnik') >> >>>> >> >>>> class WMSHandler(Handler): >> >>>> configpath = '/var/mapnik/ogcserver.conf' >> >>>> >> >>>> fcgi.Server({fcgi.FCGI_RESPONDER: WMSHandler}).run() >> >>>> >> >>>> ######## ogcserver.config ############### >> >>>> >> >>>> # unchanged, except >> >>>> >> >>>> module=worldMapFactory >> >>>> >> >>>> ######## worldMapFactory.py ############# >> >>>> >> >>>> #!/usr/bin/python >> >>>> >> >>>> from mapnik.ogcserver.WMS import BaseWMSFactory >> >>>> from mapnik import * >> >>>> >> >>>> class WMSFactory(BaseWMSFactory): >> >>>> def __init__(self): >> >>>> BaseWMSFactory.__init__(self) >> >>>> sty = Style() >> >>>> rl = Rule() >> >>>> rl.symbols.append(PolygonSymbolizer(Color('#f2eff9'))) >> >>>> rl.symbols.append(LineSymbolizer(Color('steelblue'),.1)) >> >>>> sty.rules.append( rl ) >> >>>> self.register_style('style1', sty) >> >>>> lyr = Layer('world', '+init=epsg:4326') >> >>>> >> >>>> lyr.title = 'World' >> >>>> lyr.abstract = 'World Test' >> >>>> lyr.queryable = True >> >>>> lyr.datasource = >> >>>> Shapefile(file='/var/mapnik/world_boundaries/world_boundaries_m') >> >>>> self.register_layer(lyr,'style1') >> >>>> self.finalize() >> >>>> >> >>>> >> >>>> # simple test script (works just fine): >> >>>> ######## mapnikTest.py ########### >> >>>> >> >>>> from mapnik import * >> >>>> >> >>>> m = Map(600,300) >> >>>> m.background = Color('steelblue') >> >>>> >> >>>> sty = Style() >> >>>> rl = Rule() >> >>>> >> >>>> rl.symbols.append(PolygonSymbolizer(Color('#f2eff9'))) >> >>>> rl.symbols.append(LineSymbolizer(Color('steelblue'),.1)) >> >>>> >> >>>> sty.rules.append( rl ) >> >>>> >> >>>> m.append_style('My Style',sty) >> >>>> >> >>>> lyr = Layer('world', '+init=epsg:4326') >> >>>> >> >>>> lyr.title = 'World Borders' >> >>>> lyr.abstract = 'World Test' >> >>>> lyr.queryable = True >> >>>> lyr.datasource = >> >>>> Shapefile(file='/var/mapnik/world_boundaries/world_boundaries_m') >> >>>> lyr.styles.append('My Style') >> >>>> >> >>>> m.layers.append(lyr) >> >>>> >> >>>> m.zoom_to_box(lyr.envelope()) >> >>>> render_to_file(m, 'hello_world_in_pure_python.png') >> >>>> _______________________________________________ >> >>>> Mapnik-devel mailing list >> >>>> [EMAIL PROTECTED] >> >>>> https://lists.berlios.de/mailman/listinfo/mapnik-devel >> >>> >> >>> >> > >> > >> _______________________________________________ >> Mapnik-devel mailing list >> [EMAIL PROTECTED] >> https://lists.berlios.de/mailman/listinfo/mapnik-devel > > > _______________________________________________ Mapnik-users mailing list [email protected] https://lists.berlios.de/mailman/listinfo/mapnik-users

