Hi,
it looks like the Python MapScript module is compiled against a different regex libary than the Python interpreter uses. The "premature end of script headers" is usually caused by a SIGSEGV where the script gets killed before being able to send any headers. I would suggest to build python-mapscript on your own. HTH -----Ursprüngliche Nachricht----- Von: mapserver-users-boun...@lists.osgeo.org [mailto:mapserver-users-boun...@lists.osgeo.org] Im Auftrag von Frank Broniewski Gesendet: Freitag, 11. Februar 2011 10:30 An: mapserver-users@lists.osgeo.org Betreff: Re: [mapserver-users] WMS SLD Troubles Ok, I've found a problem with the parsing of OWSRequest.setParameter() My code: ... elif request.method == 'GET': logging.debug("%s: Request method is GET" % datetime.datetime.now()) for key, value in request.args.items(): if key.lower() == 'sld': logging.debug("%s: Escaping %s" % (datetime.datetime.now(), key)) logging.debug("%s: Value is %s" % (datetime.datetime.now(), value)) value = urllib.quote_plus(value) g.ows_request.setParameter(key, value) if key.lower() == 'sld': value = g.ows_request.getValueByName(key) logging.debug("%s: Loaded Param %s" % (datetime.datetime.now(), value)) mapscript.msIO_installStdoutToBuffer() success = g.ows_map.OWSDispatch(g.ows_request) ... What I'm basically doing here is setting the request parameters with setParameter on the ows_reqeuest object. When there is _no_ sld parameter in the request, escaping is not necessary. Once there is a sld request parameter, mapscript crashes when doing setParameter('SLD', 'http://192.168.0.111:8502/sld/style.sld') [Fri Feb 11 11:10:32 2011] [error] [client 192.168.0.2] success = g.ows_map.OWSDispatch(g.ows_request) [Fri Feb 11 11:10:32 2011] [error] [client 192.168.0.2] File "/usr/lib/python2.5/site-packages/mapscript.py", line 1515, in OWSDispatch [Fri Feb 11 11:10:32 2011] [error] [client 192.168.0.2] def OWSDispatch(*args): return _mapscript.mapObj_OWSDispatch(*args) [Fri Feb 11 11:10:32 2011] [error] [client 192.168.0.2] MapServerError: msEvalRegex(): Regular expression error. String failed expression test. [Fri Feb 11 11:10:32 2011] [error] [client 192.168.0.2] msEvalRegex(): Regular expression error. String failed expression test. Using urllib.quote_plus I escaped the SLD URL back to a web representation and set it with setParameter. SLD=http%3A%2F%2F192.168.0.111%3A8502%2Fsld%2Fstyle.sld request.args: Key: SLD Value: http://192.168.0.111:8502/sld/style.sld Quoted Value: http%3A%2F%2F192.168.0.111%3A8502%2Fsld%2Fstyle.sld Loaded Param http%3A%2F%2F192.168.0.111%3A8502%2Fsld%2Fstyle.sld Unfortunately quoting does not help, but the error this time is less clear than the one before: [Fri Feb 11 11:11:51 2011] [error] [client 192.168.0.2] Premature end of script headers: gishosting.wsgi the mapserver error log (debug 5) shows also no entry, so I am completely clueless what's going wrong here. Does someone have a clue whats going on there? Datasource is a Postgis database (OpenStreetMap data) which works without the SLD parameter. System is a Ubuntu Hardy 8.04 with the deb http://ppa.launchpad.net/ubuntugis/ubuntugis-unstable/ubuntu hardy main deb-src http://ppa.launchpad.net/ubuntugis/ubuntugis-unstable/ubuntu hardy main sources /usr/lib/cgi-bin/mapserv -v MapServer version 5.6.6 OUTPUT=GIF OUTPUT=PNG OUTPUT=JPEG OUTPUT=WBMP OUTPUT=SWF OUTPUT=SVG SUPPORTS=PROJ SUPPORTS=AGG SUPPORTS=FREETYPE SUPPORTS=ICONV SUPPORTS=FRIBIDI SUPPORTS=WMS_SERVER SUPPORTS=WMS_CLIENT SUPPORTS=WFS_SERVER SUPPORTS=WFS_CLIENT SUPPORTS=WCS_SERVER SUPPORTS=SOS_SERVER SUPPORTS=FASTCGI SUPPORTS=THREADS SUPPORTS=GEOS SUPPORTS=RGBA_PNG INPUT=EPPL7 INPUT=POSTGIS INPUT=OGR INPUT=GDAL INPUT=SHAPEFILE dpkg -l ||/ Name Version Description +++-==============-==============-============================================ ii apache2 2.2.8-1ubuntu0 Next generation, scalable, extendable web se ii python-mapscri 5.6.6-2~hardy1 Python library for MapServer ii mapserver-bin 5.6.6-2~hardy1 MapServer utilities ii cgi-mapserver 5.6.6-2~hardy1 CGI executable for MapServer Python 2.5.2 (r252:60911, Jan 20 2010, 23:14:04) And self compiled libapache2-mod-wsgi Frank Am 10.02.2011 15:00, schrieb Frank Broniewski: > Ok, we've narrowed it down a bit. When we use the cgi-mapserver the SLD > styling works, so the issue seems to be with (python) mapscript ... > I will investigate further > > Frank > > > Am 09.02.2011 09:18, schrieb Frank Broniewski: >> Hello, >> >> thank you for your kind help :-) I've put the requested informations >> below. >> >> >> Frank >> >> >> INFO: >> >> we're using >> /usr/lib/cgi-bin/mapserv -v >> MapServer version 5.6.6 OUTPUT=GIF OUTPUT=PNG OUTPUT=JPEG OUTPUT=WBMP >> OUTPUT=SWF OUTPUT=SVG SUPPORTS=PROJ SUPPORTS=AGG SUPPORTS=FREETYPE >> SUPPORTS=ICONV SUPPORTS=FRIBIDI SUPPORTS=WMS_SERVER SUPPORTS=WMS_CLIENT >> SUPPORTS=WFS_SERVER SUPPORTS=WFS_CLIENT SUPPORTS=WCS_SERVER >> SUPPORTS=SOS_SERVER SUPPORTS=FASTCGI SUPPORTS=THREADS SUPPORTS=GEOS >> SUPPORTS=RGBA_PNG INPUT=EPPL7 INPUT=POSTGIS INPUT=OGR INPUT=GDAL >> INPUT=SHAPEFILE >> on Ubuntu 8.04 with the ubuntu-gis ppa. >> >> >> >> >> Original layer definition: >> >> LAYER >> NAME "post" >> STATUS Off >> CONNECTIONTYPE Postgis >> CONNECTION "host=localhost dbname=osm user= password= port=5432" >> DATA "nway FROM >> (SELECT way as nway, osm_id, amenity, name >> FROM planet_osm_point >> WHERE amenity='post_box' OR amenity='post_office' >> ) >> as foo using unique osm_id using SRID=900913" >> TYPE Point >> PROCESSING "CLOSE_CONNECTION=DEFER" >> CLASSITEM "amenity" >> DUMP true >> >> # --------------------------------------------------------------- >> # Projection configuration >> # --------------------------------------------------------------- >> INCLUDE "/usr/local/mapconf/share/projections/google.map" >> >> METADATA >> # lots of metadata .... >> END >> END >> >> >> >> >> >> >> the SLD: >> <NamedLayer> >> <Name>post</Name> >> <UserStyle> >> <Title>Post</Title> >> <FeatureTypeStyle> >> <Rule> >> <ogc:Filter> >> <ogc:PropertyIsEqualTo> >> <ogc:PropertyName>amenity</ogc:PropertyName> >> <ogc:Literal>post_box</ogc:Literal> >> </ogc:PropertyIsEqualTo> >> </ogc:Filter> >> <PointSymbolizer> >> <Graphic> >> <ExternalGraphic> >> <OnlineResource >> xlink:type="simple" >> >> xlink:href="http://192.168.0.111:8502/sld/img/briefkasten.png" /> >> <Format>image/png</Format> >> </ExternalGraphic> >> <Size>40</Size> >> </Graphic> >> </PointSymbolizer> >> </Rule> >> <Rule> >> <Filter> >> <PropertyIsEqualTo> >> <PropertyName>amenity</PropertyName> >> <Literal>post_office</Literal> >> </PropertyIsEqualTo> >> </Filter> >> <PointSymbolizer> >> <Graphic> >> <ExternalGraphic> >> <OnlineResource >> xlink:type="simple" >> >> xlink:href="http://192.168.0.111:8502/sld/img/posthorn.png" /> >> <Format>image/png</Format> >> </ExternalGraphic> >> <Size>40</Size> >> </Graphic> >> </PointSymbolizer> >> </Rule> >> </FeatureTypeStyle> >> </UserStyle> >> </NamedLayer> >> >> >> >> >> >> >> >> the generated map file: >> LAYER >> CLASSITEM "amenity" >> CONNECTION "host=localhost dbname=osm user= password= port=5432" >> CONNECTIONTYPE POSTGIS >> DATA "nway FROM >> (SELECT way as nway, osm_id, amenity, name >> FROM planet_osm_point >> WHERE amenity='post_box' >> OR amenity='post_office' >> ) >> as foo using unique osm_id using SRID=900913" >> DUMP TRUE >> METADATA >> # metadata >> END >> NAME "post" >> PROCESSING "CLOSE_CONNECTION=DEFER" >> PROJECTION >> "proj=merc" >> "a=6378137" >> "b=6378137" >> "lat_ts=0" >> "lon_0=0" >> "x_0=0" >> "y_0=0" >> "k=1" >> "nadgrids=@null" >> "units=m" >> "no_defs" >> END >> STATUS ON >> TYPE POINT >> UNITS METERS >> CLASS >> NAME "Unknown" >> EXPRESSION ("[amenity]" = "post_box") >> STYLE >> ANGLE 360 >> COLOR 0 0 0 >> SIZE 40 >> SYMBOL "http://192.168.0.111:8502/sld/img/briefkasten.png" >> WIDTH 1 >> END >> END >> END >> >> >> >> >> Am 08.02.2011 15:57, schrieb Yewondwossen Assefa: >>> What version of MapServer? >>> >>> Also, what is the part in the map file that is causing the problem: >>> * if you remove the EXPRESSION ("[amenity]" = "post_box") from the >>> generated map, will that work >>> * Is the layer's FILTER element set (on the generated map)? If so what >>> is the value? >>> >>> A full layer definition in the generated map would be useful. A full sld >>> might also help. >>> >>> regards, >>> >>> >>> On 07/02/2011 4:58 AM, Frank Broniewski wrote: >>>> Hello, >>>> >>>> We're using a OpenStreetMap Postgis database as a source for our >>>> geo-servers. We want to provide WMS and WFS services on the data. In >>>> order to do the styling only once, we are using SLDs, which works >>>> mostly fine. >>>> >>>> One of our layers does not render as a WMS, it throws a >>>> "msEvalRegex(): Regular expression error. String failed expression >>>> test." Error during execution. >>>> >>>> We identified the layer, and it's the one rendering post boxes. The >>>> corresponding SLD definition is using a filter: >>>> >>>> >>>> <Filter> >>>> <PropertyIsEqualTo> >>>> <PropertyName>amenity</PropertyName> >>>> <Literal>post_office</Literal> >>>> </PropertyIsEqualTo> >>>> </Filter> >>>> >>>> >>>> Using debug-level 5, the mapfile after SLD application looks like >>>> >>>> # ... >>>> # more definitions >>>> # ... >>>> CLASSITEM "amenity" >>>> DATA "nway FROM >>>> (SELECT way as nway, osm_id, amenity, name >>>> FROM planet_osm_point >>>> WHERE amenity='post_box' >>>> OR amenity='post_office' >>>> ) >>>> as foo using unique osm_id using SRID=900913" >>>> # ... >>>> # more definitions >>>> # ... >>>> CLASS >>>> NAME "Unknown" >>>> EXPRESSION ("[amenity]" = "post_box") >>>> STYLE >>>> ANGLE 360 >>>> COLOR 0 0 0 >>>> SIZE 40 >>>> SYMBOL "http://192.168.0.111:8502/sld/img/briefkasten.png" >>>> WIDTH 1 >>>> END >>>> END >>>> >>>> >>>> We simply can't figure out, what might be the problem here. The whole >>>> issue seem to be related to the filter element, removing it makes the >>>> layer render. Using the generated map layer, rendering fails with the >>>> same error. >>>> So I would be happy if someone with more experience with SLDs can give >>>> me a hint about whats going wrong here. >>>> >>>> >>>> Frank >>>> >>>> >>>> >>> >>> >> >> > > -- Frank BRONIEWSKI METRICO s.à r.l. géomètres technologies d'information géographique rue des Romains 36 L-5433 NIEDERDONVEN tél.: +352 26 74 94 - 28 fax.: +352 26 74 94 99 http://www.metrico.lu _______________________________________________ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users _______________________________________________ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users