-
-
Notifications
You must be signed in to change notification settings - Fork 371
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GEOPACKAGE Column id ambiguity when using BBOX #5858
Comments
Could you help us by attaching a small geopackage to test with? By a quick look to the query I can't understang the problem. The join seems to use the internal perceel.ROWID column for the join and perceel.id should not have any effect.
|
I believe the issue is the |
OGR GPKG: fix potential SELECT ambiguity for 'id' column (fixes #5858)
When using a GeoPackage table that has a 'id' column, in some circumstances, MapServer composes internally a SELECT statement, but fails to prefix the id column with the table name, which causes an ambiguity when joining with the spatial index RTree table that has also a id column.
[Backport branch-7-4] OGR GPKG: fix potential SELECT ambiguity for 'id' column (fixes #5858)
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
Is there a solution or workaround?
With kind regards,
Dennis Rutjes
The text was updated successfully, but these errors were encountered: