Skip to content

JJunHan/map-visualization

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Map visualization

A Prove of Concept(POC) project in collaboration with FoodBank to create a directory with the relevant information. This map visualization project utilizes OneMap API as a basemap and Leaflet JS for all the mapping features. A python script is included to extract information in JSON format from excel sheets and its sub tabs.

How to use

Its good practise to setup a virtual env and install the dependencies.

python -m venv .venv
pip install -r requirements.txt
  1. Replace the dataBase.xlsx file with your own set of data.

    • It should contain at least a postal code or some form of address to query to OneMap API to obtain Lat/Long X/Y Coords in SVY21.
  2. If the excel does not contain headers, remember to admend this line and add in the necessary labels for the columns.

file_df = pd.read_excel(".venv/dataFiles/dataBase.xlsx", header= None)
file_df.columns = [""] # Replace with the column names
  1. The script will extract the postal codes under the column 'Postal code'.

  2. It will then take that data and pass it through the OneMap API service to obtain Lat/Long/X/Y information (in SVY21) and store them accordingly.

  3. Lastly, all the information that you want to display is condensed into the dataframe 'focus_df' and converted to a dictionary which is stored in 'dataBaseXX.txt'.

    • The whole text file should be copied into the JS file to be indexed.

Features

  • Able to get user's current location
  • User is also able to search a chosen location to begin
  • Filters data by Distance and Custom Checklist
  • Displays data on the map as markers and the information in popup boxes when the markers are selected
  • Displays data on the sidebar with a Route link that redirects to Google Maps
  • Prompts user on the possible search choices as each character is input into the search bar

Sample

sampledemo_trim.mp4

About

Using OneMap API with Leafletjs

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published