landxml 0.8.1 → 0.9.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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # landxml
2
2
 
3
+ ## 0.9.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 604418b: Replaced proj4 dependency with mproj, which has more accurate transformation results.
8
+
3
9
  ## 0.8.1
4
10
 
5
11
  ### Patch Changes
package/README.md CHANGED
@@ -9,7 +9,7 @@ Easily transform LandXML surfaces into GeoJSON contours or GLB 3D models for use
9
9
  - **`toGlbAndContours`** — Generate both a GLB model and GeoJSON contours in a single pass (fastest when you need both outputs).
10
10
  - **`toGlb`** — Generate a GLB 3D model from LandXML surfaces.
11
11
  - **`toGeojsonContours`** — Convert LandXML surfaces into contour line GeoJSON.
12
- - **`reprojectGeoJson`** — Reproject GeoJSON coordinates to any projection using `proj4`.
12
+ - **`reprojectGeoJson`** — Reproject GeoJSON coordinates to any projection using `mproj`.
13
13
 
14
14
  ---
15
15
 
@@ -117,7 +117,7 @@ const byIndex = await toGeojsonContours(landXmlString, 2, true, 1);
117
117
 
118
118
  ### Reproject GeoJSON
119
119
 
120
- `reprojectGeoJson` wraps `proj4` and works with both WKT strings (exported by Civil 3D when a drawing is geo-referenced) and standard proj4 definition strings.
120
+ `reprojectGeoJson` wraps `mproj` and works with both WKT strings (exported by Civil 3D when a drawing is geo-referenced) and standard proj4 definition strings.
121
121
 
122
122
  ```typescript
123
123
  import { reprojectGeoJson } from "landxml";
package/dist/index.js CHANGED
@@ -565,15 +565,23 @@ var toGeojsonContours = (landXmlString, contourInterval = 2, generateOutline = t
565
565
  var to_geojson_contours_default = toGeojsonContours;
566
566
 
567
567
  // src/public/reproject-geojson.ts
568
- var import_proj4 = __toESM(require("proj4"));
568
+ var import_mproj = __toESM(require("mproj"));
569
+ var NAMED_PROJECTIONS = {
570
+ WGS84: "+proj=longlat +datum=WGS84 +no_defs"
571
+ };
569
572
  var reprojectGeoJson = (geojson, sourceProjection, targetProjection = "WGS84", keepOriginalGeometryAsFeatureProperty = true) => {
570
573
  const transformCoordinates = (coordinates, sourceProjection2, targetProjection2) => {
574
+ var _a, _b;
571
575
  if (Array.isArray(coordinates[0])) {
572
576
  coordinates = coordinates.map(
573
577
  (subCoordinates) => transformCoordinates(subCoordinates, sourceProjection2, targetProjection2)
574
578
  );
575
579
  } else {
576
- coordinates = (0, import_proj4.default)(sourceProjection2, targetProjection2, coordinates);
580
+ coordinates = (0, import_mproj.default)(
581
+ (_a = NAMED_PROJECTIONS[sourceProjection2]) != null ? _a : sourceProjection2,
582
+ (_b = NAMED_PROJECTIONS[targetProjection2]) != null ? _b : targetProjection2,
583
+ coordinates
584
+ );
577
585
  }
578
586
  return coordinates;
579
587
  };
package/dist/index.mjs CHANGED
@@ -528,15 +528,23 @@ var toGeojsonContours = (landXmlString, contourInterval = 2, generateOutline = t
528
528
  var to_geojson_contours_default = toGeojsonContours;
529
529
 
530
530
  // src/public/reproject-geojson.ts
531
- import proj4 from "proj4";
531
+ import proj from "mproj";
532
+ var NAMED_PROJECTIONS = {
533
+ WGS84: "+proj=longlat +datum=WGS84 +no_defs"
534
+ };
532
535
  var reprojectGeoJson = (geojson, sourceProjection, targetProjection = "WGS84", keepOriginalGeometryAsFeatureProperty = true) => {
533
536
  const transformCoordinates = (coordinates, sourceProjection2, targetProjection2) => {
537
+ var _a, _b;
534
538
  if (Array.isArray(coordinates[0])) {
535
539
  coordinates = coordinates.map(
536
540
  (subCoordinates) => transformCoordinates(subCoordinates, sourceProjection2, targetProjection2)
537
541
  );
538
542
  } else {
539
- coordinates = proj4(sourceProjection2, targetProjection2, coordinates);
543
+ coordinates = proj(
544
+ (_a = NAMED_PROJECTIONS[sourceProjection2]) != null ? _a : sourceProjection2,
545
+ (_b = NAMED_PROJECTIONS[targetProjection2]) != null ? _b : targetProjection2,
546
+ coordinates
547
+ );
540
548
  }
541
549
  return coordinates;
542
550
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "landxml",
3
- "version": "0.8.1",
3
+ "version": "0.9.0",
4
4
  "description": "Parse LandXML surfaces on the modern web.",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -29,7 +29,6 @@
29
29
  "devDependencies": {
30
30
  "@changesets/cli": "^2.29.6",
31
31
  "@types/geojson": "^7946.0.16",
32
- "@types/proj4": "^2.5.6",
33
32
  "@types/sax": "^1.2.7",
34
33
  "@types/xml2json": "^0.11.6",
35
34
  "jsdom": "^24.0.0",
@@ -41,7 +40,7 @@
41
40
  "@gltf-transform/core": "^3.9.0",
42
41
  "@vitest/web-worker": "^3.2.4",
43
42
  "easy-web-worker": "^6.2.0",
44
- "proj4": "^2.9.2",
43
+ "mproj": "^0.0.7",
45
44
  "sax": "^1.4.1",
46
45
  "xml-js": "^1.6.11"
47
46
  }