Giter VIP home page Giter VIP logo

choropleth-mapping-uk-python-'s Introduction

Choropleth-Mapping-UK-python-

Geographical mapping in python using UK GeoJSON files

A couple of examples on how to plot choropleth maps for UK in python using plotly express.

To create these choropleth maps you need two things, firstly a GeoJSON file - this is a nested dictionary, which consists of propeties and coordinates of its features (i.e. the map space)

secondly you need data which you would like to map, and this needs to have an identifier to match on to the required feature in the map file.

You can find GeoJSON files online, but for UK maps the Office of National Statistics ONS contains a geographical portal which has many useful maps which can be found under the APIs drop down

A few examples:

UK Counties: https://geoportal.statistics.gov.uk/datasets/counties-december-2019-boundaries-en-bfc

UK Countries: https://geoportal.statistics.gov.uk/datasets/countries-december-2019-gb-bgc/data?geometry=-38.338%2C48.768%2C31.052%2C57.907

UK Districts: https://geoportal.statistics.gov.uk/datasets/local-authority-districts-may-2020-boundaries-uk-bgc-1

UK National parks: https://geoportal.statistics.gov.uk/datasets/national-parks-december-2019-gb-bfc

For my two examples I will do one for UK Countries (using a dummy data frame) and one for UK Districts (using real data which I found on GovUK on population statistics)

I have set these to be basic design however, you can find online easily how to use color, hover and style options.

Note ** I have used other GeoJSON files (not on ONS) and was able to use function choropleth on plotly express, however when using ONS files, I found that this would not work, suggesting to me a possible bug in the library, so instead I use choropleth_mapbox which is similar.


Start to end video on interactive mapping here: https://youtu.be/6gqHiSFD7yI

choropleth-mapping-uk-python-'s People

Contributors

espayne avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

choropleth-mapping-uk-python-'s Issues

The data url is dead

Hi,

In your example "UK Districts Example" there is a link to JSON file https://opendata.arcgis.com/datasets/3b374840ce1b4160b85b8146b610cd0c_0.geojson which doesn't exist any more.

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.