andrewl / gatsby-source-geo Goto Github PK
View Code? Open in Web Editor NEWGeospatial Source Plugin for gatsby
License: MIT License
Geospatial Source Plugin for gatsby
License: MIT License
Interesting issue I've run into here that seems to be a conflict when you're using data from several different shapefiles.
A little background -- I'm using data from two different .shp
files -- one of these files defines a series of polygons (it is showing census tracts) and another defines a series of points.
The coordinates of the polygons are represented in GeoJSON as an array of length 2 arrays like so:
"coordinates": [[700, -600], [701, -601], [702, -602]]
The points, on the other hand, are represented by a single array of length 2, like so:
"coordinates": [700, -600]
GraphQL/Gatsby doesn't like this, as it treats these as conflicting datatypes with the following error message:
warn There are conflicting field types in your data.
If you have explicitly defined a type for those fields, you can safely ignore this warning message.
Otherwise, Gatsby will omit those fields from the GraphQL schema.
If you know all field types in advance, the best strategy is to explicitly define them with the `createTypes` action, and skip inference with the `@dontInfer` directive.
See https://www.gatsbyjs.org/docs/actions/#createTypes
geoFeature.geometry.coordinates:
- type: [array]
value: [ ..., [ ..., [ ..., -71.160393, ... ], ... ], ... ]
- type: [number]
value: [ ..., 236007.5383913815, ... ]
The coordinates
field is then omitted from the results, to my dismay.
I've got the repository forked to try and fix this -- this seems to be within GeoJSON specification (see: https://geojson.org/). My approach right now is to simply split each datasource into separate nodes (since they all end up together under allGeoFeature
) but this might prove problematic for shapefiles that define both polygons and points.
This is useless in any new project RN
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.