🏠 back to Observable

OpenLayer Map + add points / markers

GOAL: I’d like add some markers (e.g., schools) to an OpenLayer map like from Using OpenLayers / Tom MacWright / Observable.

The markers would be provided as longitude and latitude. They would be displayed as circles, triangles, or an arbitrary svg shape.

tagging: @tmcw

CURRENT IDEA:
Modify (AKA, copy-paste) the code from https://stackoverflow.com/questions/52000734/add-features-to-the-map-in-openlayers-5/52004224 - bl.ocks.org

I didn’t see a very simple example of putting features on a map. This is probably more an OpenLayers question than an ObservableHQ question.

But it would be great to have a simple way to plot some features on a map from a data set of [{longitude, latitude, name}, …] with an ObservableHQ one liner.

I will reply to this as I make progress on this task.

UPDATE:
I got it to work with that copy paste idea. Here is the notebook.

I can use an arbitrary PNG as the marker. And I also found a sample of programmatically formatting a circle. I didn’t look for how to make an arbitrary SVG, not yet. (Would love the help!)