Skip to content
Permalink
Browse files
Add basic WFS tests for MSSQL driver
  • Loading branch information
geographika committed Feb 17, 2020
1 parent e7cdc19 commit a6fca41388b343e4241f67eafe97dceda156377a
Show file tree
Hide file tree
Showing 5 changed files with 113 additions and 0 deletions.
@@ -0,0 +1,17 @@
{
"type": "FeatureCollection",
"numberMatched": 6994,
"name": "cities",
"features": [
{ "type": "Feature", "properties": { "ogr_fid": 1, "name": "崇州市", "name_ar": "", "name_hi": "" }, "geometry": { "type": "Point", "coordinates": [ 11540741.500531593337655, 3584222.176282715518028 ] } },
{ "type": "Feature", "properties": { "ogr_fid": 2, "name": "江油市", "name_ar": "", "name_hi": "" }, "geometry": { "type": "Point", "coordinates": [ 11658983.416123732924461, 3734167.308027575723827 ] } },
{ "type": "Feature", "properties": { "ogr_fid": 3, "name": "都江堰市", "name_ar": "", "name_hi": "" }, "geometry": { "type": "Point", "coordinates": [ 11535108.467130685225129, 3632351.464808412827551 ] } },
{ "type": "Feature", "properties": { "ogr_fid": 4, "name": "汉中市", "name_ar": "", "name_hi": "" }, "geometry": { "type": "Point", "coordinates": [ 11914449.602725410833955, 3905795.921342806424946 ] } },
{ "type": "Feature", "properties": { "ogr_fid": 5, "name": "达州市", "name_ar": "", "name_hi": "" }, "geometry": { "type": "Point", "coordinates": [ 11967742.628956081345677, 3658495.346212032716721 ] } },
{ "type": "Feature", "properties": { "ogr_fid": 6, "name": "彭州市", "name_ar": "", "name_hi": "" }, "geometry": { "type": "Point", "coordinates": [ 11568532.166505239903927, 3647573.495146059896797 ] } },
{ "type": "Feature", "properties": { "ogr_fid": 7, "name": "万源市", "name_ar": "", "name_hi": "" }, "geometry": { "type": "Point", "coordinates": [ 12025983.606177415698767, 3772333.751561704557389 ] } },
{ "type": "Feature", "properties": { "ogr_fid": 8, "name": "绵竹市", "name_ar": "", "name_hi": "" }, "geometry": { "type": "Point", "coordinates": [ 11599265.83038479834795, 3677164.76934290677309 ] } },
{ "type": "Feature", "properties": { "ogr_fid": 9, "name": "绵阳市", "name_ar": "", "name_hi": "" }, "geometry": { "type": "Point", "coordinates": [ 11660728.683100385591388, 3692494.727239217143506 ] } },
{ "type": "Feature", "properties": { "ogr_fid": 10, "name": "邛崃市", "name_ar": "", "name_hi": "" }, "geometry": { "type": "Point", "coordinates": [ 11517720.217953415587544, 3556944.647455960512161 ] } }
]
}
@@ -0,0 +1,17 @@
{
"type": "FeatureCollection",
"numberMatched": 6994,
"name": "cities",
"features": [
{ "type": "Feature", "properties": { "ogr_fid": 1, "name": "崇州市", "name_ar": "", "name_hi": "" }, "geometry": { "type": "Point", "coordinates": [ 11540741.500531593337655, 3584222.176282715518028 ] } },
{ "type": "Feature", "properties": { "ogr_fid": 2, "name": "江油市", "name_ar": "", "name_hi": "" }, "geometry": { "type": "Point", "coordinates": [ 11658983.416123732924461, 3734167.308027575723827 ] } },
{ "type": "Feature", "properties": { "ogr_fid": 3, "name": "都江堰市", "name_ar": "", "name_hi": "" }, "geometry": { "type": "Point", "coordinates": [ 11535108.467130685225129, 3632351.464808412827551 ] } },
{ "type": "Feature", "properties": { "ogr_fid": 4, "name": "汉中市", "name_ar": "", "name_hi": "" }, "geometry": { "type": "Point", "coordinates": [ 11914449.602725410833955, 3905795.921342806424946 ] } },
{ "type": "Feature", "properties": { "ogr_fid": 5, "name": "达州市", "name_ar": "", "name_hi": "" }, "geometry": { "type": "Point", "coordinates": [ 11967742.628956081345677, 3658495.346212032716721 ] } },
{ "type": "Feature", "properties": { "ogr_fid": 6, "name": "彭州市", "name_ar": "", "name_hi": "" }, "geometry": { "type": "Point", "coordinates": [ 11568532.166505239903927, 3647573.495146059896797 ] } },
{ "type": "Feature", "properties": { "ogr_fid": 7, "name": "万源市", "name_ar": "", "name_hi": "" }, "geometry": { "type": "Point", "coordinates": [ 12025983.606177415698767, 3772333.751561704557389 ] } },
{ "type": "Feature", "properties": { "ogr_fid": 8, "name": "绵竹市", "name_ar": "", "name_hi": "" }, "geometry": { "type": "Point", "coordinates": [ 11599265.83038479834795, 3677164.76934290677309 ] } },
{ "type": "Feature", "properties": { "ogr_fid": 9, "name": "绵阳市", "name_ar": "", "name_hi": "" }, "geometry": { "type": "Point", "coordinates": [ 11660728.683100385591388, 3692494.727239217143506 ] } },
{ "type": "Feature", "properties": { "ogr_fid": 10, "name": "邛崃市", "name_ar": "", "name_hi": "" }, "geometry": { "type": "Point", "coordinates": [ 11517720.217953415587544, 3556944.647455960512161 ] } }
]
}
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<ows:ExceptionReport xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ows="http://www.opengis.net/ows/1.1" version="2.0.0" xml:lang="en-US" xsi:schemaLocation="http://www.opengis.net/ows/1.1 http://schemas.opengis.net/ows/1.1.0/owsExceptionReport.xsd">
<ows:Exception exceptionCode="NoApplicableCode" locator="mapserv">
<ows:ExceptionText>msWFSGetFeature(): WFS server error. ms_error-&gt;code not found
msMSSQL2008LayerGetShape(): Query error. Error executing MSSQL2008 SQL statement: SELECT [0], [1], [2], [3], [geom], [id] FROM (SELECT convert(nvarchar(max), [ogr_fid]) '0',convert(nvarchar(max), [name]) '1',convert(nvarchar(max), [name_ar]) '2',convert(nvarchar(max), [name_hi]) '3',[ogr_geometry] 'geom',convert(varchar(36), [ogr_fid]) 'id', row_number() over ( ORDER BY ogr_fid ASC USING SRID=3857ORDER BY ogr_fid) 'rownum' FROM (select * from cities) as foo WHERE ogr_geometry.STIntersects(geometry::STGeomFromText('POLYGON((-20026376.39001 -20048966.10001,20026376.39001 -20048966.10001,20026376.39001 20048966.10001,-20026376.39001 20048966.10001,-20026376.39001 -20048966.10001))',3857)) = 1 ) tbl where [rownum] &lt; 11
-[Microsoft][ODBC SQL Server Driver][SQL Server]Incorrect syntax near 'SRID'.
</ows:ExceptionText>
</ows:Exception>
</ows:ExceptionReport>
@@ -0,0 +1,8 @@
CONNECTIONTYPE PLUGIN
PLUGIN "D:\MapServer\release-1911-x64-dev\build\Debug\msplugin_mssql2008.dll"
CONNECTION "SERVER=DESKTOP-SMDN2CC;DATABASE=msautotest;uid=sa;pwd=Password12!;"
#PLUGIN "C:\projects\mapserver\build\Release\msplugin_mssql2008.dll"
#CONNECTION "SERVER=(local)\SQL2017;DATABASE=msautotest;uid=sa;pwd=Password12!;"
STATUS OFF
TYPE POINT

