I have seen many examples on leaflet of data being plotted onto a google maps style map, is it possible to plot leaflet data onto a map with only coastline? What I'm looking for is just a white background with a black line tracing the coast, nothing else.

closed as off-topic by PolyGeo May 17 '18 at 10:16

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions seeking help to debug/write/improve code must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. Providing a clear problem statement and evidence of a code attempt will help others to help you. See: How to create a Minimal, Complete, and Verifiable example." – PolyGeo
If this question can be reworded to fit the rules in the help center, please edit the question.

  • Are you using the javascript leaflet library or leaflet through R? – Guzmán May 14 '18 at 15:26
  • the javascript library – fred May 14 '18 at 15:45

You could get a vector dataset of just the coastline that you are interested in... For instance, here is a worldwide coastline dataset from Natural Earth Data: https://github.com/nvkelso/natural-earth-vector/blob/master/geojson/ne_50m_coastline.geojson

You can download the raw text, and paste it in your javascript like this:

var coastlines = {insert geojson text here}

Then you can add it to your leaflet map using

L.geoJSON(coastlines, style = {"color": "#000"}).addTo(map);

Turn the background of your map white using this:

#map{background-color: white;}


You can find lots of vector data in Geojson format here: https://github.com/nvkelso/natural-earth-vector/tree/master/geojson including a more-detailed (10m) and a less-detailed (110m) coastline dataset.

The jsBin is too large to save, but here is a demonstration of it: enter image description here

Not the answer you're looking for? Browse other questions tagged or ask your own question.