Closed PanierAvide closed 5 years ago
Or maybe it would be better to handle several elements as a sort of collection. Because I need to both know if there are elements contained in the result of the API call, and if so get them as XML string.
Also, having a collection of elements would help in the case of /[way|relation]/:id/full
calls to properly handle several objects at once.
On pourrait avoir les méthodes suivantes :
Find any node, way or relation matching the osmId in a collection generated from a raw XML converted using xmlToJson
findElementWithinOSMCollection
Within existing functions below,
setProperties
setProperty
removeProperty
setCoordinates
getNodeIdsForWay
setNodeIdsForWay
getRelationMembers
setRelationMembers
setTimestampToNow
setVersion
sendElement
deleteElementRequest
fetchElement
Within sendElement
, manage element without using osm key for root of the object and add osm root element within sendElementRequest
functionconst rawxml = await this._osmApi.fetchMapByBbox(bbox.getWest(), bbox.getSouth(), bbox.getEast(), bbox.getNorth());
rawxml.osm.node = rawxml.osm.node.map(n => {
delete n._id;
delete n._type;
return n;
});
rawxml.osm.way = rawxml.osm.way.map((w,i) => {
delete w._id;
delete w._type;
return w.osm.way[0];
});
this._cacheOsmXml = (new window.DOMParser()).parseFromString(jsonToXml(rawxml), "text/xml");
To be able to use osmtogeojson library, we need OSM map data as raw XML string.
Solution : add a parameter for getting the result offetchMapByBbox
as a XML string.Temporary workaround : usingjsonToXml
on client side