Skip to content

Integrating Neo4j, Gatsby, Mapillary and GraphQL to get Open Street Maps related Points-of-Interest around Central Park in NYC stored Neo4j (sandbox) database.

License

Notifications You must be signed in to change notification settings

KazChe/central-perk

Repository files navigation

Will be using this as the base template for integrating Neo4j, Gatsby and GraphQL -

Finds a route between two points of interest - see Neo4j Shortest Path

match (p1:PointOfInterest {name: "Central Park Tennis Center"})
match (p2:PointOfInterest {name: "The Pond"})
match sp=shortestPath((p1)-[:ROUTE*..200]-(p2))
unwind nodes(sp) as node
return {latitude: node.location.latitude, longitude: node.location.longitude}

Note that above query might not be the actual shortest distance between two points. It brings back shortest numbers of relationships. You might want use other Graph Data Science alogs for shortest weighted path.

To run

  • need to get access to neo4j sandbox for OSM data.
  • Add your neo4j sandbox bolt url and credentials to neo4j-graphql directory's .env file
  • run npm i in both the root gatsby-project and neo4j-grpahql directories
  • cd to neo4j-grpahqlstart neo4j backed graphql server (Apollo) and run npm start
  • cd .. and run gatsby develop
  • Example graphql query:
{
  PointOfInterest(first: 1) {
    name
    node_osm_id
    location {
      latitude
      longitude
    }
    routeToPOI(poi: "246164695") {
      latitude
      longitude
    }
    node_osm_id
    location {
      longitude
      latitude
    }
  }
}

About

Integrating Neo4j, Gatsby, Mapillary and GraphQL to get Open Street Maps related Points-of-Interest around Central Park in NYC stored Neo4j (sandbox) database.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published