Open nathanieltalbot opened 4 years ago
From reading the GeoJSON spec, it looks like there are several different formats that an object can define its coordinates, which means there needs to be change in the way the data is typed in the plugin -- otherwise, these types will conflict. I'll see about a processFeature
change to fix this.
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:
The points, on the other hand, are represented by a single array of length 2, like so:
GraphQL/Gatsby doesn't like this, as it treats these as conflicting datatypes with the following error message:
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.