Fix ckan export - #111
Conversation
…ve geometries
This change hardens the Linked Data Proxy and GML parsing pipeline to work reliably
with stricter and non-uniform WFS implementations (especially QGIS/GeoServer-like
WFS 1.1.0 services), while keeping behavior generic across services.
Key improvements:
Added robust geometry parsing in GML 3 factory:
namespace-tolerant/local-name based geometry detection
support for Curve and MultiCurve variants
support for embedded LineStringSegment paths in MultiCurve structures
improved fallback geometry discovery when geometry elements are nested or prefixed differently
Improved feature serialization:
output GeoJSON geometry as null (instead of empty string) when no geometry is available
keeps GeoJSON output standards-compliant and avoids downstream parsing issues
Fixed WFS request construction for strict servers:
version-specific request parameters:
WFS 2.x uses TYPENAMES + COUNT
WFS 1.1.0 uses TYPENAME + MAXFEATURES
normalized request key casing (SERVICE/REQUEST/VERSION)
removed duplicate max-features parameter in paging GET requests
Added request-version fallback strategy:
detect service version and retry with compatible versions when needed
improved handling of WFS exception responses before deciding fallback
Improved proxy paging/filter compatibility:
support STARTINDEX as alias parameter
convert FES filter namespace/elements to OGC equivalents for non-2.x services
Reworked GeoJSON bbox handling:
generic recursive bbox calculation for Point/Line/Polygon/Multi*/GeometryCollection
consistent feature-collection bbox accumulation
reduced reliance on brittle geometry-type-specific bbox code
Hardened cached count behavior:
detect implausible cached counts
trigger recount and refresh cache when cached values are stale/invalid
Prevented accidental feature loss in conversion paths:
do not drop features simply because geometry is null
guard geometry-dependent logic (bbox/type extraction) accordingly
Result:
The proxy now handles a broader range of real-world WFS services more reliably,
including WFS 1.1.0 endpoints and MultiCurve-based datasets, with improved stability
for paging, filtering, geometry conversion, and bbox generation.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Added additional SQL query to fetch German category codes.
Code Review by GeminiHere are the bugs and issues identified in the pull request along with suggested fixes. 1. Swapped X/Y Coordinates in Bounding Box CalculationFile: In // http/php/mod_linkedDataProxy.php
// Lines 308-313
if ($bboxPart !== false) {
if ($minLon > $bboxPart->minx) { $minLon = $bboxPart->minx; }
if ($minLat > $bboxPart->miny) { $minLat = $bboxPart->miny; }
if ($maxLon < $bboxPart->maxx) { $maxLon = $bboxPart->maxx; }
if ($maxLat < $bboxPart->maxy) { $maxLat = $bboxPart->maxy; }
}
// Lines 325-328
$bbox = new stdClass();
$bbox->minx = $minLon;
$bbox->miny = $minLat;
$bbox->maxx = $maxLon;
$bbox->maxy = $maxLat;2. Relative Path Used in
|
Code Review by GeminiHere is a code review highlighting issues and suggested improvements found in the pull request: 1.
|
|
ERROR: # Code Review by Gemini |
Code Review by GeminiHere is the review of the changes in this pull request along with identified bugs and suggested improvements: 1. Leftover Test File
|
There was a problem hiding this comment.
Pull request overview
This PR improves CKAN export output and hardens/extends several Mapbender HTTP endpoints involved in WFS/linked-data access and INSPIRE download feed handling.
Changes:
- Add whitelist support to the download feed server’s URL filtering and expand the default blacklist distribution file.
- Improve
mod_linkedDataProxy.phprobustness: WFS version fallback chain, better bbox handling for more GeoJSON geometry types, andSTARTINDEXcompatibility. - Extend CKAN metadata export handling for additional AtomFeed-linked resource types; add metadata search facets and HVD logic updates.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| http/plugins/mb_downloadFeedServer.php | Adds whitelist logic to bypass blacklist for trusted feed URLs (needs tightening + path fix). |
| http/php/mod_linkedDataProxy.php | Adds WFS paging/version fallbacks and generalized GeoJSON bbox computation. |
| http/php/mod_exportMapbenderMetadata2Ckan.php | Exports additional AtomFeed-linked resource types into CKAN distributions. |
| http/delete.me | New test file added (should be removed). |
| http/classes/class_wfs.php | Adjusts WFS KVP parameter casing / typeName parameter handling and paging request building. |
| http/classes/class_metadata.php | Adds adminTypes facet/filtering, improves HVD filtering logic, and enriches metadata JSON fields. |
| http/classes/class_gml_feature.php | Outputs null for missing geometry in GeoJSON. |
| http/classes/class_gml_3_factory.php | Improves GML3 geometry parsing (Curve + namespace-agnostic XPath), geometry detection, and SRS handling. |
| conf/excludeFromAtomFeedClient.json-dist | Expands blacklist patterns and adds a whitelist example section. |
| .github/workflows/gemini-review.yml | Changes workflow trigger to run only when the gemini-review label is added. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
No description provided.