@@ -0,0 +1,62 @@
#
# Test WFS GetFeature with the MSSQL driver plugin
#
# REQUIRES: INPUT=OGR SUPPORTS=WFS
#
# RUN_PARMS: wfs_mssql_maxfeatures.json [MAPSERV] QUERY_STRING="map=[MAPFILE]&SERVICE=WFS&VERSION=2.0.0&REQUEST=GetFeature&TYPENAME=cities&OUTPUTFORMAT=geojson" > [RESULT]
# RUN_PARMS: wfs_mssql_maxcount.json [MAPSERV] QUERY_STRING="map=[MAPFILE]&SERVICE=WFS&VERSION=2.0.0&REQUEST=GetFeature&TYPENAME=cities&OUTPUTFORMAT=geojson&MAXFEATURES=2" > [RESULT]
# RUN_PARMS: wfs_mssql_maxcount_order.json [MAPSERV] QUERY_STRING="map=[MAPFILE]&SERVICE=WFS&VERSION=2.0.0&REQUEST=GetFeature&TYPENAME=cities_with_order&OUTPUTFORMAT=geojson&MAXFEATURES=2" > [RESULT]

MAP
NAME 'wfs_mssql'
EXTENT -20026376.39 -20048966.10 20026376.39 20048966.10
UNITS METERS

SIZE 300 300
IMAGETYPE png8

WEB
METADATA
"wfs_title" "Test simple wfs"
"wfs_onlineresource" "http://localhost/path/to/wfs_simple?"
"wfs_srs" "EPSG:3857 EPSG:4326"
"wfs_getfeature_formatlist" "gml,geojson"
"ows_enable_request" "*"
"wfs_maxfeatures" "10"
"wfs_compute_number_matched" "true"
END
END

OUTPUTFORMAT
NAME "geojson"
DRIVER "OGR/GEOJSON"
MIMETYPE "application/json; subtype=geojson; charset=utf-8"
FORMATOPTION "FORM=SIMPLE"
FORMATOPTION "STORAGE=memory"
FORMATOPTION "LCO:NATIVE_MEDIA_TYPE=application/vnd.geo+json"
END

LAYER
NAME 'cities'
EXTENT -20026376.39 -20048966.10 20026376.39 20048966.10
INCLUDE 'include/cities_mssql.map'
DATA "ogr_geometry from (select * from cities) as foo USING UNIQUE ogr_fid USING SRID=3857"
METADATA
"gml_include_items" "all"
"gml_types" "auto"
END
END

LAYER
NAME 'cities_with_order'
EXTENT -20026376.39 -20048966.10 20026376.39 20048966.10
INCLUDE 'include/cities_mssql.map'
DATA "ogr_geometry from (select * from cities) as foo USING UNIQUE ogr_fid USING SRID=3857 ORDER BY ogr_fid ASC"
METADATA
"gml_include_items" "all"
"gml_types" "auto"
END
END


END

0 comments on commit a6fca41

Please sign in to comment.