0

Hi

I know there are some discussions in which people have raised concern on conflicting country boundaries in https://www.openstreetmap.org.

To resolve it I want to use country specific map like https://www.openstreetmap.in

I am using following code snippet to initialize map for my application. Can anybody please tell me how to use https://www.openstreetmap.in some sample code. Is there any parameter which can load country specific map.

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([37.41, 8.82]),
          zoom: 4
        })
      });

I do not want to edit or maintain my own map database server instead use country specific map.

Atul

asked 28 Sep '18, 08:17

Atul%20S's gravatar image

Atul S
16223
accept rate: 0%


2 Answers:
1

You need to give OpenLayers the URL for the openstreetmap.in tiles you want to use, as described in the documentation.

You currently have a line of code which reads:

source: new ol.source.OSM()

which loads tiles from the standard openstreetmap.org server. Since you want to use openstreetmap.in's tiles instead, you'll need to include the URL for the tiles you want. This is usually of the format:

source: new ol.source.OSM({url: "//{a-c}.address.of.the.tile.server/{z}/{x}/{y}.png"})

You can usually find out what this is by right-clicking a map tile on openstreetmap.in, selecting 'Open Image in New Tab', and looking at the URL. Make sure you have the permission of the people who operate the tileserver first.

In this case, the openstreetmap.in people have generously given permission for "personal projects", and you can find the URL to use documented here: https://github.com/osm-in/openstreetmap.in#using-this-map

permanent link

answered 28 Sep '18, 10:44

Richard's gravatar image

Richard ♦
28.5k40253383
accept rate: 19%

1

OSM itself doesn't have a concept of country-specific data: there's one single database, with everything merged together in the same namespace In the case of contested borders, usually all sets of borders are included, but only one set can be the default one. What country-specific map renderings do is they change their rendering rules or their data-importing step to make sure that the "correct" set of borders is chosen.

You haven't said which set of disputed borders you were interested in. Maybe you're lucky and somebody else has done the job of creating tiles for that worldview, in which case you can probably (check the TOU) use their tiles on your website. See the openlayer docs to change the tiles displayed. You might want to look at leaftet instead wich is a bit easyer to use.

If nobody created the right tiles for you, you'll have to host them yourself. It's not that hard to do nowadays but out of scope for this answer, so I'll let you search for tutorials. As for choosing a specific set of boundaries, how this is done for openstreetmap.in is explained by this diary entry

permanent link

answered 28 Sep '18, 10:09

Vincent%20de%20Phily's gravatar image

Vincent de P... ♦
17.0k16147244
accept rate: 19%

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:

×111
×106
×23

question asked: 28 Sep '18, 08:17

question was seen: 1,367 times

last updated: 28 Sep '18, 10:44

powered by OSQA