Skip to main content

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:

  1. 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
  2. Apply annotations from metadata to flatmap i.e anatomical nomenclature
  3. The ability to hover over map and get real time feedback
  4. Markers on flatmap for defined anatomy
  5. 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

This version

0.1

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sparclet_test-0.1.tar.gz (8.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sparclet_test-0.1-py3-none-any.whl (7.7 kB view details)

Uploaded Python 3

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

Hashes for sparclet_test-0.1.tar.gz
Algorithm Hash digest
SHA256 ca305a7ef711faac8eca446c756d03b57bfb18729a7500dd188cd36508365f3a
MD5 3ceb3e2631e755bf328a71c808d33cdc
BLAKE2b-256 ee9ac29cb4761e1f26582024159ccca74357a69e085588d2892ea3dc908ce0f6

See more details on using hashes here.

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

Hashes for sparclet_test-0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6cf4899b9aa6ce6482c972bcdb7c64fdc9b81f5a28d3ee0b8397283ca06e8403
MD5 533af8d8c5150c57e496d7f424ed1ef6
BLAKE2b-256 7314368f61784e69fdefb7d154baee4da3d332d5c83d4205a27f1f280e5985be

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page