[MapServer-users] WMS layer from multiple ogrtindex'd shapefiles - no such file or directory

Stefan Gofferje lists at home.gofferje.net
Wed Apr 30 00:33:28 PDT 2025


Hi,

I am a little bit at a loss here. I have tried multiple variations of 
relative and absolute paths but can't get it to work.

I am trying to create a WMS service from thousands of shapefiles 
containing property boundaries of Finland.
Sample files: 
https://kartat.kapsi.fi/files/kiinteistorekisterikartta/avoin/karttalehdittain/tm35fin/shp/

I am running the latest camptocamp/mapserver docker container on X86_64 
Ubuntu

MapServer version 8.4.0 PROJ version 9.5 GDAL version 3.10 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=OGCAPI_SERVER SUPPORTS=FASTCGI 
SUPPORTS=GEOS SUPPORTS=PBF INPUT=JPEG INPUT=POSTGIS INPUT=OGR INPUT=GDAL 
INPUT=SHAPEFILE INPUT=FLATGEOBUF

The directory structure inside the container is

/etc/mapserver.conf
/etc/mapserver/kiinteisto.map
/maps/kiinteisto
           |
           +-- rajat
           |     |
           |     +-- 11,245 shp-files
           |
           +-- rajat.(shp|shx|prj|dbf)


kiinteisto.map
--------------
MAP
   NAME "Kiinteistorajat"
   IMAGETYPE      PNG8
   EXTENT         20000.000000 6570000.000000 788000.000000 7818000.000000

   SIZE           256 256
   MAXSIZE        4096
   SHAPEPATH      "/maps/kiinteisto"
   IMAGECOLOR     255 255 255

   DEBUG 5

   PROJECTION
      "init=epsg:3067"
   END

   WEB
     METADATA
       "wms_title"           "Kiinteistorajat"
       "wms_onlineresource" 
"https://mapserver.gofferje.net/?map=kiinteisto&service=WMS"
       "wms_srs"             "EPSG:3067 EPSG:3857 EPSG:4326"
       "wms_getmap_formatlist" "PNG,PNG8,JPEG"
       "wms_enable_request"  "* !GetLegendGraphic"
     END
   END


   LAYER
     NAME "Kiinteistorajat"
     METADATA
       "wms_title" "Kiinteistorajat"
     END
     STATUS ON
     TILEINDEX "rajat.shp"
     TILEITEM "LOCATION"
     TYPE RASTER
     MAXSCALEDENOM 50000
     PROJECTION
       "init=epsg:3067"
     END
     ENCODING "windows-1252"
     CLASS
       NAME "Kiinsteistorajat"
       STYLE
         OUTLINECOLOR 0 0 0
       END
     END
     PROCESSING "RESAMPLE=BILINEAR"
   END

END


I created the tileindex in the /maps/kiinteisto directory with

ogrtindex rajat.shp rajat/*.shp

When I look at the attribute table in QGIS, it looks like it should 
(according to the ms documentation). Example entries:

    LOCATION
-- ---------------------------------
  1 rajat/K2344H_kiinteistoraja.shp,0
  2 rajat/K2433D_kiinteistoraja.shp,0

However, when I try to access that WMS layer with e.g.

https://mapserver.gofferje.net/?map=kiinteisto&service=WMS&SERVICE=WMS&VERSION=1.3.0&REQUEST=GetMap&BBOX=340774.031465307693%2C6794806.480618176982%2C341675.648959146929%2C6795268.100126413628&CRS=EPSG%3A3067&WIDTH=1668&HEIGHT=854&LAYERS=Kiinteistorajat&STYLES=&FORMAT=image%2Fpng&DPI=79&MAP_RESOLUTION=79&FORMAT_OPTIONS=dpi%3A79&TRANSPARENT=TRUE

I get the following error:

[warn] [pid 15] mod_fcgid: stderr: CGI Request 10 on process 178
  [warn] [pid 15] mod_fcgid: stderr: msDrawMap(): rendering using 
outputformat named png (AGG/PNG).
  [warn] [pid 15] mod_fcgid: stderr: msDrawMap(): WMS/WFS set-up and 
query, 0.000s
  [warn] [pid 15] mod_fcgid: stderr: 
msDrawRasterLayerLow(Kiinteistorajat): entering.
  [warn] [pid 15] mod_fcgid: stderr: msDrawRasterLayerLow(): Unable to 
access file. Corrupt, empty or missing file 
'rajat/M4123A_kiinteistoraja.shp,0' for layer 'Kiinteistorajat'. 
rajat/M4123A_kiinteistoraja.shp,0: No such file or directory
  [warn] [pid 15] mod_fcgid: stderr: msDrawMap(): Image handling error. 
Failed to draw layer named 'Kiinteistorajat'.
  [warn] [pid 15] mod_fcgid: stderr: mapserv request processing time
  [warn] [pid 15] mod_fcgid: stderr:  (msLoadMap not incl.): 0.005s
  [warn] [pid 15] mod_fcgid: stderr: msFreeMap(): freeing map at 
0x560fcd81c200.
8380 - 172.21.1.16 - - [30/Apr/2025:10:22:42 +0300] "GET 
/?map=kiinteisto&service=WMS&SERVICE=WMS&VERSION=1.3.0&REQUEST=GetMap&BBOX=340774.031465307693%2C6794806.480618176982%2C341675.648959146929%2C6795268.100126413628&CRS=EPSG%3A3067&WIDTH=1668&HEIGHT=854&LAYERS=Kiinteistorajat&STYLES=&FORMAT=image%2Fpng&DPI=79&MAP_RESOLUTION=79&FORMAT_OPTIONS=dpi%3A79&TRANSPARENT=TRUE 
HTTP/1.1" 200 671 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:138.0) 
Gecko/20100101 Firefox/138.0"

As I wrote above, I tried all variations imaginable with relative and 
also absolute paths (ogrtindex -write_absolute_path ...) but I can't get 
this to work. I also double checked the paths inside the container and 
the file permissions and all checks out.

I would really be grateful for any hints here!

-Stefan

-- 
  (o_   Stefan Gofferje            | SCLT, MCP, CCSA
  //\   Reg'd Linux User #247167   | VCP #2263
  V_/_  https://www.gofferje.net   | https://www.saakeskus.fi



More information about the MapServer-users mailing list