2

I am trying to use MapServer to load tiles overtop of my google map. When hitting the endpoint, I am getting the error:

msLoadMap(): Regular expression error. MS_DEFAULT_MAPFILE_PATTERN validation failed.

An example of one of the endpoints is:

http://localhost:8080/cgi-bin/tiler?layer=layer_392&map.layer[layer_392].class[0].style[0]=SIZE%203&mode=tile&tilemode=gmap&tile=4%2011%205

The apache config with a ScriptAlias:

# 000-default.conf

<VirtualHost *:80>
  ServerAdmin webmaster@localhost
  DocumentRoot /var/www/web

  LogFormat "{ \"datetime\":\"%{%Y-%m-%d}tT%{%T}t.%{msec_frac}tZ\", \"network.client.ip\":\"%a\", \"http.url_details.host\":\"%V\", \"http.url\":\"%U\", \"http.url_details.queryString\":\"%q\", \"http.method\":\"%m\", \"http.status_code\":\"%>s\", \"http.useragent\":\"%{User-agent}i\", \"http.referer\":\"%{Referer}i\" }," json
  CustomLog /dev/stdout json

  ScriptAlias /cgi-bin/ /var/www/bin/tile-producer/docker/cron-jobs/
  <Directory /var/www>
    Options Indexes FollowSymLinks
    AllowOverride All
    Require all granted

    # Setup rewrite rules
    RewriteEngine on
    RewriteBase "/var/www/web"
  </Directory>
</VirtualHost>

mapfile:

#Generated by MapServer Generator MapWindow plug-in
#
# Start of map file
#
MAP
  NAME telusdirectory
  STATUS ON
  
  EXTENT -180 -90 180 90
  SHAPEPATH 'data'
  IMAGETYPE png
  
  PROJECTION
   "init=epsg:4326"
  END
  
  WEB
    METADATA
        "wms_title" "TELUS Directory Service WMS"
        "wms_onlineresource" "http://telus.magicsite.co.uk/cgi-bin/telus?"
        "wms_srs" "EPSG:4326"
        "tile_map_edge_buffer" "100" # 9 pixel rendering buffer
        "http_max_age" "86400"
    END
  END
  
  SYMBOL
    NAME 'square'
    TYPE VECTOR
    FILLED TRUE
    POINTS
      0 1
      0 0
      1 0
      1 1
      0 1
    END
  END #SYMBOL
  
  SYMBOL
    NAME 'ellipse'
    TYPE ELLIPSE
    FILLED TRUE
    POINTS
      1 1
    END
  END #SYMBOL

  IMAGEQUALITY 95
    IMAGETYPE png
    OUTPUTFORMAT
        NAME png
        DRIVER 'GD/PNG'
        MIMETYPE 'image/png'
        EXTENSION 'png'
     IMAGEMODE RGBA
        TRANSPARENT ON
    END  

  #
  # Start of layers definitions
  #
  
  #LAYER_DEFS
  LAYER
    PROJECTION
        "init=epsg:4326"
    END
    NAME layer_392
    TYPE point
    STATUS ON
    DATA 'layer_392.shp'
    CLASS
      NAME 'layer_392'
      STYLE
        SYMBOL 'ellipse'
        SIZE 2
        COLOR 73 22 109
      END #STYLE
    END #CLASS
    TEMPLATE "xxx"
        METADATA
            "wms_title" "Data layer"
        END
  END #LAYER

#/LAYER_DEFS

  
END #MAP

tiler script that is hit on entry:

#!/usr/bin/perl

use CGI qw(:standard);
use URI::Escape;
use File::Basename;
use Cwd 'abs_path';
use v5.10;

my $q = CGI->new;


my @PARAMS = $q->param;
my $NEW_PARAMS;
my ($x, $y, $z) = split(' ', uri_unescape( scalar $q->param('tile') ) );


$NEW_PARAMS = "map="."/var/www/bin/tile-producer/docker/cron-jobs/mapdata"."/telus.map";


if ( @PARAMS ) {
    foreach  ( @PARAMS ) {
        $NEW_PARAMS .= "&$_=" . uri_escape( $q->param( $_ ) );
    }
}

$ENV{'QUERY_STRING'} = $NEW_PARAMS;
system("/usr/lib/cgi-bin/mapserv");

Contents of mapdata folder:

mapdata directory

mapserving
  • 216
  • 1
  • 8
sd-gallowaystorm
  • 129
  • 4
  • 15

1 Answers1

0

So after looking through all of this. My env variable in script that is hit on entry was not getting passed through to CGI. I had to enable it on Apache first and then it started working.

bad_coder
  • 11,289
  • 20
  • 44
  • 72
sd-gallowaystorm
  • 129
  • 4
  • 15