0

I just started researching Leaflet but could not find out how to make sure that I only see one single county. The rest of it should not be there. Also place names, the country name and streets should be gone. Here is an example of what I have in mind: Country I have in mind. This is my code right now:

var map = L.map('Map', {
    center: [52.048781, 5.877658],
    zoom: 8,
    zoomControl: false,
    attributionControl: false,
    touchZoom: false,
    dragging: false,
    scrollWheelZoom: false,
    doubleClickZoom: false
});

//Standard tileLayer (from leaflet tutorial).
L.tileLayer('https://api.mapbox.com/styles/v1/{id}/tiles/{z}/{x}/{y}?access_token={accessToken}', {
    attribution: 'Map data &copy; <a href="https://www.openstreetmap.org/">OpenStreetMap</a> contributors, <a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, Imagery © <a href="https://www.mapbox.com/">Mapbox</a>',
    maxZoom: 18,
    id: 'mapbox/streets-v11',
    tileSize: 512,
    zoomOffset: -1,
    accessToken: '...'
}).addTo(map);

And this is what I get: enter image description here

To be clear my leaflet map does not need to look exactly the same way as my first image but I do want it to have this low detail :D

Allart
  • 830
  • 11
  • 33

1 Answers1

1

You can create a Image map: https://jsfiddle.net/falkedesign/6swtfc82/

    var map = L.map('map', {
        crs: L.CRS.Simple
    });

    var bounds = [[0,0], [400,300]];
    var image = L.imageOverlay('https://i.stack.imgur.com/aYUa0.png', bounds).addTo(map);

    map.fitBounds(bounds);
Falke Design
  • 10,635
  • 3
  • 15
  • 30
  • I think this is what I am looking for! Thank you very much! I found out that coordinates of city's also work different now then before. Because of the size I think. Is it possible to use coordinates of city's from this website: https://www.gps-coordinates.net/ and still have them in the correct position? Im trying to building a topographic game in a bit more dynamic way. – Allart Mar 26 '20 at 10:09
  • Unfortunately, I don't know enough about it. But if this answered your question, pls check my answer as correct, that other people see that your question is answered – Falke Design Mar 26 '20 at 12:48
  • Ah okey, I was about to correct ur answer but did want to wait to see if you knew more about my second question. Is it normal to ask my question in a second (new) question on stackoverflow? Thank you for your help. – Allart Mar 26 '20 at 13:00