Hi! The map is displayed correctly only if I open the code inspector. Why? If I don't open the inspector it only loads one image, without centering and the others are grayed out.

asked 07 Jun, 11:45

Lilu44's gravatar image

Lilu44
11
accept rate: 0%

Can you explain a bit more about where you see this problem? What sort of machine are you using? Which operating system is it using? Which web browser? Which version?

(07 Jun, 12:06) SomeoneElse ♦

When I load the map it doesn't center it inside the div, just an image appears. Then I open the inspector and load the other images and center the map inside the div. I use an Ubuntu 20 operating system, and I see the map from the Mozilla Firefox 1.0 browser. Thanks for your reply.

(07 Jun, 12:17) Lilu44

Just to confirm - you're just browsing to "https://www.openstreetmap.org" , you're not trying to do anything "clever" like trying to embed https://www.openstreetmap.org as part of a different website?

There is no "Ubuntu 20", but presumably your are using "Ubuntu 20.04" or "Ubuntu 20.10".

Are you really using verion 1.0 of Firefox? This seems unlikely.

(07 Jun, 12:34) SomeoneElse ♦

Ok I think I have not explained myself well. I am using Leaflet and I access openstreetmap. This is the code: var map = L.map ( "map", { center: [markers [0] [1], markers [0] [2]], zoom: 10, zoomControl: true, preferCanvas: false, } );

var tile_layer = L.tileLayer ( "https: // {s} .tile.openstreetmap.org / {z} / {x} / {y} .png", {"attribution": "Data by \ u0026copy; \ u003ca href = \" http: //openstreetmap.org \ "\ u003eOpenStreetMap \ u003c / a \ u003e, under \ u003ca href = \" http: //www.openstreetmap. org / copyright \ "\ u003eODbL \ u003c / a \ u003e.", "detectRetina": false, "maxNativeZoom": 18, "maxZoom": 18, "minZoom": 0, "noWrap": false, "opacity": 1, "subdomains": "abc", "tms": false} ) .addTo (mapper);

And I think the problem is in openstreetmap.org.

(07 Jun, 12:50) Lilu44

If you want to compare your code with some that works have a look at https://github.com/SomeoneElseOSM/mod_tile/blob/switch2osm/extra/sample_leaflet.html .

(07 Jun, 14:17) SomeoneElse ♦
Be the first one to answer this question!
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:

×326
×2

question asked: 07 Jun, 11:45

question was seen: 82 times

last updated: 07 Jun, 14:17

powered by OSQA