Geomark JS API getGeomarkFeature(url) won't return multi polygons
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.');
}
}
});
}
`
Thank you for connecting with us. Would it be possible for you to submit this issue through the following form (Get Help with the Geomark Web Service)?