Re: [mapserver-users] MapScript import errors (Module not found) in Python venv with global install

2022-05-02 Thread Seth G
Glad it's working for you, and good to know it can work alongside QGIS. 
The GISInternal Python MapScripts I think are built with SWIG 2.0, whereas I 
compiled those wheels with the latest version of SWIG 4.0.2/master build. That 
may explain why the GISInternals don't work with more recent Python versions. 

Seth

--
web:https://geographika.net
twitter: @geographika


On Mon, May 2, 2022, at 3:38 PM, maëlle lapriel wrote:
> Hi Seth,
> 
> It is working fine with Python 3.6 and the corresponding GISInternals build 
> until I try it in a venv, however it's not working on any other Python 
> version (and matching GISInternals) regardless of venv or not. Regarding venv 
> and env variables, it doesn't seem that anything gets wiped when activating a 
> venv.
> 
> Interestingly, I got it working on all tested Python versions (3.6, 3.7, 3.9) 
> by installing MapScript using your wheels instead of using the MapScript that 
> ships with MapServer, both in venv and outside, and together with QGIS 
> loaded. I have no idea what exactly the difference is ultimately, but at 
> least I have a working environment now, so many thanks!
> 
> On Fri, 29 Apr 2022 at 10:15, Seth G  wrote:
>> __
>> Hi,
>> 
>> As you wrote, the version of Python needs to match the version of Python 
>> used by GISInternals (which is different dependent on the package) e.g. 
>> https://www.gisinternals.com/packageinfo.php?file=release-1928-x64-gdal-3-4-2-mapserver-7-6-4.zip
>>  - "python - Python37-AMD64"
>> 
>> Is everything working fine until you setup a virtual environment? This could 
>> be because activating a Python virtual environment on Windows seems to wipe 
>> out any previously set environment variables in the session. Try activating 
>> the virtual environment, and then running SDKShell.bat (or simply setting 
>> the environment variables you need from that file).
>> 
>> SET PATH=C:\MapServer\bin;%PATH%
>> SET PROJ_LIB=C:\MapServer\proj7\SHARE
>> SET MAPSERVER_DLL_PATH=C:\MapServer\bin
>> 
>> I have some experimental MapScript Wheels [1] built for various versions of 
>> Python with a recent MapServer development build, which could work with a 
>> release-1930-x64 development build [2]. 
>> 
>> Seth
>> 
>> [1] https://github.com/geographika/python-mapscript/tree/main/wheels
>> [2] 
>> https://www.gisinternals.com/query.html?content=filelist=release-1930-x64-gdal-mapserver.zip
>> --
>> web:https://geographika.net
>> twitter: @geographika
>> 
>> 
>> On Fri, Apr 29, 2022, at 9:08 AM, maëlle lapriel wrote:
>>> Hi Seth,
>>> 
>>> I've considered this to be the problem, however I can rule out any 
>>> dependency conflicts already since I also tried to simply just get 
>>> MapScript running in a Python env without any other imports.
>>> Am I assuming right that for just using MapScript alone, I can just run the 
>>> SDKShell.bat to have all the variables set, then take a Python version that 
>>> matches the GISInternals build and I'm good to go? Because that already 
>>> yields mentioned import errors, with every possible build or Python version 
>>> except 3.6 and MapServer 7.6.1, which also stops working as soon as I set 
>>> up a venv. 
>>> 
>>> Thank you very much for your help.
>>> 
>>> Cheers
>>> 
>>> On Thu, Apr 28, 2022, 18:25 Seth G  wrote:
 __
 Hi Maëlle,
 
 MapScript (and MapServer) use many of the same dependent DLLs as QGIS - 
 GDAL, Proj, GEOS etc. which would then get loaded into memory by Python. 
 For everything to work correctly, all these dependencies would have to be 
 the same version, and (I think this is still the case), compiled with the 
 same version of Microsoft Visual C (the 1928, 1931 etc. use when naming 
 the GISInternals zips). 
 It probably would be possible to get everything build and working, but 
 you'd likely have to compile everything yourself. 
 Is it possible to modify your workflow so a PyQGIS environment dumps out 
 data to disk and then a MapScript environment works on this data? 
 I'd imagine PyQGIS can probably do everything MapScript can, except for 
 manipulate Mapfiles - you could take a look at mappyfile for this, which 
 is Python only has has no dependent DLLs.
 
 Seth
 
 --
 web:https://geographika.net
 twitter: @geographika
 
 
 On Thu, Apr 28, 2022, at 11:42 AM, maëlle lapriel wrote:
