Re: [mapserver-users] CONNECTIONTYPE OGR is not working after upgrade to mapserver 7.2.2 from 6.4.1

2019-04-05 Thread Lars Fricke

  
  
Hi Jeff,
  
  You really did it! I was searching for missing libs, version
  mismatches and wrong path variables but it was as simple as using
  the xml file the way you pointed out. 
  I can confirm that everything works as expected now. I'd like to
  point out though (for the record) that the step of 

ogrinfo wfs-request.xm
  
  does not only test the file but also prepares it to be used. I
  tested using the file without first using ogrinfo but that did not
  succeed.
  
  I still do not understand why this was not needed in Mapserver 6
  but anyway the problem is solved.
  
  Thanks so much for putting in all that effort and time to help so
  very quickly.  I think this list is one of the greatest strength
  of Mapserver and I want to thank everybody who is helping here!
  
  Best
  Lars

  
SkenData GmbH
  

Am 04.04.19 um 19:13 schrieb Jeff
  McKenna:

Thanks
  for providing the response, which indeed states "only WFS 1.0.0 or
  0.0.14".
  
  
  I just followed the GDAL WFS driver page now, and locally was able
  to generate a map image with a VERSION=1.1.0 request, with the
  following steps:
  
  
  
  
  - (the following steps are adapted from the GDAL WFS driver page
  https://gdal.org/drv_wfs.html )
  
  
  - create a new file named "wfs-request.xml"
  
  
  - paste the contents of:
  
  
    
  
  
http://demo.mapserver.org/cgi-bin/wfs?SERVICE=WFSVERSION=1.1.0MAXFEATURES=1000
  
    
  
  
  - (notice the escaped "&" as noted on the GDAL WFS driver
  page)
  
  
  - make a copy of that file (copy/paste "wfs-request.xml" ) in case
  it is overwritten by this process
  
  
  - test this file/connection through the commandline:
  
  
      ogrinfo wfs-request.xml
  
  
  - you should see a response listing the available layers:
  
  
  INFO: Open of `wfs-request.xml'
  
      using driver `WFS' successful.
  
      1: continents
  
      2: cities
  
      
  - now we know the name to use in our MapServer layer "DATA"
  parameter, so in this case we will use "continents"
  
      
  - edit your .map file and point your layer to that wfs-request.xml
  in the CONNECTION, and set the correct DATA parameter from the
  ogrinfo response above, such as:
  
  
  LAYER
  
    NAME "continents-test"
  
    TYPE POLYGON
  
    STATUS ON
  
    CONNECTION "wfs-request.xml"
  
    CONNECTIONTYPE OGR
  
    DATA "continents"
  
    PROJECTION
  
      "init=epsg:4326"
  
    END
  
    CLASS
  
      NAME "My Continents"
  
      STYLE
  
    COLOR 255 128 128
  
    OUTLINECOLOR 96 96 96
  
      END
  
    END
  
  END # Layer
  
  
  - (use my small mapfile for testing: https://pastebin.com/GYrXyc9A
  )
  
  
  - now finally have MapServer generate a map image from that WFS
  version 1.1.0 connection, by testing at the commandline:
  
  
  shp2img -m wfs-110-client.map -o ttt.png -all_debug 5
  
  
  
  - a file named 'ttt.png' should be generated of the map image, and
  at the commandline the response should end with something like:
  
  
  msSaveImage(ttt.png) total time: 0.015s
  
  msFreeMap(): freeing map at 00228B70.
  
  freeLayer(): freeing layer at 001F1828.
  
  shp2img total time: 3.013s
  
  
  
  *** tested with MS4W 4.0.0 (MapServer 7.4.0-dev, GDAL 2.4.0)
  
  
  Hope that helps,
  
  
  -jeff
  
  


  

___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/mapserver-users

Re: [mapserver-users] CONNECTIONTYPE OGR is not working after upgrade to mapserver 7.2.2 from 6.4.1

2019-04-04 Thread Jeff McKenna
Thanks for providing the response, which indeed states "only WFS 1.0.0 
or 0.0.14".


I just followed the GDAL WFS driver page now, and locally was able to 
generate a map image with a VERSION=1.1.0 request, with the following steps:




- (the following steps are adapted from the GDAL WFS driver page 
https://gdal.org/drv_wfs.html )


- create a new file named "wfs-request.xml"

- paste the contents of:

  

http://demo.mapserver.org/cgi-bin/wfs?SERVICE=WFSVERSION=1.1.0MAXFEATURES=1000
  

- (notice the escaped "&" as noted on the GDAL WFS driver page)

- make a copy of that file (copy/paste "wfs-request.xml" ) in case it is 
overwritten by this process


- test this file/connection through the commandline:

ogrinfo wfs-request.xml

- you should see a response listing the available layers:

INFO: Open of `wfs-request.xml'
using driver `WFS' successful.
1: continents
2: cities

- now we know the name to use in our MapServer layer "DATA" parameter, 
so in this case we will use "continents"


- edit your .map file and point your layer to that wfs-request.xml in 
the CONNECTION, and set the correct DATA parameter from the ogrinfo 
response above, such as:


LAYER
  NAME "continents-test"
  TYPE POLYGON
  STATUS ON
  CONNECTION "wfs-request.xml"
  CONNECTIONTYPE OGR
  DATA "continents"
  PROJECTION
"init=epsg:4326"
  END
  CLASS
NAME "My Continents"
STYLE
  COLOR 255 128 128
  OUTLINECOLOR 96 96 96
END
  END
END # Layer

- (use my small mapfile for testing: https://pastebin.com/GYrXyc9A )

- now finally have MapServer generate a map image from that WFS version 
1.1.0 connection, by testing at the commandline:


shp2img -m wfs-110-client.map -o ttt.png -all_debug 5

- a file named 'ttt.png' should be generated of the map image, and at 
the commandline the response should end with something like:


msSaveImage(ttt.png) total time: 0.015s
msFreeMap(): freeing map at 00228B70.
freeLayer(): freeing layer at 001F1828.
shp2img total time: 3.013s

*** tested with MS4W 4.0.0 (MapServer 7.4.0-dev, GDAL 2.4.0)

Hope that helps,

-jeff

--
Jeff McKenna
MapServer Consulting and Training Services
https://gatewaygeomatics.com/





___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/mapserver-users

Re: [mapserver-users] CONNECTIONTYPE OGR is not working after upgrade to mapserver 7.2.2 from 6.4.1

2019-04-04 Thread Lars Fricke

  
  
Thanks for the new test
  procedure.
  
  With CONNECTIONTYPE WFS, the result of shp2img -m wfs.map -o
  ttt.png -map_debug 3 is:
  
  [Thu Apr  4 17:07:24 2019].401414 msDrawMap(): rendering using
  outputformat named png (AGG/PNG).
  [Thu Apr  4 17:07:24 2019].401868 msBuildWFSLayerPostRequest():
  WFS connection error. MapServer supports only WFS 1.0.0 or 0.0.14
  (please verify the version metadata wfs_version).
  [Thu Apr  4 17:07:24 2019].401915 HTTP: Starting to prepare HTTP
  requests.
  [Thu Apr  4 17:07:24 2019].401938 HTTP request: id=0,
  http://...?VERSION=1.1.0=WFS
  [Thu Apr  4 17:07:24 2019].416343 HTTP: Before download loop
  [Thu Apr  4 17:07:24 2019].765563 msHTTPWriteFct(id=0, 633 bytes)
  [Thu Apr  4 17:07:24 2019].765634 HTTP: After download loop
  [Thu Apr  4 17:07:24 2019].765644 msHTTPExecuteRequests() timing
  summary per layer (connect_time + time_to_first_packet +
  download_time = total_time in seconds)
  [Thu Apr  4 17:07:24 2019].765703 Layer 0: 0.133 + 0.216 + 0.133 =
  0.482s
  [Thu Apr  4 17:07:24 2019].765778 msDrawMap(): WMS/WFS set-up and
  query, 0.364s
  [Thu Apr  4 17:07:24 2019].765846 msWFSLayerWhichShapes(): WFS
  connection error. WFS request produced unexpected output (junk?)
  for layer TEST.
  [Thu Apr  4 17:07:24 2019].765857 msDrawMap(): Image handling
  error. Failed to draw layer named 'TEST'.
  [Thu Apr  4 17:07:24 2019].766103 freeLayer(): freeing layer at
  0x555b50b2ddf0.
  
  With CONNECTIONTYPE OGR it is:
  
  [Thu Apr  4 17:10:07 2019].478955 msDrawMap(): rendering using
  outputformat named png (AGG/PNG).
  [Thu Apr  4 17:10:07 2019].478985 msDrawMap(): WMS/WFS set-up and
  query, 0.000s
  [Thu Apr  4 17:10:07 2019].478995
  msOGRFileOpen(http:?VERSION=1.1.0=WFS)...
  [Thu Apr  4 17:10:07 2019].479005
  OGROPen(http:?VERSION=1.1.0=WFS)
  [Thu Apr  4 17:10:07 2019].758210
msConnPoolRegister(TEST,http:?VERSION=1.1.0=WFS,0x56312442ab90)
  [Thu Apr  4 17:10:07 2019].758261 msOGRFileOpen(): OGR error.
  GetLayer(EXTERNAL_TEST_LAYER) failed for OGR connection. Check
  logs.
  [Thu Apr  4 17:10:07 2019].758270 GetLayer(EXTERNAL_LAYER) failed
  for OGR connection `http:?VERSION=1.1.0=WFS'.
  [Thu Apr  4 17:10:07 2019].758278
msConnPoolRelease(TEST,http:?VERSION=1.1.0=WFS,0x56312442ab90)
  [Thu Apr  4 17:10:07 2019].758285
  msConnPoolClose(http:?VERSION=1.1.0=WFS,0x56312442ab90)
  [Thu Apr  4 17:10:07 2019].758321 msDrawMap(): Image handling
  error. Failed to draw layer named 'TEST'.
  [Thu Apr  4 17:10:07 2019].758531 freeLayer(): freeing layer at
  0x563124489df0.
  
- Lars
  

___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/mapserver-users

Re: [mapserver-users] CONNECTIONTYPE OGR is not working after upgrade to mapserver 7.2.2 from 6.4.1

2019-04-04 Thread Lars Fricke

  
  
@ Lars Schylberg
  
  Thank you for your valuable hint and the very fast reply, I just
  got out of another task and tried immediately. 
  
  Apache2 error.log now gives me:
  HTTP: Fetch(http://...?VERSION=1.1.0=WFS)
  HTTP: libcurl/7.58.0 GnuTLS/3.5.18 zlib/1.2.11 libidn2/2.0.4
  libpsl/0.19.1 (+libidn2/2.0.4) nghttp2/1.30.0 librtmp/2.3
  HTTP: These HTTP headers were set: Accept: text/plain,
  application/json
  GeoJSONSeq: First pass: 100.00 %
  GDAL: GDALOpen(http://...?VERSION=1.1.0=WFS,
  this=0x565136f44fe0) succeeds as GeoJSONSeq.
  GDAL: GDALClose(http://...?VERSION=1.1.0=WFS,
  this=0x565136f44fe0)
  
  That does not really look like an error. The error displayed in
  the browser however remains the same.
  
  @ Jeff McKenna
  Thank you for taking thought upon this. Unfortunately the remote
  server only supports WFS 1.1.0 and up while to my knowledge
  mapserver only has native client support for WFS 1.0.0 . A
  colleague from a partner company has tried with 1.1.0 and the
  spacial filtering did not work. If there is a native way to use
  WFS 1.1.0 as client, I will be happy to check it out.


  Best
  Lars
  
SkenData GmbH
  

  

___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/mapserver-users

Re: [mapserver-users] CONNECTIONTYPE OGR is not working after upgrade to mapserver 7.2.2 from 6.4.1

2019-04-04 Thread Jeff McKenna
To access a remote WFS service, be sure to set CONNECTIONTYPE WFS in 
your layer, as in the example at 
https://mapserver.org/ogc/wfs_client.html#example-wfs-layer


I guess I am not understanding your question properly.

-jeff



--
Jeff McKenna
MapServer Consulting and Training Services
https://gatewaygeomatics.com/



On 2019-04-04 5:23 AM, Lars Fricke wrote:

Hello,

First of all: thank you for your time!

I have been running into a strange problem lately. We have a server 
running mapserver 6.4.1 (Debian GNU/Linux 8.0 jessie) that is accessing 
a remote WFS as client without any problems.
We have another (local development) server that has been upgraded to 
mapserver 7.2.2 (Ubuntu 18.04 bionic) and that can no longer access the 
WFS. Everything was fine with the older versions on that server, too 
(not certain if the mapserver upgrade happened at the same time as the 
Ubuntu upgrade).


The error received is:
msOGRFileOpen(): OGR error. GetLayer(LAYER_NAME) failed for OGR 
connection. Check logs.


The logs are not giving me any further information. Even I put debug 
level to 5 already. Also apache log is not giving me any clue, there is 
no error. Other layers on the same server open fine, as long a they do 
not need OGR. So I assume it is not a connection issue.

ogrinfo however can access the external WFS fine from the terminal.

Configuration:
Mapserver 7.2.2
gdal-bin 2.4.0+dfsg-1~bionic0 (from UbuntuGIS - unstable repo)
Ubuntu 18.04 bionic

I also have NextGIS repository activated but it does not seem that 
gdal/ogr is installed from there.


mapserv -v shows:
MapServer version 7.2.2 OUTPUT=PNG OUTPUT=JPEG OUTPUT=KML SUPPORTS=PROJ 
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=SOS_SERVER SUPPORTS=FASTCGI 
SUPPORTS=THREADS SUPPORTS=GEOS SUPPORTS=PBF INPUT=JPEG INPUT=POSTGIS 
INPUT=OGR INPUT=GDAL INPUT=SHAPEFILE


I have also checkt $Path:
/home/lars/bin /usr/local/sbin /usr/local/bin /usr/sbin /usr/bin /sbin 
/bin /usr/games /usr/local/games /snap/bin


I am not certain, if that is correct but ogr seems to be in /usr/bin so 
I'd expect it's available for mapserver, too.
gdalinfo --formats does not show WFS, if that is the problem, where do I 
get gdal with WFS enabled?


The mapfile is the same on both servers (relevant code only):
  LAYER
     NAME "TEST"
     TYPE Point
     UNITS METERS
     CONNECTION "http://XXX=1.1.0=WFS;
     CONNECTIONTYPE OGR
     STATUS ON
     DEBUG ON
     DEBUG 5
     DATA "LAYER_NAME"
     METADATA
   "wfs_version"    "1.1.0"
   "wfs_title"    "TEST"
   "wfs_connectiontimeout" "300"
   "wfs_typename"    "Test_int"
   "wfs_maxfeatures"   "500"
   "gml_include_items" "all"
   #"wfs_srs" "epsg:25832"
   "gml_featureid" "ID"
   "wfs_enable_request" "*"
     END # METADATA
     PROJECTION
   "init=epsg:25832"
     END # PROJECTION
  CLASS
   NAME "Testlayer"
   STYLE
     COLOR 190 87 66
     OUTLINECOLOR 255 0 0
     SIZE 4
     SYMBOL "circle_filled"
   END # STYLE
     END # CLASS
   END # LAYER

I'd really appreciate any help where to look further. I have been at 
this for a few days already. I tried to give as much information as 
possible, if something important is missing, please let me know.


Thanks again for your time!

Best

Lars

SkenData GmbH



___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/mapserver-users

Re: [mapserver-users] CONNECTIONTYPE OGR is not working after upgrade to mapserver 7.2.2 from 6.4.1

2019-04-04 Thread lars . schylberg
Have You tried: CONFIG "CPL_DEBUG" "ON"

/Lars Schylberg

April 4, 2019 11:23 AM, "Lars Fricke" mailto:lars.fri...@skendata.de?to=%22Lars%20Fricke%22%20)>
 wrote:
 Hello,

First of all: thank you for your time!

I have been running into a strange problem lately. We have a server running 
mapserver 6.4.1 (Debian GNU/Linux 8.0 jessie) that is accessing a remote WFS as 
client without any problems.
We have another (local development) server that has been upgraded to mapserver 
7.2.2 (Ubuntu 18.04 bionic) and that can no longer access the WFS. Everything 
was fine with the older versions on that server, too (not certain if the 
mapserver upgrade happened at the same time as the Ubuntu upgrade).

The error received is:
msOGRFileOpen(): OGR error. GetLayer(LAYER_NAME) failed for OGR connection. 
Check logs.

The logs are not giving me any further information. Even I put debug level to 5 
already. Also apache log is not giving me any clue, there is no error. Other 
layers on the same server open fine, as long a they do not need OGR. So I 
assume it is not a connection issue.
ogrinfo however can access the external WFS fine from the terminal.

Configuration:
Mapserver 7.2.2
gdal-bin 2.4.0+dfsg-1~bionic0 (from UbuntuGIS - unstable repo)
Ubuntu 18.04 bionic

I also have NextGIS repository activated but it does not seem that gdal/ogr is 
installed from there.

mapserv -v shows:
MapServer version 7.2.2 OUTPUT=PNG OUTPUT=JPEG OUTPUT=KML SUPPORTS=PROJ 
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=SOS_SERVER SUPPORTS=FASTCGI SUPPORTS=THREADS SUPPORTS=GEOS 
SUPPORTS=PBF INPUT=JPEG INPUT=POSTGIS INPUT=OGR INPUT=GDAL INPUT=SHAPEFILE

I have also checkt $Path:
/home/lars/bin /usr/local/sbin /usr/local/bin /usr/sbin /usr/bin /sbin /bin 
/usr/games /usr/local/games /snap/bin

I am not certain, if that is correct but ogr seems to be in /usr/bin so I'd 
expect it's available for mapserver, too.
gdalinfo --formats does not show WFS, if that is the problem, where do I get 
gdal with WFS enabled?

The mapfile is the same on both servers (relevant code only):
LAYER
NAME "TEST"
TYPE Point
UNITS METERS
CONNECTION "http://XXX=1.1.0=WFS; 
(http://XXX=1.1.0=WFS)
CONNECTIONTYPE OGR
STATUS ON
DEBUG ON
DEBUG 5
DATA "LAYER_NAME"
METADATA
"wfs_version" "1.1.0"
"wfs_title" "TEST"
"wfs_connectiontimeout" "300"
"wfs_typename" "Test_int"
"wfs_maxfeatures" "500"
"gml_include_items" "all"
#"wfs_srs" "epsg:25832"
"gml_featureid" "ID"
"wfs_enable_request" "*"
END # METADATA
PROJECTION
"init=epsg:25832"
END # PROJECTION
CLASS
NAME "Testlayer"
STYLE
COLOR 190 87 66
OUTLINECOLOR 255 0 0
SIZE 4
SYMBOL "circle_filled"
END # STYLE
END # CLASS
END # LAYER

I'd really appreciate any help where to look further. I have been at this for a 
few days already. I tried to give as much information as possible, if something 
important is missing, please let me know.

Thanks again for your time!

Best

Lars

SkenData GmbH
___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/mapserver-users