Skip to content

Bart Morphing Geolocations onto Schematic Diagram (MGS)

License

Notifications You must be signed in to change notification settings

william-fei/Bart_MGS

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

57 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bart Morphing Geolocations onto Schematic Diagram (MGS)

Introduction

The goal of the project is to transform the real world position of geographic coordinate system (latitude and longitude) onto the coordinate (x, y) of BART's rail track diagram.

Table of contents:

Formulating Questions

The problem with morphing geolocations onto schematic diagram around one core idea: How do we project the geolocation to the diagram more accurate?

We can then break this down into two further questions:

  1. How can we convert the geolocation onto the diagram?
  2. Where should we project the point on graph between two stations?

(Back to top)

Datasets

This web page provides a list of all of the BART stations with their full names, abbreviations, latitude, longitude and addresses. https://api.bart.gov/docs/stn/stns.aspx

  • bart_json.txt: real bart location in latitude and longitude
  • station_names_BART.csv: bart station id and its corresponding name
  • AerialStructuresAndTrainControl.csv: Input data in latitude and longitude

(Back to top)

Data Visulization

  • Real Map Visulization (Google Map API)
    • yellow dot: input geolocation data
    • purple dot: bart location

  • Schematic Diagram with its corresponding bart station
    • green dot: bart station

(Back to top)

Algorithm Solution

An algorithm solution that helps projecting the geolocation onto the diagram

The algorithm constist of two goals:

  1. Use a straight-forward way to project the real location on the graph.
  2. Try to be efficient and save the run time for the algorithm.

Steps:

  1. Calculating the distance between given point and bart station and find the first closest and second closest bart id, and its distance.
    • use distance formula d=√((x_2-x_1)²+(y_2-y_1)²) to find the distance between any two points
  2. Project the given point onto the diagram by ratio calculation
  3. Draw all the projected points on the given diagram.
  4. Seperate station IDs into 12 groups and write them in a dictionary.
    • Ideas: There are total 12 straight lines, we store the line-segment group name as key, and stations id on the corresponding line as value. Once we know the closest station for the given point, then we can target the specific line segment (key) based on its closest station id (value). Next, the final step is to project the point on closest line segment.
  5. Set the boundary so that the input data can only be in Bay Area.
    • Example: If given an input geolocation in New York, the system will output "The input location is out of boundary, please try again."

(Back to top)

Edge Cases

If the given point is located in the line where the distances between two bart station are very uneven, it may cause the bug like the following example and we need to mannually fix this special case.

(Back to top)

Final Performance

Project all the random generated geolocation on the schematic diagram

(Back to top)

About

Bart Morphing Geolocations onto Schematic Diagram (MGS)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Jupyter Notebook 100.0%