> I'm trying to write a PyQGIS standalone script which utilizes MapScript 
> for certain tasks. In a first attempt, I basically did this:
> 
> - I installed MapScript globally with pip and using the Python 3.9.5 
> interpreter which ships with QGIS 3.22.6 (also includes wheel)
> - Created a venv with --system-site-packages
> - Downloaded the appropriate Windows binary build of MapServer from 
> GISInternals (release-1928-x64-gdal-3-4-mapserver-7-6) and extracted into 
> C:\MapServer\
> - Set the MAPSERVER_DLL_PATH to C:\MapServer\bin
> 
> However, whenever I try 

Re: [mapserver-users] MapScript import errors (Module not found) in Python venv with global install

2022-05-02 Thread maëlle lapriel
Hi Seth,

It is working fine with Python 3.6 and the corresponding GISInternals build
until I try it in a venv, however it's not working on any other Python
version (and matching GISInternals) regardless of venv or not. Regarding
venv and env variables, it doesn't seem that anything gets wiped when
activating a venv.

Interestingly, I got it working on all tested Python versions (3.6, 3.7,
3.9) by installing MapScript using your wheels instead of using the
MapScript that ships with MapServer, both in venv and outside, and together
with QGIS loaded. I have no idea what exactly the difference is ultimately,
but at least I have a working environment now, so many thanks!

On Fri, 29 Apr 2022 at 10:15, Seth G  wrote:

> Hi,
>
> As you wrote, the version of Python needs to match the version of Python
> used by GISInternals (which is different dependent on the package) e.g.
> https://www.gisinternals.com/packageinfo.php?file=release-1928-x64-gdal-3-4-2-mapserver-7-6-4.zip
> - "python - Python37-AMD64"
>
> Is everything working fine until you setup a virtual environment? This
> could be because activating a Python virtual environment on Windows seems
> to wipe out any previously set environment variables in the session. Try
> activating the virtual environment, and then running SDKShell.bat (or
> simply setting the environment variables you need from that file).
>
> SET PATH=C:\MapServer\bin;%PATH%
> SET PROJ_LIB=C:\MapServer\proj7\SHARE
> SET MAPSERVER_DLL_PATH=C:\MapServer\bin
>
> I have some experimental MapScript Wheels [1] built for various versions
> of Python with a recent MapServer development build, which could work with
> a release-1930-x64 development build [2].
>
> Seth
>
> [1] https://github.com/geographika/python-mapscript/tree/main/wheels
> [2]
> https://www.gisinternals.com/query.html?content=filelist=release-1930-x64-gdal-mapserver.zip
> --
> web:https://geographika.net
> twitter: @geographika
>
>
> On Fri, Apr 29, 2022, at 9:08 AM, maëlle lapriel wrote:
>
> Hi Seth,
>
> I've considered this to be the problem, however I can rule out any
> dependency conflicts already since I also tried to simply just get
> MapScript running in a Python env without any other imports.
> Am I assuming right that for just using MapScript alone, I can just run
> the SDKShell.bat to have all the variables set, then take a Python version
> that matches the GISInternals build and I'm good to go? Because that
> already yields mentioned import errors, with every possible build or Python
> version except 3.6 and MapServer 7.6.1, which also stops working as soon as
> I set up a venv.
>
> Thank you very much for your help.
>
> Cheers
>
> On Thu, Apr 28, 2022, 18:25 Seth G  wrote:
>
>
> Hi Maëlle,
>
> MapScript (and MapServer) use many of the same dependent DLLs as QGIS -
> GDAL, Proj, GEOS etc. which would then get loaded into memory by Python.
> For everything to work correctly, all these dependencies would have to be
> the same version, and (I think this is still the case), compiled with the
> same version of Microsoft Visual C (the 1928, 1931 etc. use when naming the
> GISInternals zips).
> It probably would be possible to get everything build and working, but
> you'd likely have to compile everything yourself.
> Is it possible to modify your workflow so a PyQGIS environment dumps out
> data to disk and then a MapScript environment works on this data?
> I'd imagine PyQGIS can probably do everything MapScript can, except for
> manipulate Mapfiles - you could take a look at mappyfile for this, which is
> Python only has has no dependent DLLs.
>
> Seth
>
> --
> web:https://geographika.net
> twitter: @geographika
>
>
> On Thu, Apr 28, 2022, at 11:42 AM, maëlle lapriel wrote:
>
> I'm trying to write a PyQGIS standalone script which utilizes MapScript
> for certain tasks. In a first attempt, I basically did this:
>
> - I installed MapScript globally with pip and using the Python 3.9.5
> interpreter which ships with QGIS 3.22.6 (also includes wheel)
> - Created a venv with --system-site-packages
> - Downloaded the appropriate Windows binary build of MapServer from
> GISInternals (release-1928-x64-gdal-3-4-mapserver-7-6) and extracted into
> C:\MapServer\
> - Set the MAPSERVER_DLL_PATH to C:\MapServer\bin
>
> However, whenever I try to load MapScript, it yields the following:
>
> Traceback (most recent call last):
>   File "", line 1, in 
>   File "C:\QGIS\apps\Python39\lib\site-packages\mapscript\__init__.py",
> line 2, in 
> from .mapscript import *
>   File "C:\QGIS\apps\Python39\lib\site-packages\mapscript\mapscript.py",
> line 13, in 
> from . import _mapscript
> ImportError: DLL load failed while importing _mapscript: The specified
> module could not be found.
>
> As to where the README over at github indicates that this means
> MapServer.dll can't be found.
>
> In order to rule out possible issues, I also tried the following:
>
> - Not creating a venv, but using it with the QGIS python version directly
> - 

