[mapserver-users] WFS server setup with sqlite data

Jeff McKenna jmckenna at gatewaygeomatics.com
Thu May 17 06:49:10 PDT 2018


Hi Ian,

I have just now tested on Windows, using MS4W 3.2.7, using the 
commandline utility shp2img.

I found an old sqlite database locally, but it caused me errors with 
MapServer so I converted it to spatialite using an ogr2ogr command:

   ogr2ogr -f SQLite myspatialite.sqlite original.sqlite -dsco 
SPATIALITE=YES

And then I had no problems using the shp2img utility to produce a map 
image (using both ways as you mentioned):

   shp2img -m spatialite.map -o ttt.png -all_debug 3

Once I used ogr2ogr to convert to spatialite, I noticed many new table 
changes, such as the table names changing to lowercase, which likely was 
causing me troubles on my first tests on Windows.

I wonder what would happen in your case also, if you ran the ogr2ogr 
command, which will update your sqlite database to a more recent version 
(and likely automatically rename your 'Cities_3x' table name).

Note that MS4W (https://ms4w.com) nicely includes the sqlite3 
commandline utility, so you can verify table names if you wish (or just 
use ogrinfo command).

Hope that helps a little,

-jeff



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



On 2018-05-16 7:26 PM, Ian Walberg wrote:
> Folks,
> 
> We have a working WFS setup on our linux servers which has the sqlite 
> database table as the value in the DATA field.
> 
> However when we run this on Windows we get no data returned.
> 
> In the logs there is a number of what appear to be warnings however it 
> looks like no matching records were found.
> 
> msOGRFileNextShape: Rejecting feature (shapeid = 0, tileid=0) of 
> incompatible type for this layer (feature wkbType 0, layer type 1)
> 
> msQueryByRect(): Search returned no results. No matching record(s) found.
> 
> Changing the DATA filed to be ‘select * from table’ works ok on windows.
> 
> Any help working out what the cause of the problem is appreciated.
> 
> Thanks, Ian
> 
> LAYER
> 
>      NAME Cities_3x
> 
>      #DEBUG 5
> 
>      METADATA
> 
>        "wfs_srs" "EPSG:4326"
> 
>        "wfs_title" "Cities_3x"
> 
>        "gml_featureid" "Name"
> 
>        "gml_include_items" "all"
> 
>        "wfs_enable_request" "*"
> 
>        "wfs_encoding" "UTF-8"
> 
>        "wfs_abstract" "Points"
> 
>        "wfs_getfeature_formatlist" "geojson"
> 
>      END
> 
>      TYPE point
> 
>      STATUS ON
> 
>      CONNECTIONTYPE OGR
> 
>      CONNECTION 'Cities.db'
> 
>      DATA 'Cities_3x' – works in Linux
> 
>      DATA ‘select * from Cities_3x’  -- required for Windows
> 
>      PROJECTION
> 
>        "init=epsg:4326"
> 
>      END # PROJECTION
> 
> END # LAYER
> 
> 
> 



More information about the MapServer-users mailing list