GithubHelp home page GithubHelp logo

esri / terraformer-wkt-parser Goto Github PK

View Code? Open in Web Editor NEW
75.0 9.0 30.0 201 KB

Well-Known Text parser for Terraformer

License: MIT License

JavaScript 87.99% Yacc 9.71% TypeScript 0.50% Shell 1.80%
data-management nodejs geojson esri wkt

terraformer-wkt-parser's Issues

Conflicting @types/geojson dependency with terraformer

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.

BROKEN v1.1.0 !!!

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

Cannot parse GEOMETRYCOLLECTION

Uncaught Error: Unable to parse: Error: Parse error on line 1:
GEOMETRYCOLLECTION(L
^
Expecting 'POINT', 'LINESTRING', 'POLYGON', 'MULTIPOINT', 'MULTILINESTRING', 'MULTIPOLYGON', got 'INVALID'

terraformer-wkt-parser.d.ts references to GeoJSON

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.

Counter clockwise polygons

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))

TerraFormer.io

The documentation site appears to be down TerraFormer.io

Informative parse errors

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?

setup Travis

  • get tests to pass without --force flag (ie. write a little more coverage)
  • set up travis

other 'to do's:

  • get built content out of master branch
  • remove old versions from master branch
  • write new grunt tasks to release on github and npm

automate release process

  • make sure grunt uglify runs without -f flag
  • write script to:
    • force add built files
    • attach binary to GitHub release
    • run npm publish

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.