Re: [mapserver-users] mapserver OGR does not forward BBOX at all

2022-05-02 Thread Lars Fricke

  
  

  Hi,
  
  one of our partners just came across something that may be related
  to this issue:
  
  https://www.mail-archive.com/fossgis-talk-liste@fossgis.de/msg07092.html
  
  where it says to set the environment variable "OGR_SKIP" to "NAS"
  for certain servers (the one causing this issue seems to be one of
  those). Once the variable is set, OGR itself can properly work
  with that server. Is there a setting for this I could put into the
  map file? Or can I use a similar environment variable for
  mapserver itself? Just setting "OGR_SKIP" does not do the trick,
  seems to only work for a separate OGR installation.
  
  Thanks for any hint.
  
  Lars


Am 01.04.22 um 14:32 schrieb Rahkonen
  Jukka (MML):


  
  
  
  
Hi,
 
(Clipped out most of the thread because the max
size of message body was exceeded).
 
That server does answer to GetCapabilities and
DescribeFeatureType with WFS 1.0.0 but not to GetFeature. It
gives an error about wrong outputformat even that it not
mandatory to the standard, and it does not accept GML2 even
GetCapabilities is listing it as a supported format. So yes,
the service is broken with WFS 1.0.0.
 
I suggested to try WFS connection and WFS 1.0.0
version as a comparison to OGR connection and WFS 1.1.0 but
it is best to forget that test now. I don’t know what to
suggest next. Myself I guess I would install Geoserver into
localhost with the standard demo data and make a Mapserver
layer from the topp:states feature type and see how it
behaves. I do know that I have used Geoserver WFS as input
for Mapserver WMS and it worked well but that was a long
time ago and I believe I used the WFS connectiontype.
 
-Jukka Rahkonen-
 
Lähettäjä: Lars Fricke 

Lähetetty: perjantai 1. huhtikuuta 2022 14.54
Vastaanottaja: Rahkonen Jukka (MML) ;
  mapserver-users@lists.osgeo.org
Aihe: Re: [mapserver-users] mapserver OGR does not
forward BBOX at all
 
Hi,
I just checked on using that server with WFS 1.0.0 but it is
broken. Not even QGIS can open it, neither here nor in the 
browser any geometry is provided.
So it looks as mapserver can not work with these? 
  Thanks again
 
 
 
  
  
  
  ___
MapServer-users mailing list
MapServer-users@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/mapserver-users



  


OpenPGP_0x667E0B7B73E250FB.asc
Description: OpenPGP public key


OpenPGP_signature
Description: OpenPGP digital signature
___
MapServer-users mailing list
MapServer-users@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/mapserver-users


Re: [mapserver-users] Any trick to buffer labelpoly?

2022-05-02 Thread Rahkonen Jukka (MML)
Hi Steve,

That's not my problem, I just wondered if we could help the original poster. 
But the OP was clever enough to use a wide outline with the fill color and that 
probably gives a satisfactory result though not perfect. The wide line grows 
both outwards and inwards and the partial transparency is not perfect where the 
fill meets the outline. And when a  colored outline is widened it starts to 
paint over the label text.

-Jukka-

Lähettäjä: Steve Lime 
Lähetetty: perjantai 29. huhtikuuta 2022 17.07
Vastaanottaja: Rahkonen Jukka (MML) 
Kopio: Mapserver-Users (mapserver-users@lists.osgeo.org) 

Aihe: Re: [mapserver-users] Any trick to buffer labelpoly?

Looks like there were some new responses on the post referenced. Will those 
work for you? Otherwise we'd have to re-think the label poly geomtranform to 
either allow an argument or be embedded in a more complex expression.

On Fri, Apr 29, 2022 at 1:24 AM Rahkonen Jukka (MML) 
mailto:jukka.rahko...@maanmittauslaitos.fi>>
 wrote:
Hi,

There is a wish to buffer the labelpoly in 
https://gis.stackexchange.com/questions/429779/mapserver-background-buffer-around-labels-geomtransform-labelpoly
 but it does not seem to be supported directly. Can anybody suggest a trick or 
workaround?

-Jukka Rahkonen-

___
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