@flatten-js/core
Advanced tools
Comparing version 1.5.6 to 1.5.7
{ | ||
"name": "@flatten-js/core", | ||
"version": "1.5.6", | ||
"version": "1.5.7", | ||
"description": "Javascript library for 2d geometry", | ||
@@ -5,0 +5,0 @@ "main": "dist/main.cjs", |
@@ -11,2 +11,4 @@ import {Multiline, Point, Segment, Polygon} from "../../index"; | ||
// MULTIPOLYGON (((40 40, 20 45, 45 30, 40 40)), ((20 35, 10 30, 10 10, 30 5, 45 20, 20 35), (30 20, 20 15, 20 25, 30 20))) | ||
// GEOMETRYCOLLECTION (POINT (0 0), LINESTRING (0 0, 1440 900), POLYGON ((0 0, 0 1024, 1024 1024, 1024 0, 0 0))) | ||
// GEOMETRYCOLLECTION (POINT (40 10), LINESTRING (10 10, 20 20, 10 40), POLYGON ((40 40, 20 45, 45 30, 40 40))) | ||
@@ -112,3 +114,13 @@ function parseSinglePoint(pointStr) { | ||
else if (str.startsWith("GEOMETRYCOLLECTION")) { | ||
const regex = /(POINT|LINESTRING|POLYGON|MULTIPOINT|MULTILINESTRING|MULTIPOLYGON|GEOMETRYCOLLECTION) \([^\)]+\)/g | ||
// const regex = /(POINT|LINESTRING|POLYGON|MULTIPOINT|MULTILINESTRING|MULTIPOLYGON|GEOMETRYCOLLECTION) \([^\)]+\)/g | ||
/* Explanation: | ||
(?<type>POINT|LINESTRING|POLYGON|MULTIPOINT|MULTILINESTRING|MULTIPOLYGON): | ||
This named group will capture the geometry type. The type label helps with understanding the structure but | ||
is not necessary unless you process the matches programmatically and want easy access to the geometry type. | ||
\( and \): Match the opening and closing parentheses. | ||
(?:[^\(\)]|\([^\)]*\))*: A non-capturing group that allows for: | ||
[^\(\)]: Matching any character except parentheses, handling simple geometries. | ||
|\([^\)]*\): Handling nested parentheses for geometries like POLYGON and MULTILINESTRING. | ||
* after the non-capturing group: Allows for repeating the pattern zero or more times to match all contents between the outermost parentheses. */ | ||
const regex = /(?<type>POINT|LINESTRING|POLYGON|MULTIPOINT|MULTILINESTRING|MULTIPOLYGON) \((?:[^\(\)]|\([^\)]*\))*\)/g | ||
const wktArray = str.match(regex) | ||
@@ -115,0 +127,0 @@ if (wktArray[0].startsWith('GEOMETRYCOLLECTION')) { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1229119
31467