Re: [MapServer-users] Python MapScript - GEOS
Thanks Seth, You are correct. Buffer works and changing the verification line solved the problem. Many thanks for your help Nicol Am Donnerstag, dem 23.11.2023 um 20:08 +0100 schrieb Seth G: > Hi, > > Testing the code here and the following line: shpObjBuffer = > shpObj.buffer( 0.0005 ) returns a valid buffered polygon: > > > > > shpObjBuffer > 0x02740979FEA0> > > > > > shpObjBuffer.toWKT() > 'POLYGON ((49.965857800020 8.16013072, 49 > > The buffer method [1] rerturns a new shape, so I'm not sure your > check for a True value makes sense in this line: > > > > > > if shpObjBuffer == mapscript.MS_SUCCESS: > > Are you sure the buffer isn't working? > > Seth > > [1] > https://mapserver.org/mapscript/mapscript-api/stub/mapscript.shapeObj.html#mapscript.shapeObj.buffer > > -- > web:https://geographika.net ; https://mapserverstudio.net > twitter: @geographika > > On Thu, Nov 23, 2023, at 7:16 PM, Nicol Hermann via MapServer-users > wrote: > > Hello all, > > > > it there a way to verify that GEOS Support is properly working with > > Python mapscript. > > The below buffer method fails but the msGetVersion claims > > 'SUPPORTS=GEOS'. Anything else im overlooking? > > > > > > Python 3.9.2 (default, Feb 28 2021, 17:03:44) > > [GCC 10.2.1 20210110] on linux > > Type "help", "copyright", "credits" or "license" for more > > information. > > > > > import mapscript > > > > > pktObj= mapscript.pointObj( 49.9653578, 8.1601308, 100 ) > > > > > shpObj= pktObj.toShape() > > > > > shpObjBuffer= shpObj.buffer( 0.0005 ) > > > > > if shpObjBuffer == mapscript.MS_SUCCESS: > > ... rectObj = shpObjBuffer['bounds'] > > ... print( rectObj ) > > ... else: > > ... print('Error') > > ... > > Error > > > > > print(mapscript.msGetVersion()) > > MapServer version 8.0.1 PROJ version 7.2 GDAL version 3.2 > > OUTPUT=PNG > > OUTPUT=JPEG SUPPORTS=PROJ SUPPORTS=AGG SUPPORTS=FREETYPE > > SUPPORTS=WMS_SERVER SUPPORTS=WMS_CLIENT SUPPORTS=WFS_SERVER > > SUPPORTS=WFS_CLIENT SUPPORTS=WCS_SERVER SUPPORTS=SOS_SERVER > > SUPPORTS=OGCAPI_SERVER SUPPORTS=GEOS INPUT=JPEG INPUT=POSTGIS > > INPUT=OGR > > INPUT=GDAL INPUT=SHAPEFILE INPUT=FLATGEOBUF > > > > > > Thanks for any help > > > > Nicol > > > > > > > > ___ > > MapServer-users mailing list > > MapServer-users@lists.osgeo.org > > https://lists.osgeo.org/mailman/listinfo/mapserver-users ___ MapServer-users mailing list MapServer-users@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [MapServer-users] Python MapScript - GEOS
Hi, Testing the code here and the following line: shpObjBuffer = shpObj.buffer( 0.0005 ) returns a valid buffered polygon: >>> shpObjBuffer > >>> shpObjBuffer.toWKT() 'POLYGON ((49.965857800020 8.16013072, 49 The buffer method [1] rerturns a new shape, so I'm not sure your check for a True value makes sense in this line: if shpObjBuffer == mapscript.MS_SUCCESS: Are you sure the buffer isn't working? Seth [1] https://mapserver.org/mapscript/mapscript-api/stub/mapscript.shapeObj.html#mapscript.shapeObj.buffer -- web:https://geographika.net & https://mapserverstudio.net twitter: @geographika On Thu, Nov 23, 2023, at 7:16 PM, Nicol Hermann via MapServer-users wrote: > Hello all, > > it there a way to verify that GEOS Support is properly working with > Python mapscript. > The below buffer method fails but the msGetVersion claims > 'SUPPORTS=GEOS'. Anything else im overlooking? > > > Python 3.9.2 (default, Feb 28 2021, 17:03:44) > [GCC 10.2.1 20210110] on linux > Type "help", "copyright", "credits" or "license" for more information. import mapscript pktObj= mapscript.pointObj( 49.9653578, 8.1601308, 100 ) shpObj= pktObj.toShape() shpObjBuffer= shpObj.buffer( 0.0005 ) if shpObjBuffer == mapscript.MS_SUCCESS: > ...rectObj = shpObjBuffer['bounds'] > ...print( rectObj ) > ... else: > ...print('Error') > ... > Error print(mapscript.msGetVersion()) > MapServer version 8.0.1 PROJ version 7.2 GDAL version 3.2 OUTPUT=PNG > OUTPUT=JPEG SUPPORTS=PROJ SUPPORTS=AGG SUPPORTS=FREETYPE > SUPPORTS=WMS_SERVER SUPPORTS=WMS_CLIENT SUPPORTS=WFS_SERVER > SUPPORTS=WFS_CLIENT SUPPORTS=WCS_SERVER SUPPORTS=SOS_SERVER > SUPPORTS=OGCAPI_SERVER SUPPORTS=GEOS INPUT=JPEG INPUT=POSTGIS INPUT=OGR > INPUT=GDAL INPUT=SHAPEFILE INPUT=FLATGEOBUF > > > Thanks for any help > > Nicol > > > > ___ > MapServer-users mailing list > MapServer-users@lists.osgeo.org > https://lists.osgeo.org/mailman/listinfo/mapserver-users ___ MapServer-users mailing list MapServer-users@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/mapserver-users
[MapServer-users] Python MapScript - GEOS
Hello all, it there a way to verify that GEOS Support is properly working with Python mapscript. The below buffer method fails but the msGetVersion claims 'SUPPORTS=GEOS'. Anything else im overlooking? Python 3.9.2 (default, Feb 28 2021, 17:03:44) [GCC 10.2.1 20210110] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import mapscript >>> pktObj= mapscript.pointObj( 49.9653578, 8.1601308, 100 ) >>> shpObj= pktObj.toShape() >>> shpObjBuffer= shpObj.buffer( 0.0005 ) >>> if shpObjBuffer == mapscript.MS_SUCCESS: ...rectObj = shpObjBuffer['bounds'] ...print( rectObj ) ... else: ...print('Error') ... Error >>> print(mapscript.msGetVersion()) MapServer version 8.0.1 PROJ version 7.2 GDAL version 3.2 OUTPUT=PNG OUTPUT=JPEG SUPPORTS=PROJ SUPPORTS=AGG SUPPORTS=FREETYPE SUPPORTS=WMS_SERVER SUPPORTS=WMS_CLIENT SUPPORTS=WFS_SERVER SUPPORTS=WFS_CLIENT SUPPORTS=WCS_SERVER SUPPORTS=SOS_SERVER SUPPORTS=OGCAPI_SERVER SUPPORTS=GEOS INPUT=JPEG INPUT=POSTGIS INPUT=OGR INPUT=GDAL INPUT=SHAPEFILE INPUT=FLATGEOBUF Thanks for any help Nicol ___ MapServer-users mailing list MapServer-users@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/mapserver-users
[mapserver-users] Python MapScript 7.2.2 available on PyPI
Hi all, Python MapScript bindings are now available at https://pypi.org/project/mapscript/ for the MapServer 7.2.2 release. Wheels have been created for 64-bit versions of Python 2.7 and Python 3.7 for Windows. They have been tested against the release-1911-x64-gdal-2-4-0-mapserver-7-2-2 binaries available at https://www.gisinternals.com/release.php Seth -- web:http://geographika.co.uk twitter: @geographika ___ mapserver-users mailing list mapserver-users@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] Python MapScript Notebook
Hi, I think I copied a session URL rather than the notebook one. The following hopefully works: https://mybinder.org/v2/gh/geographika/OSGeoLive12-Notebooks/master?filepath=jupyter%2Fquickstarts%2Fmapscript-quickstart.ipynb Repository: https://github.com/geographika/OSGeoLive12-Notebooks Path to notebook file: jupyter/quickstarts/mapscript-quickstart.ipynb Regards, Seth -- web:http://geographika.co.uk twitter: @geographika On Wed, Nov 7, 2018, at 1:56 PM, Leroux, Alexandre (EC) wrote: > Hi Seth, > Thanks for the notebook, however, I can't seem to be able to access > it, I get a 404. Full error message:> Oops! > We can't seem to find the Binder page you are looking for. > 404 error > Here are some helpful tips. > > Is this a Binder that you created? > Your Binder stopped due to an error or it was removed due to age or > inactivity.> Return to the Binder home page[1] to retry creating your Binder. > Did someone give you this Binder link? > > If so, the link is outdated or incorrect. Recheck the link for typos > or ask the person who gave you the link for an updated link. A > shareable Binder link should look like https://mybinder.org/v2/gh/> > Binder home page[2] > Alexandre Leroux, M.Sc., ing. Senior geospatial specialist / > Spécialiste principal en géomatique Data, Performance and Standards > Section / Section des Données, performance et standards Meteorological > Service of Canada / Service météorologique du Canada Environment and > Climate Change Canada / Environnement et Changement climatique Canada > alexandre.ler...@canada.ca - (514) 421-5024> On 11/07/2018 09:48 AM, Seth G > wrote: >> Hi list, I've completed a Jupyter notebook demonstrating the Python >> MapScript functionality. A notebook is an interactive document that >> allows code samples to be run and edited. A project called mybinder >> allows notebooks to be published and hosted online - the MapScript >> notebook can be found at: >> https://hub.mybinder.org/user/geographika-osg-ive12-notebooks-ptgaaead/notebooks/jupyter/quickstarts/mapscript-quickstart.ipynb >> Source code for the notebook is at >> https://github.com/geographika/OSGeoLive12-Notebooks/tree/master/jupyter/quickstarts >> - I'm hoping to get this added to the next OSGeoLive release. Any >> feedback or comments welcome, Regards, Seth -- web: >> http://geographika.co.uk twitter: @geographika >> ___ mapserver-users >> mailing list mapserver-users@lists.osgeo.org >> https://lists.osgeo.org/mailman/listinfo/mapserver-users Links: 1. https://mybinder.org 2. https://mybinder.org ___ mapserver-users mailing list mapserver-users@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/mapserver-users
[mapserver-users] Python MapScript Notebook
Hi list, I've completed a Jupyter notebook demonstrating the Python MapScript functionality. A notebook is an interactive document that allows code samples to be run and edited. A project called mybinder allows notebooks to be published and hosted online - the MapScript notebook can be found at: https://hub.mybinder.org/user/geographika-osg-ive12-notebooks-ptgaaead/notebooks/jupyter/quickstarts/mapscript-quickstart.ipynb Source code for the notebook is at https://github.com/geographika/OSGeoLive12-Notebooks/tree/master/jupyter/quickstarts - I'm hoping to get this added to the next OSGeoLive release. Any feedback or comments welcome, Regards, Seth -- web:http://geographika.co.uk twitter: @geographika ___ mapserver-users mailing list mapserver-users@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] Python MapScript updating map.web.metadata
>From: Even Rouault [mailto:even.roua...@spatialys.com] >Sent: 17 November 2017 06:09 >To: mapserver-users@lists.osgeo.org >Cc: Kralidis, Tom (EC) >Subject: Re: [mapserver-users] Python MapScript updating map.web.metadata > >On vendredi 10 novembre 2017 20:54:09 CET Kralidis, Tom (EC) wrote: >> Hi all: our (OWS) application (via Python MapScript/mod_wsgi) is provided >> as both HTTP and HTTPS, and our mapfile's >> map.web.metadata.ows_onlineresource is set to 'http://example.org/ows', for >> example. >> >> We would like to update map.web.metadata.ows_onlineresource at request >> time (by checking 'wsgi.url_scheme') so that when a user does a >> GetCapabilities request the Capabilities XML provided emits the appropriate >> URL based on the request. >> >> I see in the MapScript Python API that map.web is immutable? Are there >> other potential approaches? >> > > Tom, > > digging into mapscript/swiginc/map.i, I found : > mapfile.setMetaData('ows_onlineresource', 'https://example.org') > > Seems to work from a quick test > Thanks, confirmed, and in [1]. Didn't even think to look at mapObj to operate on webObj. Cheers ..Tom [1] http://mapserver.org/mapscript/mapscript.html#mapobj-methods > ___ mapserver-users mailing list mapserver-users@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] Python MapScript updating map.web.metadata
On vendredi 10 novembre 2017 20:54:09 CET Kralidis, Tom (EC) wrote: > Hi all: our (OWS) application (via Python MapScript/mod_wsgi) is provided > as both HTTP and HTTPS, and our mapfile's > map.web.metadata.ows_onlineresource is set to 'http://example.org/ows', for > example. > > We would like to update map.web.metadata.ows_onlineresource at request > time (by checking 'wsgi.url_scheme') so that when a user does a > GetCapabilities request the Capabilities XML provided emits the appropriate > URL based on the request. > > I see in the MapScript Python API that map.web is immutable? Are there > other potential approaches? > Tom, digging into mapscript/swiginc/map.i, I found : mapfile.setMetaData('ows_onlineresource', 'https://example.org') Seems to work from a quick test Evn -- Spatialys - Geospatial professional services http://www.spatialys.com ___ mapserver-users mailing list mapserver-users@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/mapserver-users
[mapserver-users] Python MapScript updating map.web.metadata
Hi all: our (OWS) application (via Python MapScript/mod_wsgi) is provided as both HTTP and HTTPS, and our mapfile's map.web.metadata.ows_onlineresource is set to 'http://example.org/ows', for example. We would like to update map.web.metadata.ows_onlineresource at request time (by checking 'wsgi.url_scheme') so that when a user does a GetCapabilities request the Capabilities XML provided emits the appropriate URL based on the request. I see in the MapScript Python API that map.web is immutable? Are there other potential approaches? Thanks ..Tom ___ mapserver-users mailing list mapserver-users@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] Python MapScript via WSGI examples
Thanks for the feedback Jeff. Comments interleaved: > -Original Message- > From: mapserver-users [mailto:mapserver-users-boun...@lists.osgeo.org] On > Behalf Of Jeff McKenna > Sent: 15 July 2016 17:56 > To: mapserver-users@lists.osgeo.org > Subject: Re: [mapserver-users] Python MapScript via WSGI examples > > On 2016-07-15 6:46 PM, Jeff McKenna wrote: > > Hi Tom, > > > > I believe I have your test working here, on Windows with mod_wsgi, > > Python 3.5.1, and MapScript7. Googling your error I believe your > > header problem occurs just for Python2 responses (maybe both Julien > > and I are using Python3 ?) We're bound to Python 2 (2.7.6) in this case. To refresh, see example in https://gist.github.com/tomkralidis/9adbd4864c03647aa7eb4f96a3c33297 > > What happens if you try to force the > > content-type to > > utf8 ? Change line#40 to: > > > > start_response('200 OK', [('Content-type', 'text/html; > > charset=utf-8')]) > > > > Just a guess as I have Python3. A try anyway... > > For some reason it looks like for a GetMap request, the line: content_type = mapscript.msIO_stripStdoutBufferContentType() results in None, i.e. the headers do not get stripped from the output? This is the case for either running the script directly as a process or embedding within Apache (https://gist.github.com/tomkralidis/9adbd4864c03647aa7eb4f96a3c33297#file-apache-conf) ..Tom > > Or maybe the output should be bytes, as: > >start_response('200 OK', [('Content-type', 'application/octet-stream; > charset=utf-8')]) > This results in an immediate prompt to download the result, which is a broken PNG image with the HTTP response headers still intact, i.e.: Cache-Control: max-age=86400 Content-Type: image/png ‰PNG . > I'd need a Python2 to test though.hard without. > > -jeff ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] Python MapScript via WSGI examples
On 2016-07-15 6:46 PM, Jeff McKenna wrote: Hi Tom, I believe I have your test working here, on Windows with mod_wsgi, Python 3.5.1, and MapScript7. Googling your error I believe your header problem occurs just for Python2 responses (maybe both Julien and I are using Python3 ?) What happens if you try to force the content-type to utf8 ? Change line#40 to: start_response('200 OK', [('Content-type', 'text/html; charset=utf-8')]) Just a guess as I have Python3. A try anyway... Or maybe the output should be bytes, as: start_response('200 OK', [('Content-type', 'application/octet-stream; charset=utf-8')]) I'd need a Python2 to test though.hard without. -jeff -- Jeff McKenna MapServer Consulting and Training Services http://www.gatewaygeomatics.com/ ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] Python MapScript via WSGI examples
Hi Tom, I believe I have your test working here, on Windows with mod_wsgi, Python 3.5.1, and MapScript7. Googling your error I believe your header problem occurs just for Python2 responses (maybe both Julien and I are using Python3 ?) What happens if you try to force the content-type to utf8 ? Change line#40 to: start_response('200 OK', [('Content-type', 'text/html; charset=utf-8')]) Just a guess as I have Python3. A try anyway... -jeff -- Jeff McKenna MapServer Consulting and Training Services http://www.gatewaygeomatics.com/ On 2016-07-15 3:05 PM, Kralidis, Tom (EC) wrote: Thanks Julien and Stephan: I've updated my example in [1], however I get the following traceback when issuing a WMS 1.1.1 GetMap request: Traceback (most recent call last): File "/usr/lib/python2.7/wsgiref/handlers.py", line 85, in run self.result = application(self.environ, self.start_response) File "mapscript-wsgi.py", line 40, in application start_response('200 OK', [('Content-type', content_type)]) File "/usr/lib/python2.7/wsgiref/handlers.py", line 180, in start_response assert type(val) is StringType,"Header values must be strings" AssertionError: Header values must be string Any idea? ..Tom [1] https://gist.github.com/tomkralidis/9adbd4864c03647aa7eb4f96a3c33297 ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] Python MapScript via WSGI examples
Hi Tom, I tried your script and simply changed the mapfile to use the one in mapserver/tests/ I got a valid response from the following URL: http://127.0.0.1:8001/?service=wms=GetMap=Testing=1.1.1=image/png=EPSG:4326=-180,-90,180,90=600=300 What are you using? Julien On 16-07-15 02:05 PM, Kralidis, Tom (EC) wrote: Thanks Julien and Stephan: I've updated my example in [1], however I get the following traceback when issuing a WMS 1.1.1 GetMap request: Traceback (most recent call last): File "/usr/lib/python2.7/wsgiref/handlers.py", line 85, in run self.result = application(self.environ, self.start_response) File "mapscript-wsgi.py", line 40, in application start_response('200 OK', [('Content-type', content_type)]) File "/usr/lib/python2.7/wsgiref/handlers.py", line 180, in start_response assert type(val) is StringType,"Header values must be strings" AssertionError: Header values must be string Any idea? ..Tom [1] https://gist.github.com/tomkralidis/9adbd4864c03647aa7eb4f96a3c33297 -Original Message- From: mapserver-users [mailto:mapserver-users-boun...@lists.osgeo.org] On Behalf Of Stephan Meißl Sent: 14 July 2016 11:57 To: mapserver-users@lists.osgeo.org Subject: Re: [mapserver-users] Python MapScript via WSGI examples -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi Tom, adding to Julien's response you could also replace `request.loadParams()` with `request.loadParamsFromURL(env['QUERY_STRING'])`. As Julien said, key is that the environment variables are not set automatically. cu Stephan On 07/14/2016 05:19 PM, Julien-Samuel Lacroix wrote: Hi Tom, When I run your script, I get the following response: This script can only be used to decode form results and should be initiated as a CGI process via a httpd server. This answer does not contain any content-type that can be stripped wit h msIO_getStdoutBufferBytes(). That's why it returns None. Before your OWSRequest call, you need to set the Environment variable that MapServer needs. Otherwise they are passed in the env variable an d not to MapServer. Code to add: # List of all environment variable used by MapServer mapserv_env = [ 'CONTENT_LENGTH', 'CONTENT_TYPE', 'CURL_CA_BUNDLE', 'HTTP_COOKIE', 'HTTP_HOST', 'HTTPS', 'HTTP_X_FORWARDED_HOST', 'HTTP_X_FORWARDED_PORT ', 'HTTP_X_FORWARDED_PROTO', 'MS_DEBUGLEVEL', 'MS_ENCRYPTION_KEY', 'MS_ERRORFILE', 'MS_MAPFILE', 'MS_MAPFILE_PATTERN', 'MS_MAP_NO_PATH', 'MS_MAP_PATTERN', 'MS_MODE', 'MS_OPENLAYERS_JS_URL', 'MS_TEMPPATH', 'MS_XMLMAPFILE_XSLT', 'PROJ_LIB', 'QUERY_STRING', 'REMOTE_ADDR', 'REQUEST_METHOD', 'SCRIPT_NAME', 'SERVER_NAME', 'SERVER_PORT' ] for key in mapserv_env: if key in env: os.environ[key] = env[key] else: os.unsetenv(key) request = mapscript.OWSRequest() Best regards, Julien On 16-07-13 12:55 PM, Kralidis, Tom (EC) wrote: Hi all: we are looking into updating our Python MapScript (CGI-based) wrappers to leverage WSGI, and are having integration issues as part of testin g. We are using 6.4.2 on Ubuntu 14.04. See example in [1] (against any mapfile is fine). Simple run with python ./mapscript-wsgi.py which makes the server available on localhost:8000 by default. Issues: - the value in https://gist.github.com/tomkralidis/9adbd4864c03647aa7eb4f96a3c33297# file-mapscript-wsgi-py-L18 ends up being a Python None type for some reason when it should be a string of the content-type - issuing a, say, WMS 1.3.0 GetCapabilities request yields the venerable MapServer "This script can " default message, when I am expecting Capabilities XML Any ideas what I'm doing wrong here? ..Tom [1] https://gist.github.com/tomkralidis/9adbd4864c03647aa7eb4f96a3c33 297 ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users -BEGIN PGP SIGNATURE- Version: GnuPG v2.0.22 (GNU/Linux) iQIcBAEBAgAGBQJXh7ZVAAoJEKNQXeNWi+qtf9UP/1k7tdKlqkLm2wZ3449qcY 5F f8c9OfudiF3UAcIM5+V6+MDMRYFBC4u55g7tsfXRp/iiL4IaDYL5S5xmCViGaEw K T3fcB+F1UsJ68q7QWRyrJwQW8CPXDACTnDppIGE4yspSxCQHubbrbDCNzvQh qlx2 7YcnqTTNghcPMM4AKg0etzH+9I73nYYzukiZe0ZGvI+g0caotEAdY/Xb5kb3GuzJ aWV4fgTJSgS/r0R6O1UP+I41jHEUrgqoT7qLNqdKOyv502YZ/EGwkclhnPQst2B q 1jFeNqsfvju4D3Ob/EGl4GnQEfptYqh+KwRmxeB+tW8kzRdIVD1D9R0MlbM5N C4d JHY1/4fpeBcFjbA+MVIWr2tbV7gDV4Mht/4lUszDNCUt055vV47sd+NNXl78+Fk 8 lrdqbqtxJzKW0mKAsr44jmn65iMrqm+ts06iHTLPfKFkHL7kxqDWk8wIy8Xq6rG E 5c5cbHQOj6bXqlgZGxxcLq3kZu/Tpg1VOnD+DorpnVLrR7JOnDV+JDSaU7YCfhz I yV2WYbEGuJCZKEH7bLY/8oQ3XKCiH8+0a+RRU1efLjzCquLSCYXAOUc6pCPNzl rY JCV8VT6Fmnp/+brrCxCMgse39LWK8x9RuxSbi8UocFhDnmtbDgojA7xrzt/onq BJ 6Fzq/t4Wnl3ifjK1vjlK =Gj2e -END PGP SIGNATURE- ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users -- Juli
Re: [mapserver-users] Python MapScript via WSGI examples
Thanks Julien and Stephan: I've updated my example in [1], however I get the following traceback when issuing a WMS 1.1.1 GetMap request: Traceback (most recent call last): File "/usr/lib/python2.7/wsgiref/handlers.py", line 85, in run self.result = application(self.environ, self.start_response) File "mapscript-wsgi.py", line 40, in application start_response('200 OK', [('Content-type', content_type)]) File "/usr/lib/python2.7/wsgiref/handlers.py", line 180, in start_response assert type(val) is StringType,"Header values must be strings" AssertionError: Header values must be string Any idea? ..Tom [1] https://gist.github.com/tomkralidis/9adbd4864c03647aa7eb4f96a3c33297 > -Original Message- > From: mapserver-users [mailto:mapserver-users-boun...@lists.osgeo.org] > On Behalf Of Stephan Meißl > Sent: 14 July 2016 11:57 > To: mapserver-users@lists.osgeo.org > Subject: Re: [mapserver-users] Python MapScript via WSGI examples > > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > Hi Tom, > > adding to Julien's response you could also replace > `request.loadParams()` with > `request.loadParamsFromURL(env['QUERY_STRING'])`. > > As Julien said, key is that the environment variables are not set > automatically. > > cu > Stephan > > > On 07/14/2016 05:19 PM, Julien-Samuel Lacroix wrote: > > Hi Tom, > > > > When I run your script, I get the following response: > > > > This script can only be used to decode form results and > > should be initiated as a CGI process via a httpd server. > > > > This answer does not contain any content-type that can be stripped wit > h > > msIO_getStdoutBufferBytes(). That's why it returns None. > > > > Before your OWSRequest call, you need to set the Environment variable > > that MapServer needs. Otherwise they are passed in the env variable an > d > > not to MapServer. Code to add: > > > > > > # List of all environment variable used by MapServer > > mapserv_env = [ > > 'CONTENT_LENGTH', 'CONTENT_TYPE', 'CURL_CA_BUNDLE', > 'HTTP_COOKIE', > > 'HTTP_HOST', 'HTTPS', 'HTTP_X_FORWARDED_HOST', > 'HTTP_X_FORWARDED_PORT > ', > > 'HTTP_X_FORWARDED_PROTO', 'MS_DEBUGLEVEL', > 'MS_ENCRYPTION_KEY', > > 'MS_ERRORFILE', 'MS_MAPFILE', 'MS_MAPFILE_PATTERN', > 'MS_MAP_NO_PATH', > > 'MS_MAP_PATTERN', 'MS_MODE', 'MS_OPENLAYERS_JS_URL', > 'MS_TEMPPATH', > > 'MS_XMLMAPFILE_XSLT', 'PROJ_LIB', 'QUERY_STRING', 'REMOTE_ADDR', > > 'REQUEST_METHOD', 'SCRIPT_NAME', 'SERVER_NAME', 'SERVER_PORT' > > ] > > for key in mapserv_env: > > if key in env: > > os.environ[key] = env[key] > > else: > > os.unsetenv(key) > > request = mapscript.OWSRequest() > > > > > > Best regards, > > Julien > > > > On 16-07-13 12:55 PM, Kralidis, Tom (EC) wrote: > >> Hi all: we are looking into updating our Python MapScript (CGI-based) > >> wrappers > >> to leverage WSGI, and are having integration issues as part of testin > g. > >> > >> We are using 6.4.2 on Ubuntu 14.04. See example in [1] (against > >> any mapfile is fine). Simple run with python ./mapscript-wsgi.py > >> which makes > >> the server available on localhost:8000 by default. > >> > >> Issues: > >> > >> - the value in > >> > https://gist.github.com/tomkralidis/9adbd4864c03647aa7eb4f96a3c33297# > file-mapscript-wsgi-py-L18 > >> ends up being a Python None type for some reason when it should be a > >> string of the content-type > >> - issuing a, say, WMS 1.3.0 GetCapabilities request yields the > >> venerable MapServer "This script can " default message, when I am > >> expecting Capabilities XML > >> > >> Any ideas what I'm doing wrong here? > >> > >> ..Tom > >> > >> [1] https://gist.github.com/tomkralidis/9adbd4864c03647aa7eb4f96a3c33 > 297 > >> ___ > >> mapserver-users mailing list > >> mapserver-users@lists.osgeo.org > >> http://lists.osgeo.org/mailman/listinfo/mapserver-users > >> > > > > -BEGIN PGP SIGNATURE- > Version: GnuPG v2.0.22 (GNU/Linux) > > iQIcBAEBAgAGBQJXh7ZVAAoJEKNQXeNWi+qtf9UP/1k7tdKlqkLm2wZ3449qcY > 5F > f8c9OfudiF3UAcIM5+V6+MDMRYFBC4u55g7tsfXRp/iiL4IaDYL5S5xmCViGaEw > K > T3fcB+F1UsJ68q7QWRyrJwQW8CPXDACTnDppIGE4yspSxCQHubbrbDCNzvQh > qlx2 > 7YcnqTTNghcPMM4AKg0etzH+9I73nYYzukiZe0ZGvI+g0caotEAdY/Xb5kb3GuzJ > aWV4fgTJSgS/r0R6O1UP+I41jHEUrgqoT7qLNq
Re: [mapserver-users] Python MapScript via WSGI examples
Hi Tom, I have added a link to your example from the MapServer wiki[1]. Once you solve it, it would be great if you could update your example page with the working code. VIP [1] https://github.com/mapserver/mapserver/wiki -jeff -- Jeff McKenna MapServer Consulting and Training Services http://www.gatewaygeomatics.com/ On 2016-07-13 1:55 PM, Kralidis, Tom (EC) wrote: Hi all: we are looking into updating our Python MapScript (CGI-based) wrappers to leverage WSGI, and are having integration issues as part of testing. We are using 6.4.2 on Ubuntu 14.04. See example in [1] (against any mapfile is fine). Simple run with python ./mapscript-wsgi.py which makes the server available on localhost:8000 by default. Issues: - the value in https://gist.github.com/tomkralidis/9adbd4864c03647aa7eb4f96a3c33297#file-mapscript-wsgi-py-L18 ends up being a Python None type for some reason when it should be a string of the content-type - issuing a, say, WMS 1.3.0 GetCapabilities request yields the venerable MapServer "This script can " default message, when I am expecting Capabilities XML Any ideas what I'm doing wrong here? ..Tom [1] https://gist.github.com/tomkralidis/9adbd4864c03647aa7eb4f96a3c33297 ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] Python MapScript via WSGI examples
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi Tom, adding to Julien's response you could also replace `request.loadParams()` with `request.loadParamsFromURL(env['QUERY_STRING'])`. As Julien said, key is that the environment variables are not set automatically. cu Stephan On 07/14/2016 05:19 PM, Julien-Samuel Lacroix wrote: > Hi Tom, > > When I run your script, I get the following response: > > This script can only be used to decode form results and > should be initiated as a CGI process via a httpd server. > > This answer does not contain any content-type that can be stripped wit h > msIO_getStdoutBufferBytes(). That's why it returns None. > > Before your OWSRequest call, you need to set the Environment variable > that MapServer needs. Otherwise they are passed in the env variable an d > not to MapServer. Code to add: > > > # List of all environment variable used by MapServer > mapserv_env = [ > 'CONTENT_LENGTH', 'CONTENT_TYPE', 'CURL_CA_BUNDLE', 'HTTP_COOKIE', > 'HTTP_HOST', 'HTTPS', 'HTTP_X_FORWARDED_HOST', 'HTTP_X_FORWARDED_PORT ', > 'HTTP_X_FORWARDED_PROTO', 'MS_DEBUGLEVEL', 'MS_ENCRYPTION_KEY', > 'MS_ERRORFILE', 'MS_MAPFILE', 'MS_MAPFILE_PATTERN', 'MS_MAP_NO_PATH', > 'MS_MAP_PATTERN', 'MS_MODE', 'MS_OPENLAYERS_JS_URL', 'MS_TEMPPATH', > 'MS_XMLMAPFILE_XSLT', 'PROJ_LIB', 'QUERY_STRING', 'REMOTE_ADDR', > 'REQUEST_METHOD', 'SCRIPT_NAME', 'SERVER_NAME', 'SERVER_PORT' > ] > for key in mapserv_env: > if key in env: > os.environ[key] = env[key] > else: > os.unsetenv(key) > request = mapscript.OWSRequest() > > > Best regards, > Julien > > On 16-07-13 12:55 PM, Kralidis, Tom (EC) wrote: >> Hi all: we are looking into updating our Python MapScript (CGI-based) >> wrappers >> to leverage WSGI, and are having integration issues as part of testin g. >> >> We are using 6.4.2 on Ubuntu 14.04. See example in [1] (against >> any mapfile is fine). Simple run with python ./mapscript-wsgi.py >> which makes >> the server available on localhost:8000 by default. >> >> Issues: >> >> - the value in >> https://gist.github.com/tomkralidis/9adbd4864c03647aa7eb4f96a3c33297# file-mapscript-wsgi-py-L18 >> ends up being a Python None type for some reason when it should be a >> string of the content-type >> - issuing a, say, WMS 1.3.0 GetCapabilities request yields the >> venerable MapServer "This script can " default message, when I am >> expecting Capabilities XML >> >> Any ideas what I'm doing wrong here? >> >> ..Tom >> >> [1] https://gist.github.com/tomkralidis/9adbd4864c03647aa7eb4f96a3c33 297 >> ___ >> mapserver-users mailing list >> mapserver-users@lists.osgeo.org >> http://lists.osgeo.org/mailman/listinfo/mapserver-users >> > -BEGIN PGP SIGNATURE- Version: GnuPG v2.0.22 (GNU/Linux) iQIcBAEBAgAGBQJXh7ZVAAoJEKNQXeNWi+qtf9UP/1k7tdKlqkLm2wZ3449qcY5F f8c9OfudiF3UAcIM5+V6+MDMRYFBC4u55g7tsfXRp/iiL4IaDYL5S5xmCViGaEwK T3fcB+F1UsJ68q7QWRyrJwQW8CPXDACTnDppIGE4yspSxCQHubbrbDCNzvQhqlx2 7YcnqTTNghcPMM4AKg0etzH+9I73nYYzukiZe0ZGvI+g0caotEAdY/Xb5kb3GuzJ aWV4fgTJSgS/r0R6O1UP+I41jHEUrgqoT7qLNqdKOyv502YZ/EGwkclhnPQst2Bq 1jFeNqsfvju4D3Ob/EGl4GnQEfptYqh+KwRmxeB+tW8kzRdIVD1D9R0MlbM5NC4d JHY1/4fpeBcFjbA+MVIWr2tbV7gDV4Mht/4lUszDNCUt055vV47sd+NNXl78+Fk8 lrdqbqtxJzKW0mKAsr44jmn65iMrqm+ts06iHTLPfKFkHL7kxqDWk8wIy8Xq6rGE 5c5cbHQOj6bXqlgZGxxcLq3kZu/Tpg1VOnD+DorpnVLrR7JOnDV+JDSaU7YCfhzI yV2WYbEGuJCZKEH7bLY/8oQ3XKCiH8+0a+RRU1efLjzCquLSCYXAOUc6pCPNzlrY JCV8VT6Fmnp/+brrCxCMgse39LWK8x9RuxSbi8UocFhDnmtbDgojA7xrzt/onqBJ 6Fzq/t4Wnl3ifjK1vjlK =Gj2e -END PGP SIGNATURE- ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] Python MapScript via WSGI examples
Hi Tom, When I run your script, I get the following response: This script can only be used to decode form results and should be initiated as a CGI process via a httpd server. This answer does not contain any content-type that can be stripped with msIO_getStdoutBufferBytes(). That's why it returns None. Before your OWSRequest call, you need to set the Environment variable that MapServer needs. Otherwise they are passed in the env variable and not to MapServer. Code to add: # List of all environment variable used by MapServer mapserv_env = [ 'CONTENT_LENGTH', 'CONTENT_TYPE', 'CURL_CA_BUNDLE', 'HTTP_COOKIE', 'HTTP_HOST', 'HTTPS', 'HTTP_X_FORWARDED_HOST', 'HTTP_X_FORWARDED_PORT', 'HTTP_X_FORWARDED_PROTO', 'MS_DEBUGLEVEL', 'MS_ENCRYPTION_KEY', 'MS_ERRORFILE', 'MS_MAPFILE', 'MS_MAPFILE_PATTERN', 'MS_MAP_NO_PATH', 'MS_MAP_PATTERN', 'MS_MODE', 'MS_OPENLAYERS_JS_URL', 'MS_TEMPPATH', 'MS_XMLMAPFILE_XSLT', 'PROJ_LIB', 'QUERY_STRING', 'REMOTE_ADDR', 'REQUEST_METHOD', 'SCRIPT_NAME', 'SERVER_NAME', 'SERVER_PORT' ] for key in mapserv_env: if key in env: os.environ[key] = env[key] else: os.unsetenv(key) request = mapscript.OWSRequest() Best regards, Julien On 16-07-13 12:55 PM, Kralidis, Tom (EC) wrote: Hi all: we are looking into updating our Python MapScript (CGI-based) wrappers to leverage WSGI, and are having integration issues as part of testing. We are using 6.4.2 on Ubuntu 14.04. See example in [1] (against any mapfile is fine). Simple run with python ./mapscript-wsgi.py which makes the server available on localhost:8000 by default. Issues: - the value in https://gist.github.com/tomkralidis/9adbd4864c03647aa7eb4f96a3c33297#file-mapscript-wsgi-py-L18 ends up being a Python None type for some reason when it should be a string of the content-type - issuing a, say, WMS 1.3.0 GetCapabilities request yields the venerable MapServer "This script can " default message, when I am expecting Capabilities XML Any ideas what I'm doing wrong here? ..Tom [1] https://gist.github.com/tomkralidis/9adbd4864c03647aa7eb4f96a3c33297 ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users -- Julien-Samuel Lacroix T: +1 418-696-5056 #202 Mapgears http://www.mapgears.com/ ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
[mapserver-users] Python MapScript via WSGI examples
Hi all: we are looking into updating our Python MapScript (CGI-based) wrappers to leverage WSGI, and are having integration issues as part of testing. We are using 6.4.2 on Ubuntu 14.04. See example in [1] (against any mapfile is fine). Simple run with python ./mapscript-wsgi.py which makes the server available on localhost:8000 by default. Issues: - the value in https://gist.github.com/tomkralidis/9adbd4864c03647aa7eb4f96a3c33297#file-mapscript-wsgi-py-L18 ends up being a Python None type for some reason when it should be a string of the content-type - issuing a, say, WMS 1.3.0 GetCapabilities request yields the venerable MapServer "This script can " default message, when I am expecting Capabilities XML Any ideas what I'm doing wrong here? ..Tom [1] https://gist.github.com/tomkralidis/9adbd4864c03647aa7eb4f96a3c33297 ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
[mapserver-users] Python mapscript install v 6.4 -- No module named mapscript
Hi, I can not get Python mapscript properly installed since Mapserver 6.4 I am compiling Mapserver on Ubuntu 12.04 64Bit: cmake .. -DWITH_KML=1 -DWITH_GD=1 -DWITH_SVGCAIRO=0 -DWITH_RSVG=1 -DWITH_CLIENT_WMS=1 -DWITH_CLIENT_WFS=1 -DWITH_CURL=1 -DWITH_PYTHON=1 -DWITH_PHP=1 -- /usr/lib/cgi-bin/mapserv -v /MapServer version 6.4.1 OUTPUT=GIF OUTPUT=PNG OUTPUT=JPEG OUTPUT=KML SUPPORTS=PROJ SUPPORTS=GD SUPPORTS=AGG SUPPORTS=FREETYPE SUPPORTS=CAIRO SUPPORTS=SVG_SYMBOLS SUPPORTS=RSVG SUPPORTS=ICONV SUPPORTS=FRIBIDI SUPPORTS=WMS_SERVER SUPPORTS=WMS_CLIENT SUPPORTS=WFS_SERVER SUPPORTS=WFS_CLIENT SUPPORTS=WCS_SERVER SUPPORTS=FASTCGI SUPPORTS=GEOS INPUT=JPEG INPUT=POSTGIS INPUT=OGR INPUT=GDAL INPUT=SHAPEFILE / Seams to work properly. When I try to fetch maptiles via Tilecache (using Python mapscript) I get the error message /No module named mapscript/. I guess I don't have Python mapscript properly installed. The ReadME-File in Python/Mapscript folder recommends to do python setup.py build python setup.py install but this does not work in 6.4 (it did in 6.2) -- /IOError: [Errno 2] No such file or directory: '../../mapscriptvars'. Has MapServer been made/? So what to do ? Thanks, Harry -- View this message in context: http://osgeo-org.1560.x6.nabble.com/Python-mapscript-install-v-6-4-No-module-named-mapscript-tp5099406.html Sent from the Mapserver - User mailing list archive at Nabble.com. ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] Python mapscript install v 6.4 -- No module named mapscript
Thanks Thomas, I forgot the make install step: mkdir build cd build cmake .. -DWITH_KML=1 -DWITH_GD=1 -DWITH_SVGCAIRO=0 -DWITH_RSVG=1 -DWITH_CLIENT_WMS=1 -DWITH_CLIENT_WFS=1 -DWITH_CURL=1 -DWITH_PYTHON=1 -DWITH_PHP=1 ## fix dependency issues make make install Harry -- View this message in context: http://osgeo-org.1560.x6.nabble.com/Python-mapscript-install-v-6-4-No-module-named-mapscript-tp5099406p5099421.html Sent from the Mapserver - User mailing list archive at Nabble.com. ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] Python MapScript WxS Capabilities XML truncated
Hi: this was an artifact of using Python mapscript which was not representative of the patch fix. Updating Python mapscript fixes this issue. Thanks much to Stephan and Thomas From: thomas bonfort [mailto:thomas.bonf...@gmail.com] Sent: June 18, 2013 11:32 AM To: Kralidis,Tom [Ontario] Cc: MapserverList OSGEO Subject: Re: [mapserver-users] Python MapScript WxS Capabilities XML truncated Tom, I was able to reproduce a segfault using the CGI, here's the backtrace for the ticket I'm sure you'll open and hopefully fix :) Program received signal SIGSEGV, Segmentation fault. 0x77b140af in msDumpLayer (map=0x604d90, lp=0x60d6b0, nVersion=66304, script_url_encoded=0x616330 http://foobar?;, indent=0x616a80 , validated_language=0x0, grouplayer=0) at mapwms.c:2449 2449 if (l lp2-numclasses) (gdb) bt #0 0x77b140af in msDumpLayer (map=0x604d90, lp=0x60d6b0, nVersion=66304, script_url_encoded=0x616330 http://foobar?;, indent=0x616a80 , validated_language=0x0, grouplayer=0) at mapwms.c:2449 #1 0x77b14a67 in msWMSPrintNestedGroups (map=0x604d90, nVersion=66304, pabLayerProcessed=0x6164b0 , index=0, level=4, nestedGroups=0x616820, numNestedGroups=0x616860, isUsedInNestedGroup=0x616880, script_url_encoded=0x616330 http://foobar?;, validated_language=0x0) at mapwms.c:2619 #2 0x77b14c26 in msWMSPrintNestedGroups (map=0x604d90, nVersion=66304, pabLayerProcessed=0x6164b0 , index=0, level=3, nestedGroups=0x616820, numNestedGroups=0x616860, isUsedInNestedGroup=0x616880, script_url_encoded=0x616330 http://foobar?;, validated_language=0x0) at mapwms.c:2644 #3 0x77b14c26 in msWMSPrintNestedGroups (map=0x604d90, nVersion=66304, pabLayerProcessed=0x6164b0 , index=0, level=2, nestedGroups=0x616820, numNestedGroups=0x616860, isUsedInNestedGroup=0x616880, script_url_encoded=0x616330 http://foobar?;, validated_language=0x0) at mapwms.c:2644 #4 0x77b14c26 in msWMSPrintNestedGroups (map=0x604d90, nVersion=66304, pabLayerProcessed=0x6164b0 , index=0, level=1, nestedGroups=0x616820, numNestedGroups=0x616860, isUsedInNestedGroup=0x616880, script_url_encoded=0x616330 http://foobar?;, validated_language=0x0) at mapwms.c:2644 #5 0x77b14c26 in msWMSPrintNestedGroups (map=0x604d90, nVersion=66304, pabLayerProcessed=0x6164b0 , index=0, level=0, nestedGroups=0x616820, numNestedGroups=0x616860, isUsedInNestedGroup=0x616880, script_url_encoded=0x616330 http://foobar?;, validated_language=0x0) at mapwms.c:2644 #6 0x77b17c65 in msWMSGetCapabilities (map=0x604d90, nVersion=66304, req=0x6045c0, ows_request=0x7fffe7c0, requested_updatesequence=0x0, wms_exception_format=0x0, requested_language=0x0) at mapwms.c:3356 #7 0x77b1d51d in msWMSDispatch (map=0x604d90, req=0x6045c0, ows_request=0x7fffe7c0, force_wms_mode=0) at mapwms.c:4833 #8 0x77b4df6d in msOWSDispatch (map=0x604d90, request=0x6045c0, ows_mode=-1) at mapows.c:243 #9 0x77b79c79 in msCGIDispatchRequest (mapserv=0x604380) at mapservutil.c:1607 #10 0x00400f60 in main (argc=2, argv=0x7fffe9a8) at mapserv.c:259 cheers, thomas On 18 June 2013 16:46, Kralidis,Tom [Ontario] tom.krali...@ec.gc.ca wrote: Hi: using 6.2.1 (Ubuntu) built from source along with the following patch at https://github.com/mapserver/mapserver/commit/937dcb6857501835b5489fa4be a321105412a20b.patch, we have a requirement to implement a WxS MapScript approach for our OWS (we have up until now using the mapserv binary). All works well, except for WMS GetCapabilities responses. The result is a truncated WMS Capabilities XML which gets truncated when MapServer is printing out the root Layer element. I've posted a minimal mapfile and the Python mapscript at https://gist.github.com/tomkralidis/f70afd49270cb8efb62f. Observations: - commenting out LAYER.METADATA.wms_layer_group eliminates the issue, but we require this functionality - commenting out LAYER.CLASSGROUP and LAYER.CLASS.GROUP, and uncommenting LAYER.METADATA.wms_layer_group eliminates the issue, but we require this functionality - the same mapfile works just fine with mapserv binary Any suggestions? I'm wondering whether the Python SWIG implementation affects this. ..Tom ___ 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
[mapserver-users] Python MapScript WxS Capabilities XML truncated
Hi: using 6.2.1 (Ubuntu) built from source along with the following patch at https://github.com/mapserver/mapserver/commit/937dcb6857501835b5489fa4be a321105412a20b.patch, we have a requirement to implement a WxS MapScript approach for our OWS (we have up until now using the mapserv binary). All works well, except for WMS GetCapabilities responses. The result is a truncated WMS Capabilities XML which gets truncated when MapServer is printing out the root Layer element. I've posted a minimal mapfile and the Python mapscript at https://gist.github.com/tomkralidis/f70afd49270cb8efb62f. Observations: - commenting out LAYER.METADATA.wms_layer_group eliminates the issue, but we require this functionality - commenting out LAYER.CLASSGROUP and LAYER.CLASS.GROUP, and uncommenting LAYER.METADATA.wms_layer_group eliminates the issue, but we require this functionality - the same mapfile works just fine with mapserv binary Any suggestions? I'm wondering whether the Python SWIG implementation affects this. ..Tom ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] Python MapScript WxS Capabilities XML truncated
Tom, I was able to reproduce a segfault using the CGI, here's the backtrace for the ticket I'm sure you'll open and hopefully fix :) Program received signal SIGSEGV, Segmentation fault. 0x77b140af in msDumpLayer (map=0x604d90, lp=0x60d6b0, nVersion=66304, script_url_encoded=0x616330 http://foobar?;, indent=0x616a80 , validated_language=0x0, grouplayer=0) at mapwms.c:2449 2449 if (l lp2-numclasses) (gdb) bt #0 0x77b140af in msDumpLayer (map=0x604d90, lp=0x60d6b0, nVersion=66304, script_url_encoded=0x616330 http://foobar?;, indent=0x616a80 , validated_language=0x0, grouplayer=0) at mapwms.c:2449 #1 0x77b14a67 in msWMSPrintNestedGroups (map=0x604d90, nVersion=66304, pabLayerProcessed=0x6164b0 , index=0, level=4, nestedGroups=0x616820, numNestedGroups=0x616860, isUsedInNestedGroup=0x616880, script_url_encoded=0x616330 http://foobar?;, validated_language=0x0) at mapwms.c:2619 #2 0x77b14c26 in msWMSPrintNestedGroups (map=0x604d90, nVersion=66304, pabLayerProcessed=0x6164b0 , index=0, level=3, nestedGroups=0x616820, numNestedGroups=0x616860, isUsedInNestedGroup=0x616880, script_url_encoded=0x616330 http://foobar?;, validated_language=0x0) at mapwms.c:2644 #3 0x77b14c26 in msWMSPrintNestedGroups (map=0x604d90, nVersion=66304, pabLayerProcessed=0x6164b0 , index=0, level=2, nestedGroups=0x616820, numNestedGroups=0x616860, isUsedInNestedGroup=0x616880, script_url_encoded=0x616330 http://foobar?;, validated_language=0x0) at mapwms.c:2644 #4 0x77b14c26 in msWMSPrintNestedGroups (map=0x604d90, nVersion=66304, pabLayerProcessed=0x6164b0 , index=0, level=1, nestedGroups=0x616820, numNestedGroups=0x616860, isUsedInNestedGroup=0x616880, script_url_encoded=0x616330 http://foobar?;, validated_language=0x0) at mapwms.c:2644 #5 0x77b14c26 in msWMSPrintNestedGroups (map=0x604d90, nVersion=66304, pabLayerProcessed=0x6164b0 , index=0, level=0, nestedGroups=0x616820, numNestedGroups=0x616860, isUsedInNestedGroup=0x616880, script_url_encoded=0x616330 http://foobar?;, validated_language=0x0) at mapwms.c:2644 #6 0x77b17c65 in msWMSGetCapabilities (map=0x604d90, nVersion=66304, req=0x6045c0, ows_request=0x7fffe7c0, requested_updatesequence=0x0, wms_exception_format=0x0, requested_language=0x0) at mapwms.c:3356 #7 0x77b1d51d in msWMSDispatch (map=0x604d90, req=0x6045c0, ows_request=0x7fffe7c0, force_wms_mode=0) at mapwms.c:4833 #8 0x77b4df6d in msOWSDispatch (map=0x604d90, request=0x6045c0, ows_mode=-1) at mapows.c:243 #9 0x77b79c79 in msCGIDispatchRequest (mapserv=0x604380) at mapservutil.c:1607 #10 0x00400f60 in main (argc=2, argv=0x7fffe9a8) at mapserv.c:259 cheers, thomas On 18 June 2013 16:46, Kralidis,Tom [Ontario] tom.krali...@ec.gc.ca wrote: Hi: using 6.2.1 (Ubuntu) built from source along with the following patch at https://github.com/mapserver/mapserver/commit/937dcb6857501835b5489fa4be a321105412a20b.patch, we have a requirement to implement a WxS MapScript approach for our OWS (we have up until now using the mapserv binary). All works well, except for WMS GetCapabilities responses. The result is a truncated WMS Capabilities XML which gets truncated when MapServer is printing out the root Layer element. I've posted a minimal mapfile and the Python mapscript at https://gist.github.com/tomkralidis/f70afd49270cb8efb62f. Observations: - commenting out LAYER.METADATA.wms_layer_group eliminates the issue, but we require this functionality - commenting out LAYER.CLASSGROUP and LAYER.CLASS.GROUP, and uncommenting LAYER.METADATA.wms_layer_group eliminates the issue, but we require this functionality - the same mapfile works just fine with mapserv binary Any suggestions? I'm wondering whether the Python SWIG implementation affects this. ..Tom ___ 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
Re: [mapserver-users] Python MapScript WxS Capabilities XML truncated
Thomas: thanks for the info. The segfault you indicate below is solved with https://github.com/mapserver/mapserver/commit/937dcb6857501835b5489fa4bea321105412a20b. So my testing below is based on 6.2.1 + https://github.com/mapserver/mapserver/commit/937dcb6857501835b5489fa4bea321105412a20b.patch, thus introducing a new issue. I've submitted a ticket at https://github.com/mapserver/mapserver/issues/4668 From: thomas bonfort [mailto:thomas.bonf...@gmail.com] Sent: June 18, 2013 11:32 AM To: Kralidis,Tom [Ontario] Cc: MapserverList OSGEO Subject: Re: [mapserver-users] Python MapScript WxS Capabilities XML truncated Tom, I was able to reproduce a segfault using the CGI, here's the backtrace for the ticket I'm sure you'll open and hopefully fix :) Program received signal SIGSEGV, Segmentation fault. 0x77b140af in msDumpLayer (map=0x604d90, lp=0x60d6b0, nVersion=66304, script_url_encoded=0x616330 http://foobar?;, indent=0x616a80 , validated_language=0x0, grouplayer=0) at mapwms.c:2449 2449 if (l lp2-numclasses) (gdb) bt #0 0x77b140af in msDumpLayer (map=0x604d90, lp=0x60d6b0, nVersion=66304, script_url_encoded=0x616330 http://foobar?;, indent=0x616a80 , validated_language=0x0, grouplayer=0) at mapwms.c:2449 #1 0x77b14a67 in msWMSPrintNestedGroups (map=0x604d90, nVersion=66304, pabLayerProcessed=0x6164b0 , index=0, level=4, nestedGroups=0x616820, numNestedGroups=0x616860, isUsedInNestedGroup=0x616880, script_url_encoded=0x616330 http://foobar?;, validated_language=0x0) at mapwms.c:2619 #2 0x77b14c26 in msWMSPrintNestedGroups (map=0x604d90, nVersion=66304, pabLayerProcessed=0x6164b0 , index=0, level=3, nestedGroups=0x616820, numNestedGroups=0x616860, isUsedInNestedGroup=0x616880, script_url_encoded=0x616330 http://foobar?;, validated_language=0x0) at mapwms.c:2644 #3 0x77b14c26 in msWMSPrintNestedGroups (map=0x604d90, nVersion=66304, pabLayerProcessed=0x6164b0 , index=0, level=2, nestedGroups=0x616820, numNestedGroups=0x616860, isUsedInNestedGroup=0x616880, script_url_encoded=0x616330 http://foobar?;, validated_language=0x0) at mapwms.c:2644 #4 0x77b14c26 in msWMSPrintNestedGroups (map=0x604d90, nVersion=66304, pabLayerProcessed=0x6164b0 , index=0, level=1, nestedGroups=0x616820, numNestedGroups=0x616860, isUsedInNestedGroup=0x616880, script_url_encoded=0x616330 http://foobar?;, validated_language=0x0) at mapwms.c:2644 #5 0x77b14c26 in msWMSPrintNestedGroups (map=0x604d90, nVersion=66304, pabLayerProcessed=0x6164b0 , index=0, level=0, nestedGroups=0x616820, numNestedGroups=0x616860, isUsedInNestedGroup=0x616880, script_url_encoded=0x616330 http://foobar?;, validated_language=0x0) at mapwms.c:2644 #6 0x77b17c65 in msWMSGetCapabilities (map=0x604d90, nVersion=66304, req=0x6045c0, ows_request=0x7fffe7c0, requested_updatesequence=0x0, wms_exception_format=0x0, requested_language=0x0) at mapwms.c:3356 #7 0x77b1d51d in msWMSDispatch (map=0x604d90, req=0x6045c0, ows_request=0x7fffe7c0, force_wms_mode=0) at mapwms.c:4833 #8 0x77b4df6d in msOWSDispatch (map=0x604d90, request=0x6045c0, ows_mode=-1) at mapows.c:243 #9 0x77b79c79 in msCGIDispatchRequest (mapserv=0x604380) at mapservutil.c:1607 #10 0x00400f60 in main (argc=2, argv=0x7fffe9a8) at mapserv.c:259 cheers, thomas On 18 June 2013 16:46, Kralidis,Tom [Ontario] tom.krali...@ec.gc.ca wrote: Hi: using 6.2.1 (Ubuntu) built from source along with the following patch at https://github.com/mapserver/mapserver/commit/937dcb6857501835b5489fa4be a321105412a20b.patch, we have a requirement to implement a WxS MapScript approach for our OWS (we have up until now using the mapserv binary). All works well, except for WMS GetCapabilities responses. The result is a truncated WMS Capabilities XML which gets truncated when MapServer is printing out the root Layer element. I've posted a minimal mapfile and the Python mapscript at https://gist.github.com/tomkralidis/f70afd49270cb8efb62f. Observations: - commenting out LAYER.METADATA.wms_layer_group eliminates the issue, but we require this functionality - commenting out LAYER.CLASSGROUP and LAYER.CLASS.GROUP, and uncommenting LAYER.METADATA.wms_layer_group eliminates the issue, but we require this functionality - the same mapfile works just fine with mapserv binary Any suggestions? I'm wondering whether the Python SWIG implementation affects this. ..Tom ___ 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
[mapserver-users] python-mapscript: layer.getFeature() AttributeError
Hello, I have a problem with the python-mapscript library v6.0.1-2ubuntu1 with swig2.0.4 and python 2.7 installed (I'm running ubuntu 12.04) If the function layer.getFeature is called, I get the following error: File /home/xxx/Documents/xxx_python//src/resdbcore/kaarten/mappreview.py, line 306, in gather_data resultaat = importlayer.getFeature(i) File /usr/lib/python2.7/dist-packages/mapscript.py, line 1192, in lambda __getattr__ = lambda self, name: _swig_getattr(self, layerObj, name) File /usr/lib/python2.7/dist-packages/mapscript.py, line 34, in _swig_getattr raise AttributeError,name AttributeError: getFeature the application runs fine on Windows but I try to get it running on linux with eclipse. the only relevant thing I found is that the layer.getFeature function has been temporarily removed from mapscript but should be available again =6. altough I have swig2 installed, in the file /usr/lib/python2.7/dist-packages/mapscript.py in the head it is mentioned that this file has been automatically generated by SWIG 1.3.36. Could that be the problem, because AFAIK python-mapscript needs swig2? Tim ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
[mapserver-users] [Python+MapScript] Convert imageObj to PIL Image
Hi All, I've been testing today in Python, trying to get a MapScript imageObj into an python Image object. This works via the following code: map.transparent = MS_ON map.selectOutputFormat('png8') map.outputformat.imagemode = MS_IMAGEMODE_RGBA map.outputformat.transparent = MS_ON img = map.draw() mem_png = StringIO.StringIO(img.saveToString()) _img = Image.open(mem_png) However, the _img file lost its transparency, even though it's still (or again) PNG. There MUST be a better way of getting the PNG file into PIL, right? Something besides writing it to a tempfile, opening it, and deleting it? On a side note, I only use this rendered image temporarily, I only need to cut it up in smaller bits and return those to my client. So if there's some sort of format that supports transparcency but without the PNG compression overhead, that would be even better! Regards, Jelmer Baas ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] [Python+MapScript] Convert imageObj to PIL Image
IIRC, PIL does not support 8bit pngs with transparency, so writing it to a file won't help. If you need alpha, you'll have to stick with 32bit pngs. -- thomas On Fri, Sep 7, 2012 at 3:35 PM, Jelmer Baas b...@speerit.nl wrote: Hi All, I've been testing today in Python, trying to get a MapScript imageObj into an python Image object. This works via the following code: map.transparent = MS_ON map.selectOutputFormat('png8') map.outputformat.imagemode = MS_IMAGEMODE_RGBA map.outputformat.transparent = MS_ON img = map.draw() mem_png = StringIO.StringIO(img.saveToString()) _img = Image.open(mem_png) However, the _img file lost its transparency, even though it's still (or again) PNG. There MUST be a better way of getting the PNG file into PIL, right? Something besides writing it to a tempfile, opening it, and deleting it? On a side note, I only use this rendered image temporarily, I only need to cut it up in smaller bits and return those to my client. So if there's some sort of format that supports transparcency but without the PNG compression overhead, that would be even better! Regards, Jelmer Baas ___ 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
Re: [mapserver-users] [Python+MapScript] Convert imageObj to PIL Image
Oh, wow, that was so simple. I changed map.selectOutputFormat('png8') to map.selectOutputFormat('png24') And done. Strangely, though, saving it to a file and re-opening *does* work! Thanks for the quick reply! -- Jelmer -Original Message- From: thomas bonfort [mailto:thomas.bonf...@gmail.com] Sent: Friday, September 07, 2012 15:50 To: Jelmer Baas Cc: mapserver-users@lists.osgeo.org Subject: Re: [mapserver-users] [Python+MapScript] Convert imageObj to PIL Image IIRC, PIL does not support 8bit pngs with transparency, so writing it to a file won't help. If you need alpha, you'll have to stick with 32bit pngs. -- thomas On Fri, Sep 7, 2012 at 3:35 PM, Jelmer Baas b...@speerit.nl wrote: Hi All, I've been testing today in Python, trying to get a MapScript imageObj into an python Image object. This works via the following code: map.transparent = MS_ON map.selectOutputFormat('png8') map.outputformat.imagemode = MS_IMAGEMODE_RGBA map.outputformat.transparent = MS_ON img = map.draw() mem_png = StringIO.StringIO(img.saveToString()) _img = Image.open(mem_png) However, the _img file lost its transparency, even though it's still (or again) PNG. There MUST be a better way of getting the PNG file into PIL, right? Something besides writing it to a tempfile, opening it, and deleting it? On a side note, I only use this rendered image temporarily, I only need to cut it up in smaller bits and return those to my client. So if there's some sort of format that supports transparcency but without the PNG compression overhead, that would be even better! Regards, Jelmer Baas ___ 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
Re: [mapserver-users] Python MapScript compile error
Hmm... I think we already ship MapServer with the C wrapper generated. IIRC, you can use the standard way to build the python module also, which does not require swig: cd mapscript/python python setup.py build python setup.py install Alan On 12-07-05 01:08 AM, Umberto Nicoletti wrote: python mapscript now requires swig 2.x: install it then rerun configure and make hth, Umberto On Thursday, July 5, 2012, Jackey Cheung wrote: Hi all, Not sure if i've done anything wrong. I've met the Unknown option: -a while compiling Python MapScript. MapServer: Git trunk, CentOS 6 box running on Intel Pentium D. ./configure --with-wms --with-wfs --with-curl --with-jpeg --with-freetype --with-png --with-threads --with-postgis --with-xml2 --with-libiconv --with-proj --with-ogr --with-gdal --with-cairo --with-ftgl --with-opengl --with-threads --with-geos --with-postgis --with-mysql --with-wmsclient --with-wfsclient --with-sos --with-wcs --with-curl --with-kml --with-xml-mapfile --with-xslt --with-fastcgi --with-exempi --with-fribidi-config --with-zlib --with-gd --with-postgis --with-mysql --with-php --with-libsvg-cairo --enable-fast-nint --enable-proj-fastpath --enable-point-z-m --enable-python-mapscript Although I don't need all these features yet, I've decided to test compiling all of them in case I need them in future. Configure went well, and finished with everything. But while compiling Python: cd mapscript/python; make; make[1]: Entering directory `/home/jackey.cheung/mapserver-6.2.0-beta1/mapscript/python' python -shadow -modern -templatereduce -fastdispatch -fvirtual -fastproxy -modernargs -castmode -dirvtable -fastinit -fastquery -noproxydel -nobuildnone -DUSE_PROJ_FASTPATHS -DUSE_POINT_Z_M -DUSE_FASTCGI -DUSE_SVG_CAIRO -DUSE_CAIRO -DUSE_FRIBIDI -DUSE_FRIBIDI2 -DUSE_EXSLT -DUSE_XSLT -DUSE_XMLMAPFILE -DUSE_WMS_LYR -DUSE_WFS_LYR -DUSE_SOS_SVR -DUSE_LIBXML2 -DUSE_CURL -DUSE_CURLOPT_PROXYAUTH -DUSE_KML -DUSE_EXEMPI -DUSE_WCS_SVR -DUSE_WFS_SVR -DUSE_WMS_SVR -DUSE_MYSQL -DUSE_POSTGIS -DPOSTGIS_HAS_SERVER_VERSION -DUSE_GDAL -DUSE_OGR -DUSE_GEOS -DHAVE_SYNC_FETCH_AND_ADD -DUSE_THREAD -DUSE_PROJ -DUSE_OGL -DUSE_FTGL -DUSE_GD -DUSE_GD_PNG -DUSE_GD_JPEG -DUSE_GD_GIF -DUSE_ICONV -DUSE_JPEG -DUSE_GIF -DUSE_PNG -DUSE_FREETYPE -DHAVE_VSNPRINTF -DNEED_STRLCPY -DNEED_STRLCAT -DNEED_STRRSTR -DDISABLE_CVSID -o mapscript_wrap.c ../mapscript.i Unknown option: -a usage: python [option] ... [-c cmd | -m mod | file | -] [arg] ... Try `python -h' for more information. Any clue? ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users -- Alan Boudreault http://www.mapgears.com/ ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
[mapserver-users] Python MapScript compile error
Hi all, Not sure if i've done anything wrong. I've met the Unknown option: -a while compiling Python MapScript. MapServer: Git trunk, CentOS 6 box running on Intel Pentium D. ./configure --with-wms --with-wfs --with-curl --with-jpeg --with-freetype --with-png --with-threads --with-postgis --with-xml2 --with-libiconv --with-proj --with-ogr --with-gdal --with-cairo --with-ftgl --with-opengl --with-threads --with-geos --with-postgis --with-mysql --with-wmsclient --with-wfsclient --with-sos --with-wcs --with-curl --with-kml --with-xml-mapfile --with-xslt --with-fastcgi --with-exempi --with-fribidi-config --with-zlib --with-gd --with-postgis --with-mysql --with-php --with-libsvg-cairo --enable-fast-nint --enable-proj-fastpath --enable-point-z-m --enable-python-mapscript Although I don't need all these features yet, I've decided to test compiling all of them in case I need them in future. Configure went well, and finished with everything. But while compiling Python: cd mapscript/python; make; make[1]: Entering directory `/home/jackey.cheung/mapserver-6.2.0-beta1/mapscript/python' python -shadow -modern -templatereduce -fastdispatch -fvirtual -fastproxy -modernargs -castmode -dirvtable -fastinit -fastquery -noproxydel -nobuildnone -DUSE_PROJ_FASTPATHS -DUSE_POINT_Z_M -DUSE_FASTCGI -DUSE_SVG_CAIRO -DUSE_CAIRO -DUSE_FRIBIDI -DUSE_FRIBIDI2 -DUSE_EXSLT -DUSE_XSLT -DUSE_XMLMAPFILE -DUSE_WMS_LYR -DUSE_WFS_LYR -DUSE_SOS_SVR -DUSE_LIBXML2 -DUSE_CURL -DUSE_CURLOPT_PROXYAUTH -DUSE_KML -DUSE_EXEMPI -DUSE_WCS_SVR -DUSE_WFS_SVR -DUSE_WMS_SVR -DUSE_MYSQL -DUSE_POSTGIS -DPOSTGIS_HAS_SERVER_VERSION -DUSE_GDAL -DUSE_OGR -DUSE_GEOS -DHAVE_SYNC_FETCH_AND_ADD -DUSE_THREAD -DUSE_PROJ -DUSE_OGL -DUSE_FTGL -DUSE_GD -DUSE_GD_PNG -DUSE_GD_JPEG -DUSE_GD_GIF -DUSE_ICONV -DUSE_JPEG -DUSE_GIF -DUSE_PNG -DUSE_FREETYPE -DHAVE_VSNPRINTF -DNEED_STRLCPY -DNEED_STRLCAT -DNEED_STRRSTR -DDISABLE_CVSID -o mapscript_wrap.c ../mapscript.i Unknown option: -a usage: python [option] ... [-c cmd | -m mod | file | -] [arg] ... Try `python -h' for more information. Any clue? ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] Python MapScript compile error
python mapscript now requires swig 2.x: install it then rerun configure and make hth, Umberto On Thursday, July 5, 2012, Jackey Cheung wrote: Hi all, Not sure if i've done anything wrong. I've met the Unknown option: -a while compiling Python MapScript. MapServer: Git trunk, CentOS 6 box running on Intel Pentium D. ./configure --with-wms --with-wfs --with-curl --with-jpeg --with-freetype --with-png --with-threads --with-postgis --with-xml2 --with-libiconv --with-proj --with-ogr --with-gdal --with-cairo --with-ftgl --with-opengl --with-threads --with-geos --with-postgis --with-mysql --with-wmsclient --with-wfsclient --with-sos --with-wcs --with-curl --with-kml --with-xml-mapfile --with-xslt --with-fastcgi --with-exempi --with-fribidi-config --with-zlib --with-gd --with-postgis --with-mysql --with-php --with-libsvg-cairo --enable-fast-nint --enable-proj-fastpath --enable-point-z-m --enable-python-mapscript Although I don't need all these features yet, I've decided to test compiling all of them in case I need them in future. Configure went well, and finished with everything. But while compiling Python: cd mapscript/python; make; make[1]: Entering directory `/home/jackey.cheung/mapserver-6.2.0-beta1/mapscript/python' python -shadow -modern -templatereduce -fastdispatch -fvirtual -fastproxy -modernargs -castmode -dirvtable -fastinit -fastquery -noproxydel -nobuildnone -DUSE_PROJ_FASTPATHS -DUSE_POINT_Z_M -DUSE_FASTCGI -DUSE_SVG_CAIRO -DUSE_CAIRO -DUSE_FRIBIDI -DUSE_FRIBIDI2 -DUSE_EXSLT -DUSE_XSLT -DUSE_XMLMAPFILE -DUSE_WMS_LYR -DUSE_WFS_LYR -DUSE_SOS_SVR -DUSE_LIBXML2 -DUSE_CURL -DUSE_CURLOPT_PROXYAUTH -DUSE_KML -DUSE_EXEMPI -DUSE_WCS_SVR -DUSE_WFS_SVR -DUSE_WMS_SVR -DUSE_MYSQL -DUSE_POSTGIS -DPOSTGIS_HAS_SERVER_VERSION -DUSE_GDAL -DUSE_OGR -DUSE_GEOS -DHAVE_SYNC_FETCH_AND_ADD -DUSE_THREAD -DUSE_PROJ -DUSE_OGL -DUSE_FTGL -DUSE_GD -DUSE_GD_PNG -DUSE_GD_JPEG -DUSE_GD_GIF -DUSE_ICONV -DUSE_JPEG -DUSE_GIF -DUSE_PNG -DUSE_FREETYPE -DHAVE_VSNPRINTF -DNEED_STRLCPY -DNEED_STRLCAT -DNEED_STRRSTR -DDISABLE_CVSID -o mapscript_wrap.c ../mapscript.i Unknown option: -a usage: python [option] ... [-c cmd | -m mod | file | -] [arg] ... Try `python -h' for more information. Any clue? ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] python scripting and layers
We have a django script (in python) that writes out the map file based on what the web user requested. We end up with a mapfile for almost every request but they are small and hard drives are cheap so it's been ok. -- John Abraham On May 29, 2012, at 10:53 PM, Jessica Clarke wrote: Hi all, I'm just playing around with some ideas at the moment, so I'm not sure if this will make sense... Is it possible to use a python script to add a layer to an existing mapfile? I have an appliaction that sends a request to mapserver for a map, but I want to be able to add a related shape to the map if the user asks for it. I'm trying to avoid re-writing all the mapfiles to allow for this (there are 30ish)... Any help or direction would be appreciated, Jess Jessica Clarke GIS Infrastructure Officer Forestry Tasmania 79 Melville Street Hobart Tas 7000 (03) 6235 8197 Growing tomorrow's high conservation value forests ‑ Check this out: http://www.youtube.com/watch?v=wP6XCailI‑A - This transmission is intended solely for the person or organisation to whom it is addressed. It is confidential and may contain legally privileged information. If you have received this transmission in error, you may not use, copy or distribute it. Please advise us by return e-mail or by phoning 61 3 6235 8333 and immediately delete the transmission in its entirety. We will meet your reasonable expenses of notifying us. Despite our use of anti-virus software, Forestry Tasmania cannot guarantee that this transmission is virus-free. ___ 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
[mapserver-users] python scripting and layers
Hi all, I'm just playing around with some ideas at the moment, so I'm not sure if this will make sense... Is it possible to use a python script to add a layer to an existing mapfile? I have an appliaction that sends a request to mapserver for a map, but I want to be able to add a related shape to the map if the user asks for it. I'm trying to avoid re-writing all the mapfiles to allow for this (there are 30ish)... Any help or direction would be appreciated, Jess Jessica Clarke GIS Infrastructure Officer Forestry Tasmania 79 Melville Street Hobart Tas 7000 (03) 6235 8197 Growing tomorrow's high conservation value forests ‑ Check this out: http://www.youtube.com/watch?v=wP6XCailI‑A - This transmission is intended solely for the person or organisation to whom it is addressed. It is confidential and may contain legally privileged information. If you have received this transmission in error, you may not use, copy or distribute it. Please advise us by return e-mail or by phoning 61 3 6235 8333 and immediately delete the transmission in its entirety. We will meet your reasonable expenses of notifying us. Despite our use of anti-virus software, Forestry Tasmania cannot guarantee that this transmission is virus-free. ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
[mapserver-users] python mapscript error
Hi everybody, I'm starting to use python mapscript to create web services, but I have a problem when I try to create a new layer. I saw this [0] thread, and I try to apply the patch but it didn't work. I'm running svn version of branches 6 on a Ubuntu OS lucadelu@giswks001:~/compilati/mapserver6-0/mapserver/mapscript/python$ python Python 2.6.6 (r266:84292, Sep 15 2010, 16:22:56) [GCC 4.4.5] on linux2 Type help, copyright, credits or license for more information. import mapscript map = mapscript.mapObj( ) map.name = Orthophoto Merano map.setSize(250, 250) 1 map.setExtent(11.134999, 46.617079, 11.212800, 46.692624) 0 map.imagecolor.setRGB(255, 255, 255) 0 map.units = mapscript.MS_DD layer = mapscript.layerObj() Traceback (most recent call last): File stdin, line 1, in module File mapscript.py, line 807, in __init__ if args and len(args)!=0: NameError: global name 'args' is not defined layer = mapscript.layerObj(map) Traceback (most recent call last): File stdin, line 1, in module File mapscript.py, line 807, in __init__ if args and len(args)!=0: NameError: global name 'args' is not defined [0] http://gis.stackexchange.com/questions/8735/using-mapscript-to-create-a-mapfile-from-scratch -- thanks Luca http://gis.cri.fmach.it/delucchi/ www.lucadelu.org ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
[mapserver-users] python mapscript issue
Hi there, I'm using an example from Ben Kroplas book: Beginning in GIS on how to use Mapscript Python bindings for projecting a map image. For some reason, however, when I attempt to create an image (image = map.draw()) the method does not return anything. It just hangs... see code here: http://codepad.org/jLB7SrFV http://codepad.org/jLB7SrFV -- View this message in context: http://osgeo-org.1803224.n2.nabble.com/python-mapscript-issue-tp5972926p5972926.html Sent from the Mapserver - User mailing list archive at Nabble.com. ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] python mapscript issue
On 11-01-29 12:10 PM, bs wrote: Hi there, I'm using an example from Ben Kroplas book: Beginning in GIS on how to use Mapscript Python bindings for projecting a map image. For some reason, however, when I attempt to create an image (image = map.draw()) the method does not return anything. It just hangs... see code here: http://codepad.org/jLB7SrFV http://codepad.org/jLB7SrFV Hi, When I cause MapServer to crash I always enable debugging (http://www.mapserver.org/optimization/debugging.html), usually the cause will be in the MapServer log file. Then if not I check the Apache log file for the exact URL causing the problem, and then I run that CGI query string at the commandline (again that is documented in that link provided). Sunny Saturday here on the east coast of Canada :) -jeff -- Jeff McKenna MapServer Consulting and Training Services http://www.gatewaygeomatics.com/ ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
[mapserver-users] Python mapscript throwing PostGIS support is not available error
Hi All, I'm getting kinda stumped by this error. I'm running MapServer-5.6.0, Python 2.6, postgresql-8.4.2, and postgis-1.4.1 on an Ubuntu 9.10 box. I've compiled mapserver with PostGIS support... $ /usr/lib/cgi-bin/mapserv -v MapServer version 5.6.0 OUTPUT=GIF OUTPUT=PNG OUTPUT=JPEG OUTPUT=WBMP OUTPUT=SVG SUPPORTS=PROJ SUPPORTS=AGG SUPPORTS=FREETYPE SUPPORTS=ICONV SUPPORTS=WMS_SERVER SUPPORTS=WMS_CLIENT SUPPORTS=WFS_SERVER SUPPORTS=WFS_CLIENT SUPPORTS=WCS_SERVER SUPPORTS=FASTCGI SUPPORTS=THREADS SUPPORTS=GEOS INPUT=TIFF INPUT=EPPL7 INPUT=POSTGIS INPUT=OGR INPUT=GDAL INPUT=SHAPEFILE and I'm able to make a regular old mode=map request via cgi to a layer that is coming from PostGIS. However, when I try to access the same layer via Python mapscript, I get the following error: _mapscript.MapServerError: msDrawMap(): Image handling error. Failed to draw layer named 'roadsPG'. msPostGISLayerOpen(): General error message. PostGIS support is not available. I had omitted to include Postgis support in my MapServer build initially, but did a make clean and rebuilt it. I also re-ran the Python mapscript install afterwards. Is there something else I need to do to clean out the old mapscript module? I'm no distutils expert, so any help would be appreciated. Thanks, Roger -- ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
[mapserver-users] python mapscript - FORMATOPTION
Dear all, I am trying to set FORMATOPTION QUANTIZE_FORCE=ON option using python mapscript. I can successfully use this code snippet to write OUTPUTFORMAT in to my mapfile: of = mapscript.outputFormatObj(AGG/PNG,PNG_AGGAQ) of.name = PNG_AGGAQ of.driver = 'AGG/PNG' of.imagemode = mapscript.MS_IMAGEMODE_RGBA of.mimetype = image/png of.transparent = 1 but of.setOption(FORMATOPTION, QUANTIZE_FORCE=ON) is not creating any result to my mapfile. Is 'setOption' working in python mapscript ? Thanks, Ivan ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] python mapscript - FORMATOPTION
Hi, Just an idea on the fly, because I didn't try it myself, but you could maybe try : of.setOption(QUANTIZE_FORCE, ON) and see what happens... regards Guillaume Le mardi 13 octobre 2009 à 23:54 +0200, Ivan Mincik a écrit : Dear all, I am trying to set FORMATOPTION QUANTIZE_FORCE=ON option using python mapscript. I can successfully use this code snippet to write OUTPUTFORMAT in to my mapfile: of = mapscript.outputFormatObj(AGG/PNG,PNG_AGGAQ) of.name = PNG_AGGAQ of.driver = 'AGG/PNG' of.imagemode = mapscript.MS_IMAGEMODE_RGBA of.mimetype = image/png of.transparent = 1 but of.setOption(FORMATOPTION, QUANTIZE_FORCE=ON) is not creating any result to my mapfile. Is 'setOption' working in python mapscript ? Thanks, Ivan ___ 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
Re: [mapserver-users] python mapscript - FORMATOPTION
On Wed, Oct 14, 2009 at 12:58 AM, Guillaume Sueur no-re...@neogeo-online.net wrote: Hi, Just an idea on the fly, because I didn't try it myself, but you could maybe try : of.setOption(QUANTIZE_FORCE, ON) and see what happens... Thanks a lot Guillaume. It is working, but I am sure, I was also trying something similar too. :) regards Guillaume Le mardi 13 octobre 2009 à 23:54 +0200, Ivan Mincik a écrit : Dear all, I am trying to set FORMATOPTION QUANTIZE_FORCE=ON option using python mapscript. I can successfully use this code snippet to write OUTPUTFORMAT in to my mapfile: of = mapscript.outputFormatObj(AGG/PNG,PNG_AGGAQ) of.name = PNG_AGGAQ of.driver = 'AGG/PNG' of.imagemode = mapscript.MS_IMAGEMODE_RGBA of.mimetype = image/png of.transparent = 1 but of.setOption(FORMATOPTION, QUANTIZE_FORCE=ON) is not creating any result to my mapfile. Is 'setOption' working in python mapscript ? Thanks, Ivan ___ 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
[mapserver-users] Python
Why python mapscript is not used as php mapscript?? What are problems using python mapscript?? If i am using python mapscript can i develop an webgis interface which can perform faster than interfaces built on php-mapscripts such as cartoweb,ka-map etc... Can i get more speed with python mapscript apps.. Is there any benefit in moving from php to python?? anybody please help Any suggestion are always welcomed.. Thanks in advance -- Regards, Mohammed Rashad K.M http://keralainfo.web4all.in/ +919605476742 ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] Python
Hi Mohammed, See comments below... On July 28, 2009 10:33:58 am Mohammed Rashad wrote: Why python mapscript is not used as php mapscript?? PHP is just a lot more popular/easier than python for dynamic websites. I think this is the only reason. What are problems using python mapscript?? There is no problem... If i am using python mapscript can i develop an webgis interface which can perform faster than interfaces built on php-mapscripts such as cartoweb,ka-map etc... There is a no significant performance gain between the two languages. Can i get more speed with python mapscript apps.. I don't understand your question.. if the performance of your application would be very important, you wouldn't choice a mapscript binding. Is there any benefit in moving from php to python?? Of course... the use of python itself. ;) anybody please help Any suggestion are always welcomed.. Thanks in advance Alan -- Alan Boudreault Mapgears http://www.mapgears.com ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] Python
What about OpenLayers ? On July 28, 2009 02:14:41 pm Mohammed Rashad wrote: On Tue, Jul 28, 2009 at 10:34 PM, Alan Boudreault aboudrea...@mapgears.comwrote: Hi Mohammed, See comments below... On July 28, 2009 10:33:58 am Mohammed Rashad wrote: Why python mapscript is not used as php mapscript?? PHP is just a lot more popular/easier than python for dynamic websites. I think this is the only reason. What are problems using python mapscript?? There is no problem... If i am using python mapscript can i develop an webgis interface which can perform faster than interfaces built on php-mapscripts such as cartoweb,ka-map etc... There is a no significant performance gain between the two languages. Can i get more speed with python mapscript apps.. I don't understand your question.. if the performance of your application would be very important, you wouldn't choice a mapscript binding. I need a webgis interface which is used in areas with low bandwidth such as 30kb/s browsing speed. so webgis interface should display maps easily. I used cartoweb in my last project http://keralainfo.web4all.in/ . But it takes a lot time to open website. I also tried KaMap. That's why i thought of changing to python mapscript. Both of these uses php mapscript. Changing to python will help me??? I googled python vs php and got positive response for python. I search and found no webgis interface built on python. So i decided to develop one application. I want to know that python mapscript interface can reduce the problems relating to speed which is low in other interfaces... If all these cant solve my problem , then using mapserver in CGI mode will help? Thanks in advance Is there any benefit in moving from php to python?? Of course... the use of python itself. ;) anybody please help Any suggestion are always welcomed.. Thanks in advance Alan -- Alan Boudreault Mapgears http://www.mapgears.com -- Alan Boudreault Mapgears http://www.mapgears.com ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] python mapscript AGG problem
/tmp/mapserver-5.2.2/mapscript/python# swig -python -shadow -modern -templatereduce -fastdispatch -fvirtual -fastproxy -modernargs -castmode -dirvtable -fastinit -fastquery -noproxydel -nobuildnone -o mapscript_wrap.c ../mapscript.i /tmp/mapserver-5.2.2/mapscript/python# sudo python setup.py install --force python: can't open file 'setup.py': [Errno 2] No such file or directory r...@gislab:/tmp/mapserver-5.2.2/mapscript/python/tests/cases# cd ../.. r...@gislab:/tmp/mapserver-5.2.2/mapscript/python# sudo python setup.py install --force running install running build running build_py running build_ext running install_lib copying build/lib.linux-i686-2.5/_mapscript.so - /usr/lib/python2.5/site-packages copying build/lib.linux-i686-2.5/mapscript.py - /usr/lib/python2.5/site-packages copying build/lib.linux-i686-2.5/mapscript.pyc - /usr/lib/python2.5/site-packages byte-compiling /usr/lib/python2.5/site-packages/mapscript.py to mapscript.pyc running install_egg_info Removing /usr/lib/python2.5/site-packages/mapscript-5.2.2.egg-info Writing /usr/lib/python2.5/site-packages/mapscript-5.2.2.egg-info /tmp/mapserver-5.2.2/mapscript/python# python2.5 Python 2.5.2 (r252:60911, Jul 31 2008, 17:28:52) [GCC 4.2.3 (Ubuntu 4.2.3-2ubuntu7)] on linux2 Type help, copyright, credits or license for more information. import mapscript Traceback (most recent call last): File stdin, line 1, in module File mapscript.py, line 6, in module import _mapscript ImportError: /usr/lib/python2.5/site-packages/_mapscript.so: undefined symbol: _ZN3agg17g_elder_bit_tableE aa :( -- View this message in context: http://n2.nabble.com/python-mapscript-AGG-problem-tp2669010p2674827.html Sent from the Mapserver - User mailing list archive at Nabble.com. ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] python mapscript AGG problem
Hi, I guess that the mapscript you are using with python is not the proper one. Did you go to mapserver/mapscript/python and run setup.py install ? Note that integration of agg in python-mapscript is not trivial due to some limitations in the agg lib. regards Guillaume dzizes a écrit : HEllo! I've compiled mapserver against AGG on linux. My web application that works with mapserver renders nice images with the use of AGG library. /usr/lib/cgi-bin$ ./mapserv -v MapServer version 5.2.2 OUTPUT=GIF OUTPUT=PNG OUTPUT=JPEG OUTPUT=WBMP OUTPUT=SVG SUPPORTS=PROJ SUPPORTS=AGG SUPPORTS=FREETYPE SUPPORTS=ICONV SUPPORTS=WMS_SERVER SUPPORTS=WMS_CLIENT SUPPORTS=WFS_CLIENT SUPPORTS=FASTCGI SUPPORTS=THREADS INPUT=TIFF INPUT=EPPL7 INPUT=ORACLESPATIAL INPUT=OGR INPUT=GDAL INPUT=SHAPEFILE However, when I try to open simple mapfile with mapscript - python craches. Python 2.5.2 (r252:60911, Jul 31 2008, 17:28:52) [GCC 4.2.3 (Ubuntu 4.2.3-2ubuntu7)] on linux2 Type help, copyright, credits or license for more information. import mapscript m = mapscript.mapObj('/tmp/test.map') Traceback (most recent call last): File stdin, line 1, in module File /usr/lib/python2.5/site-packages/mapscript.py, line 1267, in __init__ this = _mapscript.new_mapObj(*args) _mapscript.MapServerError: loadOutputFormat(): General error message. OUTPUTFORMAT clause references driver AGG/PNG, but this driver isn't configured. # mapfile output specification OUTPUTFORMAT NAME png DRIVER AGG/PNG MIMETYPE image/png IMAGEMODE RGB EXTENSION png FORMATOPTION TRANSPARENT=ON FORMATOPTION INTERLACE=OFF FORMATOPTION QUANTIZE_FORCE=OFF END Any ideas what might be wrong? ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
[mapserver-users] python mapscript AGG problem
HEllo! I've compiled mapserver against AGG on linux. My web application that works with mapserver renders nice images with the use of AGG library. /usr/lib/cgi-bin$ ./mapserv -v MapServer version 5.2.2 OUTPUT=GIF OUTPUT=PNG OUTPUT=JPEG OUTPUT=WBMP OUTPUT=SVG SUPPORTS=PROJ SUPPORTS=AGG SUPPORTS=FREETYPE SUPPORTS=ICONV SUPPORTS=WMS_SERVER SUPPORTS=WMS_CLIENT SUPPORTS=WFS_CLIENT SUPPORTS=FASTCGI SUPPORTS=THREADS INPUT=TIFF INPUT=EPPL7 INPUT=ORACLESPATIAL INPUT=OGR INPUT=GDAL INPUT=SHAPEFILE However, when I try to open simple mapfile with mapscript - python craches. Python 2.5.2 (r252:60911, Jul 31 2008, 17:28:52) [GCC 4.2.3 (Ubuntu 4.2.3-2ubuntu7)] on linux2 Type help, copyright, credits or license for more information. import mapscript m = mapscript.mapObj('/tmp/test.map') Traceback (most recent call last): File stdin, line 1, in module File /usr/lib/python2.5/site-packages/mapscript.py, line 1267, in __init__ this = _mapscript.new_mapObj(*args) _mapscript.MapServerError: loadOutputFormat(): General error message. OUTPUTFORMAT clause references driver AGG/PNG, but this driver isn't configured. # mapfile output specification OUTPUTFORMAT NAME png DRIVER AGG/PNG MIMETYPE image/png IMAGEMODE RGB EXTENSION png FORMATOPTION TRANSPARENT=ON FORMATOPTION INTERLACE=OFF FORMATOPTION QUANTIZE_FORCE=OFF END Any ideas what might be wrong? -- View this message in context: http://n2.nabble.com/python-mapscript-AGG-problem-tp2669010p2669010.html Sent from the Mapserver - User mailing list archive at Nabble.com. ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] python mapscript AGG problem
I know that its not proper. It is standard one which goes with default linux package. I'm wandering if there is a way for upgrading python mapscript module with reference to AGG library. -- Michał On Tue, Apr 21, 2009 at 12:38 PM, Guillaume Sueur no-re...@neogeo-online.net wrote: Hi, I guess that the mapscript you are using with python is not the proper one. Did you go to mapserver/mapscript/python and run setup.py install ? Note that integration of agg in python-mapscript is not trivial due to some limitations in the agg lib. regards Guillaume dzizes a écrit : HEllo! I've compiled mapserver against AGG on linux. My web application that works with mapserver renders nice images with the use of AGG library. /usr/lib/cgi-bin$ ./mapserv -v MapServer version 5.2.2 OUTPUT=GIF OUTPUT=PNG OUTPUT=JPEG OUTPUT=WBMP OUTPUT=SVG SUPPORTS=PROJ SUPPORTS=AGG SUPPORTS=FREETYPE SUPPORTS=ICONV SUPPORTS=WMS_SERVER SUPPORTS=WMS_CLIENT SUPPORTS=WFS_CLIENT SUPPORTS=FASTCGI SUPPORTS=THREADS INPUT=TIFF INPUT=EPPL7 INPUT=ORACLESPATIAL INPUT=OGR INPUT=GDAL INPUT=SHAPEFILE However, when I try to open simple mapfile with mapscript - python craches. Python 2.5.2 (r252:60911, Jul 31 2008, 17:28:52) [GCC 4.2.3 (Ubuntu 4.2.3-2ubuntu7)] on linux2 Type help, copyright, credits or license for more information. import mapscript m = mapscript.mapObj('/tmp/test.map') Traceback (most recent call last): File stdin, line 1, in module File /usr/lib/python2.5/site-packages/mapscript.py, line 1267, in __init__ this = _mapscript.new_mapObj(*args) _mapscript.MapServerError: loadOutputFormat(): General error message. OUTPUTFORMAT clause references driver AGG/PNG, but this driver isn't configured. # mapfile output specification OUTPUTFORMAT NAME png DRIVER AGG/PNG MIMETYPE image/png IMAGEMODE RGB EXTENSION png FORMATOPTION TRANSPARENT=ON FORMATOPTION INTERLACE=OFF FORMATOPTION QUANTIZE_FORCE=OFF END Any ideas what might be wrong? ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
[mapserver-users] Python mapscript install errors
I'm installing Python mapscript but keep getting errors. Here is my output: python runalltests.py -v test saving query to a file ... ok simple index query returns one result, even if layer is off ... ok simple point query returns one result, even if layer is off ... ok point query with no results returns NULL ... ok simple point query returns one result ... ok deleting results should not harm the layer ... ok pop a result into the result set ... ok result bounds should equal layer bounds ... ok get the single result member ... ok get all results using list comprehension ... ok denying direct access to layer's resultcache ... ok before a query layer's resultcache should be NULL ... ok string attribute has been renamed to 'text' (bug 852) ... ok testClear (hashtest.ClassMetadataTestCase) ... ok testGetValue (hashtest.ClassMetadataTestCase) ... ok testGetValueWithDefault (hashtest.ClassMetadataTestCase) ... ok testNextKey (hashtest.ClassMetadataTestCase) ... ok testRemoveItem (hashtest.ClassMetadataTestCase) ... ok testUseNonExistentKey (hashtest.ClassMetadataTestCase) ... ok testUseNonExistentKeyWithDefault (hashtest.ClassMetadataTestCase) ... ok testClear (hashtest.HashTableTestCase) ... ok testConstructor (hashtest.HashTableTestCase) ... ok testGetValue (hashtest.HashTableTestCase) ... ok testGetValueWithDefault (hashtest.HashTableTestCase) ... ok testNextKey (hashtest.HashTableTestCase) ... ok testRemoveItem (hashtest.HashTableTestCase) ... ok testUseNonExistentKey (hashtest.HashTableTestCase) ... ok testUseNonExistentKeyWithDefault (hashtest.HashTableTestCase) ... ok testClear (hashtest.LayerMetadataTestCase) ... ok testGetValue (hashtest.LayerMetadataTestCase) ... ok testGetValueWithDefault (hashtest.LayerMetadataTestCase) ... ok testNextKey (hashtest.LayerMetadataTestCase) ... ok testRemoveItem (hashtest.LayerMetadataTestCase) ... ok testUseNonExistentKey (hashtest.LayerMetadataTestCase) ... ok testUseNonExistentKeyWithDefault (hashtest.LayerMetadataTestCase) ... ok testClear (hashtest.WebMetadataTestCase) ... ok testGetValue (hashtest.WebMetadataTestCase) ... ok testGetValueWithDefault (hashtest.WebMetadataTestCase) ... ok testNextKey (hashtest.WebMetadataTestCase) ... ok testRemoveItem (hashtest.WebMetadataTestCase) ... ok testUseNonExistentKey (hashtest.WebMetadataTestCase) ... ok testUseNonExistentKeyWithDefault (hashtest.WebMetadataTestCase) ... ok check attributes of a cloned class ... ok testAlphaTransparentPixmap (classtest.ClassIconTestCase) ... ok testAlphaTransparentPixmapJPG (classtest.ClassIconTestCase) ... ERROR testAlphaTransparentPixmapPNG24 (classtest.ClassIconTestCase) ... ok testIndexedTransparentPixmap (classtest.ClassIconTestCase) ... ok testIndexedTransparentPixmapJPG (classtest.ClassIconTestCase) ... ERROR testConstructorNoArg (classtest.ClassObjTestCase) ... ok testConstructorWithArg (classtest.ClassObjTestCase) ... ok EmptyMapExceptionTestCase.testDrawEmptyMap: drawing an empty map returns proper error ... ok MapConstructorTestCase.testMapConstructorEmptyStringArg: test map constructor with old-style empty string argument ... ok MapConstructorTestCasetest.testMapConstructorEmptyStringArg: map constructor with filename argument ... ok MapConstructorTestCase.testMapConstructorNoArg: test map constructor with no argument ... ok MapExceptionTestCase.testDrawBadData: a bad data descriptor in a layer returns proper error ... ok test the rebinding of a map's extent ... ok MapExtentTestCase.testSetExtent: test the setting of a mapObj's extent ... ok MapExtentTestCase.testSetExtentBadly: test that mapscript raises an error for an invalid mapObj extent ... ok expect fontset file to be 'fonts.txt' ... ok MapLayersTestCase.testMapInsertLayer: test insertion of a new layer at default (last) index ... ok MapLayersTestCase.testMapInsertLayerAtZero: test insertion of a new layer at first index ... ok MapLayersTestCase.testMapInsertLayerBadIndex: expect an exception when index is too large ... ok MapLayersTestCase.testMapInsertLayerDrawingOrder: test affect of insertion of a new layer at index 1 on drawing order ... ok expect an exception on attempt to insert a NULL Layer ... ok removal of highest index (tail) layer ... ok removal of lowest index (0) layer ... ok test affect of layer removal on drawing order ... ok MapMetaDataTestCase.testClassMetaData: class metadata keys are correct values ... ok MapMetaDataTestCase.testFirstKeyAccess: first metadata key is correct value ... ok MapMetaDataTestCase.testInvalidKeyAccess: an invalid map metadata key returns proper error ... ok MapMetaDataTestCase.testLastKeyAccess: last metadata key is correct value ... ok MapMetaDataTestCase.testLayerMetaData: layer metadata keys are correct values ... ok MapMetaDataTestCase.testMapMetaData: map metadata keys are correct values ... ok testESRIWKT (maptest.MapSetWKTTestCase) ... ok testOGCWKT (maptest.MapSetWKTTestCase) ... ok testWellKnownGEOGCS (maptest.MapSetWKTTestCase) ... ok testDefaultSize
[mapserver-users] Python mapscript: inline point feature How To
Hi Everyone, A little while ago, Brent Fraser sent me a mapfile snippet that could be used to add a Title to a map using pixel coordinate space. It looked like this: LAYER NAME title STATUS DEFAULT TRANSFORM FALSE TYPE ANNOTATION FEATURE POINTS 4 396 END TEXT 'This is a Great Map!' END CLASS LABEL TYPE TRUETYPE FONT arial SIZE 8 ANTIALIAS COLOR 255 255 255 POSITION UR END END END This works well, but I would like to override the TEXT value using mapscript to create new labels that are based on the result of PostGIS queries. I've been picking apart various examples on the web, but can't seem to come up with the magic sauce. I can figure out how to grab the layer ByName, but then I'm not quite sure what I need to do in order to access the feature and override the TEXT. Can someone give me a clue? Thanks, Roger ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
[mapserver-users] Python mapscript, cStringIO, and the AGG renderer
Hi All, I'm having problems using the AGG renderer with Python mapscript. I believe it may be due to the way in which I am writing the image into a cStringIO.StringIO() object, but I'm not sure. I do know that if I comment out my OUTPUTFORMAT section of the mapfile, I get an image back in my browser. I'm hoping I can fix this somehow with a FORMATOPTION. - Below is the mapscript and Python CGI: #! /usr/bin/python import mapscript import cStringIO def DrawMap(): mapfile = /var/www/mapfiles/gis_layers/gis_layers.map mapobject = mapscript.mapObj(mapfile) mapimage = mapobject.draw() f = cStringIO.StringIO() mapimage.write(f) print Content-type: image/png\n f.seek(0) print f.read() print mapimage if __name__ == __main__: DrawMap() - And here is the OUTPUTFORMAT section that's causing the problem: OUTPUTFORMAT NAME 'AGG' DRIVER AGG/PNG IMAGEMODE RGB END Thanks, Roger -- ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] Python mapscript, cStringIO, and the AGG renderer
I'm having problems using the AGG renderer with Python mapscript. what version of mapserver, and exactly what problem? regards, thomas ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] Python mapscript, cStringIO, and the AGG renderer
- MapServer version 5.2.0 [image: The image http://localhost/cgi-bin/mapscript/dynamic_map.py; cannot be displayed, because it contains errors.]- The image cannot be displayed, because it contains errors. -- On Sun, Feb 1, 2009 at 12:05 PM, thomas bonfort thomas.bonf...@gmail.comwrote: I'm having problems using the AGG renderer with Python mapscript. what version of mapserver, and exactly what problem? regards, thomas ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] python mapscript - creating vector symbols on the fly?
David, after a quick look it seems that the API is there, although I am not entirely sure whether it is stable or tested. in pseudocode: symbol=new symbolObj() //set attributes of symbol map-symbolset.append(symbol) Regards, Umberto On Wed, Sep 24, 2008 at 10:09 PM, Fawcett, David [EMAIL PROTECTED] wrote: In Python mapscript, is it possible to construct a vector symbol, like a circle, without referencing a mapfile or a symbolset file? Essentially, build this in code: SYMBOL NAME 'circle' TYPE ELLIPSE POINTS 1 1 END FILLED TRUE END If so, a few lines of code would be greatly appreciated... David. ___ 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
[mapserver-users] python mapscript - creating vector symbols on the fly?
In Python mapscript, is it possible to construct a vector symbol, like a circle, without referencing a mapfile or a symbolset file? Essentially, build this in code: SYMBOL NAME 'circle' TYPE ELLIPSE POINTS 1 1 END FILLED TRUE END If so, a few lines of code would be greatly appreciated... David. ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users