movinggauteng / geojson-tools Goto Github PK
View Code? Open in Web Editor NEWTools for working with location data in Node.js, using the GeoJSON specification
License: MIT License
Tools for working with location data in Node.js, using the GeoJSON specification
License: MIT License
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 isGeoJSON(obj)
for internal validation, and expose it externally
Might have to remove the dependency on underscore and implement native methods where necessary.
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
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]
]
]
}
}
]
}
Polygon
returned is not compliant with spec, one extra array level deep.
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.
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.
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
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.