diff --git a/mapogr.cpp b/mapogr.cpp index 7eb90ccb2a..1df3b0ab46 100644 --- a/mapogr.cpp +++ b/mapogr.cpp @@ -76,7 +76,7 @@ typedef struct ms_ogr_file_info_t { char *pszRowId; int bIsOKForSQLCompose; bool bHasSpatialIndex; // used only for spatialite for now - char* pszTablePrefix; // prefix to qualify field names. used only for spatialite for now when a join is done for spatial filtering. + char* pszTablePrefix; // prefix to qualify field names. used only for spatialite & gpkg for now when a join is done for spatial filtering. int bPaging; @@ -1386,6 +1386,7 @@ msOGRFileOpen(layerObj *layer, const char *connection ) if( have_gpkg_spatialite ) { psInfo->pszMainTableName = msStrdup( OGR_L_GetName(hLayer) ); + psInfo->pszTablePrefix = msStrdup( psInfo->pszMainTableName ); psInfo->pszSpatialFilterTableName = msStrdup( OGR_L_GetName(hLayer) ); psInfo->pszSpatialFilterGeometryColumn = msStrdup( OGR_L_GetGeometryColumn(hLayer) ); psInfo->dialect = "GPKG"; diff --git a/msautotest/wxs/data/test.gpkg b/msautotest/wxs/data/test.gpkg new file mode 100644 index 0000000000..60263f615e Binary files /dev/null and b/msautotest/wxs/data/test.gpkg differ diff --git a/msautotest/wxs/expected/wfs_ogr_gpkg_issue_5858.xml b/msautotest/wxs/expected/wfs_ogr_gpkg_issue_5858.xml new file mode 100644 index 0000000000..896347c403 --- /dev/null +++ b/msautotest/wxs/expected/wfs_ogr_gpkg_issue_5858.xml @@ -0,0 +1,34 @@ +Content-Type: text/xml; charset=UTF-8 + + + + + + 2.000000,49.000000 2.000000,49.000000 + + + + + + + 2.000000,49.000000 2.000000,49.000000 + + + + + 2.000000,49.000000 + + + 1 + some place in France + + + + diff --git a/msautotest/wxs/wfs_ogr_gpkg.map b/msautotest/wxs/wfs_ogr_gpkg.map new file mode 100644 index 0000000000..8424ad410b --- /dev/null +++ b/msautotest/wxs/wfs_ogr_gpkg.map @@ -0,0 +1,63 @@ +# +# Test OGR GeoPackage support +# +# REQUIRES: SUPPORTS=WFS INPUT=OGR +# +# RUN_PARMS: wfs_ogr_gpkg_issue_5858.xml [MAPSERV] QUERY_STRING="map=[MAPFILE]&SERVICE=WFS&VERSION=1.0.0&REQUEST=GetFeature&TYPENAME=test&BBOX=-180,-90,180,90&MAXFEATURES=1" > [RESULT] + +MAP + +NAME WFS_OGR_GPKG +STATUS ON +SIZE 400 300 +EXTENT 6 30 21 50 +UNITS METERS +IMAGECOLOR 255 255 255 + +# +# Start of web interface definition +# + +WEB + + IMAGEPATH "tmp/" + IMAGEURL "/ms_tmp/" + + METADATA + "wfs_title" "Test simple wfs" + "wfs_onlineresource" "http://localhost/path/to/wfs_simple?" + "wfs_srs" "EPSG:4326" + "wfs_enable_request" "*" + END +END + +PROJECTION + "+proj=latlong +datum=WGS84" +END + +# +# Start of layer definitions +# + +LAYER + + NAME test + DATA test + CONNECTIONTYPE OGR + CONNECTION "./data/test.gpkg" + METADATA + "ows_title" "test" + "wfs_featureid" "id" + "gml_include_items" "all" + "gml_types" "auto" + END + TYPE POINT + STATUS ON + PROJECTION + "init=epsg:4326" + END + + TEMPLATE "wfs_ogr_gpkg.map" +END # Layer + +END # Map File