We are using a geo package as a data source, the layer contains the column id.
When using a bounding box, MapServer joins the geospatial index table(rtree_Perceel_geom in our case) with the layer table and produces invalid SQL due to the double "id" columns in both tables.
The resulting SQL query is shown below:
SELECT "gml_id", "id", "perceelLabelID", "identificatieLokaalID", "identificatieNamespace", "beginGeldigheid", "tijdstipRegistratie", "volgnummer", "statusHistorieCode", "statusHistorieWaarde", "kadastraleGemeenteCode", "kadastraleGemeenteWaarde", "sectie", "AKRKadastraleGemeenteCodeCode", "AKRKadastraleGemeenteCodeWaarde", "kadastraleGrootteWaarde", "soortGrootteCode", "soortGrootteWaarde", "perceelnummer", "perceelnummerRotatie", "perceelnummerVerschuivingDeltaX", "perceelnummerVerschuivingDeltaY", "perceelnummerPlaatscoordinaatX", "perceelnummerPlaatscoordinaatY", "geom" FROM "Perceel" JOIN "rtree_Perceel_geom" ms_spat_idx ON "Perceel".ROWID = ms_spat_idx.id AND ms_spat_idx.minx <= 668770.029039325 AND ms_spat_idx.maxx >= 305483.307024382 AND ms_spat_idx.miny <= 1561015.59774587 AND ms_spat_idx.maxy >= 890519.969865935
We are not in control of the manufactured geo package.
Due to the large geo package and performance reasons, we would not like a query in the DATA segment of the MapServer config file
example layer config
LAYER
NAME "perceel"
STATUS ON
TYPE POLYGON
METADATA
"wfs_title" "perceel"
"wfs_abstract" "Het op geografische wijze verschaffen van inzicht in de indeling, vorm en ligging van de kadastrale percelen, fungeert als schakel tussen terrein en registratie, vervult voor externe gebruiker vaak een referentiefunctie, een ondergrond ten opzichte waarvan de gebruiker eigen informatie kan vastleggen en presenteren."
"wfs_keywordlist" "Kadastrale percelen,infoMapAccessService"
"wfs_extent" "-25000 250000 280000 860000"
"wfs_include_items" "all"
"wfs_bbox_extended" "true"
"wfs_enable_request" "*"
"gml_featureid" "id"
"gml_include_items" "all"
"gml_exclude_items" "perceelLabelID,gml_id"
"gml_geometries" "begrenzingPerceel"
"gml_types" "auto"
"gml_geom_alias" "begrenzingPerceel"
"ows_metadataurl_type" "TC211"
"ows_metadataurl_format" "text/plain"
"wfs_use_default_extent_for_getfeature" "no"
END
CONNECTIONTYPE OGR
PROJECTION
"init=epsg:28992"
END
CONNECTION "#GPKG_LOCATION#/perceel.gpkg"
DATA "Perceel"
PROCESSING "NATIVE_SQL=YES"
DUMP TRUE
TEMPLATE void
END
Is there a solution or workaround?
With kind regards,
Dennis Rutjes
We are using a geo package as a data source, the layer contains the column id.
When using a bounding box, MapServer joins the geospatial index table(rtree_Perceel_geom in our case) with the layer table and produces invalid SQL due to the double "id" columns in both tables.
The resulting SQL query is shown below:
SELECT "gml_id", "id", "perceelLabelID", "identificatieLokaalID", "identificatieNamespace", "beginGeldigheid", "tijdstipRegistratie", "volgnummer", "statusHistorieCode", "statusHistorieWaarde", "kadastraleGemeenteCode", "kadastraleGemeenteWaarde", "sectie", "AKRKadastraleGemeenteCodeCode", "AKRKadastraleGemeenteCodeWaarde", "kadastraleGrootteWaarde", "soortGrootteCode", "soortGrootteWaarde", "perceelnummer", "perceelnummerRotatie", "perceelnummerVerschuivingDeltaX", "perceelnummerVerschuivingDeltaY", "perceelnummerPlaatscoordinaatX", "perceelnummerPlaatscoordinaatY", "geom" FROM "Perceel" JOIN "rtree_Perceel_geom" ms_spat_idx ON "Perceel".ROWID = ms_spat_idx.id AND ms_spat_idx.minx <= 668770.029039325 AND ms_spat_idx.maxx >= 305483.307024382 AND ms_spat_idx.miny <= 1561015.59774587 AND ms_spat_idx.maxy >= 890519.969865935We are not in control of the manufactured geo package.
Due to the large geo package and performance reasons, we would not like a query in the DATA segment of the MapServer config file
example layer config
Is there a solution or workaround?
With kind regards,
Dennis Rutjes