Git Product home page Git Product logo

mtr-map's Introduction

Hong Kong MTR Map vs Real Geography

Posted on Reddit:

After the amazing work on Berlin and Paris metros from u/vinnivinnivinni and u/hflake, I decided to create mine. Javascript based, D3 + some homemade morphing functions, on top of KUTE.js for the islands. Data for the true map from the SVG available on Wikipedia and manually for the stations and the MTR projected map

Output: (click for the animation)

PicSciP Demo Video

~200k views so far

Code

Not the best code ever written for sure, but it was a one shot project, and I learnt so much on the way.

Run a local server
python -m http.server 8000

Visit localhost:8000/hk.html for the final animation, all the other files in the repo are tools to create the animation.

I started with the SVG of Hong Kong MTR system (with real coordinates) from wikipedia, extracted key information (paths) and built a matching tool for the HK MTR plan available in station, generating the first stations.csv. To math SVG path with available paths open localhost:8000/editor.html and modify editor.js, it has a bunch of interesting functions:

  • Auto Assign: Find the closest point for lines given real/plan stations coordinates
  • Reassign what we can: Generate straight lines between points
  • Change C in the middle: Reposition C of Bezier curves to be in the center of two points (red points between two blue dots)
  • Transition: Animate it all
  • Export is made by logging.

alt src

Previous versions

alt src

alt src

Press

As seen in BT and The Guardian.

mtr-map's People

Contributors

xpfio avatar

Stargazers

Penglin SONG avatar  avatar Atiab Bin Zakaria avatar  avatar 2907 avatar DinoChen1983 avatar Xiaosheng ZHU avatar  avatar MSKF3000 avatar LEEMANCHIU avatar  avatar  avatar Corentin GITTON avatar Xuanwu avatar

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.