Geomark JS API getGeomarkFeature(url) won't return multi polygons
- Dominant language
- No language data
- Stars
- 27
- Forks
- 20
- Avg merge
- 22h 33m
- Merged PRs (30d)
- 1
Description
Hi, I am trying to use the geomark api for a client to be able to add geomarks to a leaflet web app, so far my code works for single features but when I try and use the example of a multi polygon (https://apps.gov.bc.ca/pub/geomark/geomarks/gm-abcdefghijklmnopqrstuv0bcislands) the geomarkFeature.geometry returns "undefined". I am also pretty new to JS so all of this has been a steep learning curve for me and maybe there is something I am doing wrong or missing for multi geometry features?
`
function getGeomarkFeature(geomarkId) {
var baseUrl = 'https://apps.gov.bc.ca/pub/geomark';
var client = new GeomarkClient(baseUrl);
client.getGeomarkInfo({
'geomarkId': geomarkId,
'callback': function(geomarkInfo) {
console.log('Geomark Type: ' + geomarkInfo.geometryType);
console.log('Number of Features: ' + geomarkInfo.numParts);
console.log('Resource Links: ' + geomarkInfo.resourceLinks);
}
})
client.getGeomarkFeature({
'geomarkId': geomarkId,
'srid': 4326,
'callback': function(geomarkFeature) {
console.log('Geomark geometry:', geomarkFeature.geometry);
if (geomarkFeature.geometry) {
try {
var wktString = geomarkFeature.geometry.replace(/^SRID=\d+;/, '');
console.log('Cleaned WKT String:', wktString);
var wicket = new Wkt.Wkt();
wicket.read(wktString); //
var geojsonFeature = wicket.toJson();
L.geoJSON(geojsonFeature).addTo(map);
map.fitBounds(L.geoJSON(geojsonFeature).getBounds());
} catch (e) {
console.error('Error parsing WKT:', e);
}
} else {
console.error('No geometry found in the Geomark feature.');
}
}
});
}
`
Contributor guide
Research direction
Start with GeomarkClient.getGeomarkFeature and the supplied multi-polygon URL, comparing its callback response with the single-feature case. Confirm whether the API response exposes geometry in a form the shown WKT parsing can consume, and document or correct the behavior so a multi-polygon can be loaded by the example code.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- api
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100