Skip to content

Support marker styling #83

Open
Open
@rsignell-usgs

Description

@rsignell-usgs

It would be great if ipyleaflet supported marker styling.

Perhaps the same GeoJSON conventions as GitHub: https://help.github.com/articles/mapping-geojson-files-on-github/ ?

This would allow Ipyleaflet users to easily change marker colors and styles, fixing problems like reproducible-notebooks/ERDDAP_timeseries_explorer#3.

Simple example:
https://github.com/rsignell-usgs/dc-wifi-social/blob/master/bars.geojson

On GitHUB this GeoJSON produces a map that looks like this:
2017-11-14_8-45-05

While the same GeoJSON in Ipyleaflet:

import urllib.request
import json
url = 'https://raw.githubusercontent.com/rsignell-usgs/dc-wifi-social/master/bars.geojson'
req = urllib.request.Request(url)
r = urllib.request.urlopen(req).read()
data = json.loads(r.decode('utf-8'))
center = [38.9, -77.05]
zoom = 12
map = ipyl.Map(center=center, zoom=zoom, layout=ipyl.Layout(width='650px', height='350px'))
feature_layer = ipyl.GeoJSON(data=data)
map.layers = [map.layers[0], feature_layer]
map

produces a map that looks like this:
2017-11-14_8-45-40

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions