Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ghengeveld/graphql-geojson
GraphQL schema object types for GeoJSON
https://github.com/ghengeveld/graphql-geojson
Last synced: 3 months ago
JSON representation
GraphQL schema object types for GeoJSON
- Host: GitHub
- URL: https://github.com/ghengeveld/graphql-geojson
- Owner: ghengeveld
- Archived: true
- Created: 2016-09-20T16:43:48.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2020-05-24T11:50:59.000Z (over 4 years ago)
- Last Synced: 2024-11-01T06:18:18.707Z (3 months ago)
- Language: JavaScript
- Size: 3.91 KB
- Stars: 61
- Watchers: 5
- Forks: 11
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-starred - ghengeveld/graphql-geojson - GraphQL schema object types for GeoJSON (others)
README
# graphql-geojson
[![npm version][npm shield]][npm url]
GraphQL schema object types for GeoJSON. Based on [GeoJSON Object Schema][geojson schema].
[npm shield]: https://img.shields.io/npm/v/graphql-geojson.svg
[npm url]: https://www.npmjs.com/package/graphql-geojson
[geojson schema]: https://github.com/sogko/graphql-schemas/tree/master/geojson## Installation
```bash
npm i -S graphql-geojson
```or with Yarn:
```bash
yarn add graphql-geojson
```## Usage
```js
import { GraphQLObjectType, GraphQLSchema } from 'graphql'
import { PointObject } from 'graphql-geojson'export default new GraphQLSchema({
query: new GraphQLObjectType({
name: 'Query',
fields: () => ({
point: {
type: PointObject,
resolve: () => ({
type: 'Point',
coordinates: [-105.01621, 39.57422],
crs: {
type: 'name',
properties: {
name: 'urn:ogc:def:crs:OGC:1.3:CRS84',
},
},
}),
},
}),
}),
})
```Then you can query it like this:
```graphql
query {
point {
type
coordinates
crs {
type
properties {
... on GeoJSONNamedCRSProperties {
name
}
}
}
}
}
```## Demo
An example GraphQL server implementation is available here:
https://github.com/ghengeveld/graphql-geojson-demo