Thanks for the answer Dane. I'm using exactly the same source as the tutorial population.xml file (XMLGettingStarted) has. When I execute the python file world_population.py (also on the tutorial website --> see link in the frist message). I get the same map as the tutorial shows. But if I use this Openlayers code below or any other hardcoded WMS request in the browser, I just get a blank image or rather nothing. If I remove all filter entities (as well as the <elsefilter/> entity !) my map is drawn via WMS or rather Openlayers but it's only darkred because the last polygon filler has defined color darkred and I have a lot of country names shown on the map. Also I should tell you that I'm using the "xml_factory.py" (see code below too) to load the XML files. Here's the complete openlayers html file (the first layer variable is commented out and is the the example I've created):
Openlayers html file -------------------------------------------------------------- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>Mapnik WMS Test</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <style type="text/css"> html, body { height: 100%; } body {margin: 0px;} #map { width: 100%; height: 100%; } </style> <script src="lib/OpenLayers.js"></script> <script type="text/javascript"> var map; function init(){ var map_options = { numZoomLevels: 27, maxResolution: 1.6,projection: "EPSG:4326"}; map = new OpenLayers.Map('map'); //var mapnik = new OpenLayers.Layer.WMS("mapnik","http://localhost/cgi-bin/mapserv?map=/srv/www/cgi-bin/data/oerok_agg2.map",{layers: ['land_grenzen01','layer_mapany_080305_3ba6226287c1622', 'bezirk_grenzen_01', 'land_grenzen01','staat01','fluss01', 'stadt01'],'format':'image/png'},{isBaseLayer:true, reroject: true}); var wms = new OpenLayers.Layer.WMS("Mapnik WMS","http://localhost/cgi-bin/mapnikwms.py?", {layers:'countries', format:'image/png'} ); map.addLayers([wms]); map.zoomToMaxExtent(); } </script> </head> <body onload="init()"> <h2 style="position:absolute; z-index:10000; left: 100px;">Mapnik WMS Test</h2> <div id="map"> </div> </body> </html> --------------------------------------------- xml factory python class: from mapnik.ogcserver.WMS import BaseWMSFactory # note, this class for loading an xml map requires patch from http://trac.mapnik.org/ticket/129 class WMSFactory(BaseWMSFactory): def __init__(self): BaseWMSFactory.__init__(self) self.loadXML('population.xml') self.finalize() ---------------------------------------------- Concerning my second example where I get the data from a pgsql/postgis database: Yes the "value" variable is defined in the datasource table pgsql query in the layer entity (see the "as value" string at the end of the query code snippet). select the_geom from (select gd_poly_003.the_geom,gd_poly_003.id as id, td_dim_geom.name as name, gd_poly_003 .oid ,sum(cal_layer_0_katz5d5495cc2ba6236d214fe0d5e8ad354f.value::float/ cal_layer_1_katzb201d59b428fc2b1bff23d3679a2e982.value::float) as value ... Thanks for any help ;)! Martin -------- Original-Nachricht -------- > Datum: Mon, 23 Mar 2009 11:11:26 -0700 > Von: Dane Springmeyer <[email protected]> > An: "tschobber tschöbbi" <[email protected]> > Betreff: Re: [Mapnik-users] XML filters + WMS is not working? > Martin, > > Keep in mind that the name of the field you filter on is case > sensitive. So for shapefiles it is usually ALLCAPS and for postgres > fields all undercase. http://trac.mapnik.org/ticket/119 > > Also, it is very difficult to know how to help because you have not > provided your WMS query string, nor a public url to view your map, nor > a sense of what you have changed in the 'population.xml' such that it > now does not work. > > Is [value] the actual name of your field or a placeholder for something? > > Also, you should try using an ELSEFILTER - that will catch all data > records that are not correctly filtered and hint at your error. > > Dane > > > On Mar 23, 2009, at 2:53 AM, tschobber tschöbbi wrote: > > > Hi user list ;), > > > > I have the following problem: I want to retrieve data from a postgis > > database and then I want to make a WMS request with a xml file but > > the filters are just ignored or something like that. I've already > > tried the example population.xml > (http://trac.mapnik.org/wiki/XMLGettingStarted > > ) but this one isn't working too --> the map just stays blank. If I > > remove the filters in population.xml the map is generated but not > > correctly. > > > > My second problem is if I try to generate the map alternatively with > > "nik2img.py" the filters arent working for my example but for the > > population.xml example they are working. Why? I use the same pgsql > > queries as the equivalent Mapserver example (this one is working) > > and the name of my filter variable ([value]) should be correct too > > (see pgsql query snippet below): > > > > > > query: > > > > select the_geom from (select gd_poly_003.the_geom,gd_poly_003.id as > > id, td_dim_geom.name as name, > > gd_poly_003 > > .oid > > ,sum(cal_layer_0_katz5d5495cc2ba6236d214fe0d5e8ad354f.value::float/ > > cal_layer_1_katzb201d59b428fc2b1bff23d3679a2e982.value::float) as > > [b]value[/b] ... > > > > And here's an example how all my filters are declared ( the values > > range from 0 to infinity): > > > > <Rule> > > <Filter>[value] > 500 and [value] < 1000</Filter> > > <PolygonSymbolizer> > > <CssParameter name="fill">#ef6548</CssParameter> > > </PolygonSymbolizer> > > </Rule> > > > > And this shows how the above code snippet is implemented in > > Mapserver map file: > > > > CLASS > > NAME "> 500 - 1.000" > > EXPRESSION ([value] >= 500 and [value] < 1000) > > METADATA > > END > > STYLE > > ANGLE 360 > > COLOR 239 101 72 > > SYMBOL 0 > > END > > TEMPLATE "xxx" > > END > > > > Hope you could help me. > > > > Thanks + best regards, > > > > Martin > > > > > > -- > > Aufgepasst: Sind Ihre Daten beim Online-Banking auch optimal > > geschützt? > > Jetzt absichern: https://homebanking.gmx.net/[email protected] > > _______________________________________________ > > Mapnik-users mailing list > > [email protected] > > https://lists.berlios.de/mailman/listinfo/mapnik-users -- Aufgepasst: Sind Ihre Daten beim Online-Banking auch optimal geschützt? Jetzt absichern: https://homebanking.gmx.net/[email protected] _______________________________________________ Mapnik-users mailing list [email protected] https://lists.berlios.de/mailman/listinfo/mapnik-users

