esri / terraformer-wkt-parser Goto Github PK
View Code? Open in Web Editor NEWWell-Known Text parser for Terraformer
License: MIT License
Well-Known Text parser for Terraformer
License: MIT License
I am including this package as a dependency in a TypeScript project via npm install
but the TypeScript compilation (tsc
) fails due to an unresolved type dependency of @types/geojson
:
node_modules/terraformer/terraformer.d.ts:40:30 - error TS2694:
Namespace '".../ldtreeBrowser/node_modules/@types/geojson/index"' has no exported member 'GeoJsonTypes'.
40 public type: GeoJSON.GeoJsonTypes;
This import happens in terraformer
which is a dependency of terraformer-wkt-parser
.
I dig a little bit into it and found that the problem comes because terraformer-wkt-parser
has as a direct dependency "@types/geojson": "^1.0.0"
(which installs v1.0.6) and at the same time installs the latest terraformer
(v1.0.12) that includes "@types/geojson": "^7946.0.0 || ^1.0.0"
, which in the end needs v7946.0.7 as it includes the missing export.
What I don't understand is why when cloning this repo and doing an npm install
, the version of terraformer
that gets installed is v1.0.8 which still had "@types/geojson": "^1.0.0"
, therefore being aligned with terraformer-wkt-parser
.
My guess to fix it would be to bump geojson types on terraformer-wkt-parser
to "@types/geojson": "^7946.0.0 || ^1.0.0"
as well?
Apologies in advance if I am doing something wrong on my end.
In section Using in Node.js the wrong npm package is named. It reads $ npm install terraformer-arcgis-parser
but should be $ npm install terraformer-wkt-parser
.
I cannot parse WKTs that use scientific notation, so something like: 'POINT (3.234E-2 10)' doesn't work, even though this seems proper. I didn't have access to the ISO, but it is allowed in the OpenGIS implementation specification.
Here is a jsfiddle that demonstrates my problem:
http://jsfiddle.net/qfxxLx95/4/
Parsing GeoJSON GeometryCollections was added but reverse parsing should be supported too.
Cannot install v1.1.0
Reason: 389487f#diff-0a08a7565aba4405282251491979bb6bR7
ref #8
terraformer 1.0.5 is not yet released!
bower install terraformer-wkt-parser
bower not-cached git://github.com/Esri/Terraformer.git#~1.0.5
bower resolve git://github.com/Esri/Terraformer.git#~1.0.5
bower ENORESTARGET No tag found that was able to satisfy ~1.0.5
Additional error details:
Available versions in git://github.com/Esri/Terraformer.git: 1.0.4, 1.0.3, 1.0.2, 1.0.1
http://terraformer.io/wkt-parser/ is not working anymore ?
Could we find the documentation in another place ?
Thank you
Uncaught Error: Unable to parse: Error: Parse error on line 1:
GEOMETRYCOLLECTION(L
^
Expecting 'POINT', 'LINESTRING', 'POLYGON', 'MULTIPOINT', 'MULTILINESTRING', 'MULTIPOLYGON', got 'INVALID'
Support for GeometryCollection was committed and appears to be ready, but a release was never made. 1.1.2 does not include these changes.
Please update npm package (https://www.npmjs.com/package/terraformer-wkt-parser) in order of latest changes
I had to add import GeoJson from 'geojson';
to
import GeoJson from 'geojson';
export = WKT;
declare namespace WKT {
export function parse(wkt: string): GeoJSON.GeometryObject;
export function convert(geoJSON: GeoJSON.GeometryObject): string;
}
To make this work in VSCode
Though, also had to do npm i @types/geojson
also.
When converting from ArcGIS JSON to WKT my polygon always ends up with a clockwise orientation (regardless of whether ring[0] in the ArcGIS JSON is clockwise or counter clockwise.
This is particularly undesirable because the OGC specification requires that the polygon be specified counter-clockwise, and tools like SQL Server require that orientation.
I am using:
terraformer 1.0.4
terraformer-wkt-parser 1.1.0
terraformer-arcgis-parser 1.0.4
{"rings":[[[-9466845.160610136,6659598.392804854],[551909.0107818246,6659598.392804854],[551909.0107818246,1591517.6693858737],[-9466845.160610136,1591517.6693858737],[-9466845.160610136,6659598.392804854]]],"spatialReference":{"wkid":102100}}
and
{"rings":[[[-9466845.160610136,6659598.392804854],[-9466845.160610136,1591517.6693858737],[551909.0107818246,1591517.6693858737],[551909.0107818246,6659598.392804854],[-9466845.160610136,6659598.392804854]]],"spatialReference":{"wkid":102100}}
both become
{"type":"Polygon","coordinates":[[[-85.04211700169012,51.21604200714901],[4.957882998285988,51.21604200714901],[4.957882998285988,14.150752375669544],[-85.04211700169012,14.150752375669544],[-85.04211700169012,51.21604200714901]]],"bbox":[-85.04211700169012,14.150752375669544,4.957882998285988,51.21604200714901]}
which becomes:
POLYGON ((-85.04211700169012 51.21604200714901, 4.957882998285988 51.21604200714901, 4.957882998285988 14.150752375669544, -85.04211700169012 14.150752375669544, -85.04211700169012 51.21604200714901))
The documentation site appears to be down TerraFormer.io
When running ./node_modules/.bin/sequelize db:migrate
I get Error: Cannot find module 'terraformer-wkt-parser'
If I force terraformer-wkt-parser to version 1.1.0
there is no error.
Currently on error parse
gives e..g,
var wkt = require('terraformer-wkt-parser');
wkt.parse('LINESTRING (30 10, 10 30, 40 a)')
Error: Unable to parse
Any chance more informative error messages can be passed?
--force
flag (ie. write a little more coverage)other 'to do's:
master
branchmaster
branch-f
flagnpm publish
Terraformer is at 1.0.4, you include 0.1.7
Converting geoJSON FeatureCollection to WKT throws an error:
Uncaught Error: Unknown Type: FeatureCollection(…)
Are FeatureCollections not supported?
Thanks for the help.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.