Skip to content

Repository files navigation

Geospatial GraphQL API

This project provides a Node.js GraphQL API for storing and managing geospatial entities in MongoDB using a flexible GeoJSON schema.

Features

  • Single collection for all geospatial entities
  • Compound index on placeId and entityType
  • Stores entities as GeoJSON Feature objects
  • Supports CRUD operations via GraphQL
  • Ready for high throughput and future caching

Setup

  1. Install MongoDB and ensure it is running on localhost:27017.
  2. Run npm install to install dependencies.
  3. Start the API server:
    node app.js
    
  4. Access GraphQL Playground at http://localhost:4000/graphql

Example GraphQL Queries

mutation {
  createEntity(
    placeId: "abc123",
    entityType: "Parking",
    geojson: {
      type: "Feature",
      geometry: { type: "Point", coordinates: [12.34, 56.78] },
      properties: { ranking: 1, type: "underground", capacity: 50 }
    }
  ) {
    id
    placeId
    entityType
    geojson
  }
}

Index Creation

MongoDB index is created automatically via Mongoose schema.

License

MIT

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages