GithubHelp home page GithubHelp logo

movinggauteng / geojson-tools Goto Github PK

View Code? Open in Web Editor NEW
11.0 11.0 4.0 37 KB

Tools for working with location data in Node.js, using the GeoJSON specification

License: MIT License

JavaScript 100.00%
geojson

geojson-tools's People

Contributors

greenkeeperio-bot avatar nevi-me avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

geojson-tools's Issues

Parse coordinates to floats

In the instance that coordinates are passed in as strings, the returned object from toGeoJSON and array in toArray will contain strings. Mongo often complains about that. Fix that by parsing all coordinates to floats, or complaining if not valid strings (as the input could tehnically be incorrect anyways)

One other option would be to exclude/ignore objects that can't be parsed to numbers

Add browser support

Might have to remove the dependency on underscore and implement native methods where necessary.

Add support for all GeoJSON features

MongoDB 2.6 will support more GeoJSON types, this is partly in preparation for it. There are some issues to consider on how converting GeoJSON objects to arrays will work. For example, if I have MultiPoint, should I convert it to an array that looks like that of a LineString ([[a, b], [c, d], [e, f]]), or anything else? (the former would make sense)

Features to support:

  • MultiPoint
  • MultiLineString
  • MultiPolygon
  • Feature
  • FeatureCollection
  • GeometryCollection

Incorrect validation

This GeoJSON is valid (rendered on geojson.io) but geojsonTools.isGeoJSON() results in error.

{
   "type":"FeatureCollection",
   "features":[
      {
         "type":"Feature",
         "properties":{

         },
         "geometry":{
            "type":"MultiLineString",
            "coordinates":[
               [
                  [13, 52],
                  [13.3, 52.2]
               ]
            ]
         }
      }
   ]
}

Support Polygons with Multiple Rings on toArray

Had previously deferred the issue, but need to now convert to Array from GeoJSON.
The first option that I can think of is to create a nested array, and test whether the array has multiple rings.
This would be a breaking change, and I would ideally like to make even a Polygon with a single ring be returned as a nested array for consistency.

Add functions to play nice with turf.js

Turf expects GeoJSON Features for almost everything. It's currently a pain working with it as this library generates the geometries without wrapping them in Features.

Complexify method is doing a shift in received array

Hey,

I'm using the complexify method in a plain array of locations and I realized that the method is eating the first position of the input array.
Looking at the code I found this entry:
cur = linestring.shift();
That could be changed to cur = linestring[0]?

Thanks
Julian

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.