Giter Site home page Giter Site logo

librarieshacked / api-geography Goto Github PK

View Code? Open in Web Editor NEW
0.0 3.0 0.0 135 KB

API to provide useful geography data services for UK public library applications

License: MIT License

JavaScript 100.00%
geography uk vector-tiles libraries lsoas boundaries postcodes nodejs expressjs javascript built-up-areas library-services

api-geography's Introduction

Geography API

A Node JS API to provide common UK geography services for library applications.

Getting Started

These instructions will give you a copy of the project up and running on your local machine for development and testing purposes.

Prerequisites

Requirements for the software and other tools to build, test and push

Installing

Install the required packages

npm install

The project should then be able to be run locally by running

npm start

Authors

  • Dave Rowe - Original code and maintenance - DaveBathnes

See also the list of contributors who participated in this project.

License

This project is licensed under the MIT Licence

api-geography's People

Contributors

davebathnes avatar dependabot[bot] avatar

Watchers

 avatar  avatar  avatar

api-geography's Issues

Basic postcode routes Rest API

The database has database data in it so we can add some routes and a model to deal with postcode data. Initially this will be for the Rest API but will later also be included in a Graph QL API, and Mapbox Vector Tiles.

Acceptance Criteria

  • Get a single postcode
  • Get LSOA for many postcodes. Must filter by postcode sectors.

Create library authorities endpoint

We need an endpoint that provides just a list of library authorities, including:

  • A very generalised outline
  • A code
  • An English name
  • A Welsh name
  • Area
  • Bounding box

Add Swagger endpoint

It would be useful for testing and documentation purposes to have a Swagger endpoint for the API.

LSOA vector tiles

To create LSOA browsing tools for deprivation and library membership there will need to be a vector tile API to provide LSOAs.

This will need to include:

  • The tiles from the database
  • The name of the LSOA

Acceptance Criteria

  • LSOA vector tiles able to be displayed on a web map

Publish API

The API needs to be published online.

Acceptance Criteria

  • API running and tested on Azure
  • API uses domain name api-geography.librarydata.uk

Poor postcode lookup performance

After doing insensitive case matching the postcode lookup service has bombed. Indexing must not be working after doing lowercase processing.

Fix LSOA MVT route

Getting LSOAs is not working and also appears to be maxing out the database.

Isochrone service

OpenRouteService provides various APIs around routing:

  • Directions
  • Geocoding
  • Isochrones
  • Optimization

Ultimately these should be delivered using a routing database. But for now there is an API with free limits that we can use, and cache to ensure we do not call too many times.

To start off with, implement an isochrone service with 1 week caching based on a single input point.

Update to use the new database

An updated database includes column name changes, primarily to remove specific years (e.g. lad19cd to ladcd)

This requires various code changes to use the new names

Vector tiles

To create browsing tools we will need vector tile services for:

  • Wards
  • Regions
  • Countries
  • Library services

To start off, create the service for library authorities

Acceptance Criteria

  • Vector tiles able to be displayed on a web map

Add extra detail authority boundary

When we are calling to get an individual authority we should get extra detail for the authority boundary.

This can replace the existing generalised boundary field.

Remove geometry from library authorities

Including the geometry geojson in the library authorities response by default makes the request too large. This should be optional, and then included on individual service responses, also as an option.

Add option to retrieve library services in order of proximity to a location

For use in things like the library book search, it would be useful to have library service in order of proximity to a location.

As it is not point-to-point the actual distance will have to be the nearest point on the authority boundary. The API will need to provide the distance in shortest and longest distance away.

Performance of postcodes to LSOA

The postcodes to LSOA takes a long time. This includes:

  • Call to the database
  • Processing data
  • Downloading the data

Acceptance Criteria

  • Performance improved

Make postcode case insensitive

When searching for a postcode, or providing postcode sectors we should always treat them as case-insensitive.

Acceptance Criteria

  • Return a postcode using lower case and uppercase and a mix
  • Return LSOAs using postcode sector with a mix of case

Timeout issues

The web request seems to be timing out when taking over a minute.

Acceptance Criteria

  • Reason understood and fixed

Make fields optional

Put in a system so that the API endpoints can take in a comma-separated list of fields which are then the only fields returned from the data.

This should also modify the SQL query so that there is a real performance benefit to limiting the fields returned.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.