@wemap/routers 12.2.0 → 12.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -2712,7 +2712,11 @@ class CustomNetworkMap {
2712
2712
  };
2713
2713
  }
2714
2714
  }
2715
- static fromOsmXml(osmXmlString, name = null) {
2715
+ static fromOsmXml(osmXmlString, name = null, callbackErrors) {
2716
+ const errors = {
2717
+ routingIoNotFound: [],
2718
+ routingBoundsNotFound: false
2719
+ };
2716
2720
  const osmModel = osm.OsmParser.parseOsmXmlString(osmXmlString);
2717
2721
  let verticesMapping = [];
2718
2722
  const graph = OsmGraphUtils.createGraphFromOsmModel(osmModel, OsmGraphUtils.DEFAULT_WAY_SELECTOR, (vm) => verticesMapping = vm);
@@ -2721,7 +2725,7 @@ class CustomNetworkMap {
2721
2725
  var _a;
2722
2726
  const vertex = (_a = verticesMapping.find((v) => v[0] === node.id)) == null ? void 0 : _a[1];
2723
2727
  if (!vertex) {
2724
- Logger.warn(`Could not parse this wemap:routing-io correctly: ${JSON.stringify(node.coords.toJson())}`);
2728
+ errors.routingIoNotFound.push(node);
2725
2729
  }
2726
2730
  return vertex || null;
2727
2731
  });
@@ -2744,8 +2748,9 @@ class CustomNetworkMap {
2744
2748
  polygon && bounds.coordinates.push(polygon.coordinates);
2745
2749
  });
2746
2750
  if (!bounds.coordinates.length) {
2747
- throw new Error('Search bounds is undefined. Please use OSM tag : "wemap:routing-bounds=yes"');
2751
+ errors.routingBoundsNotFound = true;
2748
2752
  }
2753
+ callbackErrors == null ? void 0 : callbackErrors(errors);
2749
2754
  return new CustomNetworkMap(graph, entryPoints, bounds, name);
2750
2755
  }
2751
2756
  isPointInside(coordinates) {