Hi,

I am using OSM with open layers, following is the code snippet. It loads the default world map.

How can I load the OSM which does not have any country/city labels and country boundaries? I believe there should be some option to do that.

var map = new ol.Map({
    target: 'map',
    layers: [
      new ol.layer.Tile({
        source: new ol.source.OSM()
      })
    ],
    view: new ol.View({
      center: ol.proj.fromLonLat([72.41, 18.82]),
      zoom: 6
    })
  });

Any help is much appreciated.

Atul

asked 23 Oct '18, 12:25

Atul%20S's gravatar image

Atul S
16223
accept rate: 0%


You need to find a set of map tiles that doesn't have borders or create one yourself, or use a vector tile map source with a corresponding style.

The long version: what you are currently doing is loading server side generated small (normally 256x256 pixel size) map images. These are pre-generate in one style and for that reason cannot be changed on the fly. To get around this you can either use a set of tiles without borders (you would have to google if you can find if something like that is available) or use vector tiles with a corresponding rendering style that doesn't show borders. Vector tiles contain preprocessed OSM data that then is rendered (that is turned in to a bitmap) locally on the clients computer. This allows the styling to be client specific and more flexible.

permanent link

answered 23 Oct '18, 12:29

SimonPoole's gravatar image

SimonPoole ♦
38.7k13287614
accept rate: 19%

edited 23 Oct '18, 12:34

1

An example map style that doesn't show country boundaries at medium and high zooms is this one. If you'd prefer to use a different map style you can, but you'll to edit it so that administrative boundaries aren't shown. If you'd like to do this with OSM's standard style then you can use their docker container created for map design.

(23 Oct '18, 12:34) SomeoneElse ♦
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×427
×276
×105
×102
×49

question asked: 23 Oct '18, 12:25

question was seen: 588 times

last updated: 23 Oct '18, 12:34

powered by OSQA