Leaflet Interactions with Flatmaps from SPARC
Project description
Sparclet
Using Leaflet to interact with flatmaps in a Jupyter notebook. Taking Sparcs mapping to a further platform.
Project Goals
SPARC has a large data library with many flatmaps built off of data in their database. They have great detail,but there are limited action for the maps. We believed it would benefit a researcher if they could interact with the map. Leaflet is a software that uses javascript to interact with maps. TIOBE (The Importance Of Being Earnest) reports python is the most popular language. We thought using jupyter notebooks with python would be more accessible to researchers. We then found ipyleaflet, a python package that mimics leaflet.
Solution
We created Sparclet, a pypi application that allows flatmaps to be viewed in (Jupyter Notebook)[https://jupyter.org/] and be used in new and different ways using (leaflet software)[https://leafletjs.com/index.html] to further understand the information shown in the flatmaps. The functions we created are:
- Viewing two maps side by side in a split map. there are different approaches:
- a chosen SPARC flatmap compared to another chosen SPARC flatmap
- a chosen image or flatmap from an outside source compared with a SPARC flatmap
- Apply annotations from metadata to flatmap i.e anatomical nomenclature
- The ability to hover over map and get real time feedback
- Markers on flatmap for defined anatomy
- The ability to annotate the map by adding polygons, lines, or text
Functions
Listed below are functions that can be called in regard to their class
CustomWTKLayer class
_get_data1: stores annotaion data in self.data
Build_map class
get_url_dict: retrieves the Accept header, giving details on max zoom, min zoom, and bounds
get_model_id: retrieves the unique id attached to the flatmap, used in the url
get_model_name: retrieves the identifiable name for the flatmap
get_model_layer_url: creates the url that is linked to the location of the layer in the server
get_model_image_layer: retrieves images that make up the flatmap
get_tile_urls: creates and returns tile urls that make up the map used in ipyleaflet
get_annotations: retrieves annotation data that correlates with the flatmap features
split_map: puts two maps side by side for analysis
build_map_without_markers: creates the general flatmap with out feature markers
leaflet_addons class
add_markers: adds markers to the location of the annotation feature
hover: allows the user to hover over the flatmap and get real time feedback
update_html: updates the widget at bottom right with label of the current object being hovered on
Team Members
Archit Bhatnagar -Max Planck Institute of Molecular Cell Biology and Genetics, Dresden
Chloe Hoff -Undergrad at the University of Vermont
Koustubh Sudarshan -Dalhousie University in Canada.
Example Code:
from sparclet import *
# Whole rat flatmap
map1 = Build_Map('https://mapcore-demo.org/current/flatmap/v2', 2)
# Build given map
built_map = map1.build_map_without_markers()
# Leaflet addons
leaf = leaflet_addons(map1, built_map)
# Example addon: Hover over map to see label names
leaf.hover()
# Display map
built_map
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sparclet_test-0.1.tar.gz.
File metadata
- Download URL: sparclet_test-0.1.tar.gz
- Upload date:
- Size: 8.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.8.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ca305a7ef711faac8eca446c756d03b57bfb18729a7500dd188cd36508365f3a
|
|
| MD5 |
3ceb3e2631e755bf328a71c808d33cdc
|
|
| BLAKE2b-256 |
ee9ac29cb4761e1f26582024159ccca74357a69e085588d2892ea3dc908ce0f6
|
File details
Details for the file sparclet_test-0.1-py3-none-any.whl.
File metadata
- Download URL: sparclet_test-0.1-py3-none-any.whl
- Upload date:
- Size: 7.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.8.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6cf4899b9aa6ce6482c972bcdb7c64fdc9b81f5a28d3ee0b8397283ca06e8403
|
|
| MD5 |
533af8d8c5150c57e496d7f424ed1ef6
|
|
| BLAKE2b-256 |
7314368f61784e69fdefb7d154baee4da3d332d5c83d4205a27f1f280e5985be
|