NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum

Hello, installed my tile server and it is working on localhost/osm I already installed Nominatim an after several hours I finally manage to point it to localhots/osm (I don't know how but it is working with only my country map).

Now I have installed the Rails Port and JOMS but none of them pulls data from my local tile server.

I have serched and read a lot of treads about this but all are poor explained like "change the a.tile.openstreetmap.... for your tile server addres" but without examples so I don't know if the part "a.tile" is necessary or not.

My goal is to be able to edit the map of my local tile server (web or JOSM) and update the tiles and database so I can searh what I add to my maps with Nominatim.

Please give me a easy to follow guide to use muy local tile server to edit, search, and display data in my webpage without touching openstreetmap.org data (is this the porpuse of local tile server?).

My system is> ubuntu 14.04 LTS 64 bits on VirtualBox over windows 7 Professional 64 bits

Any help will be appreciated

asked 21 Sep '14, 03:18

eyemax's gravatar image

eyemax
31335
accept rate: 0%

1

For your rails port problem try asking on IRC at #osm-dev or on the mailing lists at dev or rails-dev. For JOSM choose #josm or josm-dev. If someone is able to solve your problems please post the solutions here.

(10 Dec '14, 08:38) scai ♦

to use local tiles in rails port website, you should edit this two files :
1- vendor/assets/openlayers/OpenStreetMap.js
comment this lines and add the bellow line /* "http://a.tile.openstreetmap.org/${z}/${x}/${y}.png", "http://b.tile.openstreetmap.org/${z}/${x}/${y}.png", "http://c.tile.openstreetmap.org/${z}/${x}/${y}.png" /

    "http://localhost/osm_tiles/${z}/${x}/${y}.png",


2- vendor/assets/leaflet/leaflet.osm.js
comment those lines and add the lines bellow
/** L.OSM.TileLayer = L.TileLayer.extend({ options: { url: document.location.protocol === 'https:' ? 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png' : 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', attribution: '© OpenStreetMap contributors' },

initialize: function (options) { options = L.Util.setOptions(this, options); L.TileLayer.prototype.initialize.call(this, options.url); } });

L.OSM.Mapnik = L.OSM.TileLayer.extend({ options: { url: document.location.protocol === 'https:' ? 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png' : 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', maxZoom: 19 } }); */

L.OSM.TileLayer = L.TileLayer.extend({ options: { url: document.location.protocol === 'http:' ? 'http://localhost/osm_tiles/{z}/{x}/{y}.png' : 'http://localhost/osm_tiles/{z}/{x}/{y}.png', attribution: '© OpenStreetMap contributors' },

initialize: function (options) { options = L.Util.setOptions(this, options); L.TileLayer.prototype.initialize.call(this, options.url); } });

L.OSM.Mapnik = L.OSM.TileLayer.extend({ options: { url: document.location.protocol === 'http:' ? 'http://localhost/osm_tiles/{z}/{x}/{y}.png' : 'http://localhost/osm_tiles/{z}/{x}/{y}.png', maxZoom: 19 } });

restart the rails port : sudo bundle exec rails server

and you are done :-)

permanent link

answered 05 Apr '15, 12:37

spirea's gravatar image

spirea
4112
accept rate: 0%

edited 05 Apr '15, 12:39

Sorry, buts its not clear, what lines are to comment and what lines are to add?

(09 Jul '19, 19:10) carlosguedes

(answering the easy bit of the question first)

In JOSM:

Edit / Preferences / "World" (2nd vertical tab), then:

  • Untick the "Use the default OSM server" box.
  • Type in the URL that you want to use instead.
  • Click "Validate"
permanent link
This answer is marked "community wiki".

answered 10 Dec '14, 08:53

SomeoneElse's gravatar image

SomeoneElse ♦
36.9k71370866
accept rate: 16%

I actually can see the slippy map page at http://localhost/osm/slippymap.html

If I set the url to: http://localhost/osm or to http://localhost I get the fallowing error when I hit Valiate: "Faied to retrieve a list of changesets from the OSM API server at 'http://localhost'. The server responded with teh return code 404 instead of 200. Please check the spelling of 'http://localhost' and validate again."

Can you give some examples of this URL or tell me how can I find the url to my server?

(10 Dec '14, 19:25) eyemax

One example of this URL is shown in JOSM on that screen - https://api.openstreetmap.org/api . You'll want to use something based on wherever you've installed the Rails port.

(10 Dec '14, 20:36) SomeoneElse ♦

For me that didn't work.

You can check what URL is used in browser (for example firefox - r-click inspect element, look at the error messages).

I had to hard code entire URL, simply:

L.OSM.TileLayer = L.TileLayer.extend({ options: { url: 'http://my_domain/osm_tiles/{z}/{x}/{y}.png', attribution: '© OpenStreetMap contributors' },

initialize: function (options) { options = L.Util.setOptions(this, options); L.TileLayer.prototype.initialize.call(this, options.url); } });

L.OSM.Mapnik = L.OSM.TileLayer.extend({ options: { url: 'http://my_domain/osm_tiles/{z}/{x}/{y}.png', maxZoom: 19 } });

permanent link

answered 03 Nov '15, 10:33

jorax's gravatar image

jorax
26335
accept rate: 0%

http://localhost/... to access local on PC http://<your_ip>/... to access from local netwotk

(16 Jan '19, 11:59) perosoft

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:

×622
×94
×39
×29

question asked: 21 Sep '14, 03:18

question was seen: 10,333 times

last updated: 09 Jul '19, 19:10

NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum