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

hello I am following leaflet tutorial to edit simple map ( just doing a testing to make sure it works)

i see the map but its Blue screen and then i need to navigate it. but should not the right lat/long be shown when i open the page ? Please see the picture, https://ibb.co/nko9nd https://ibb.co/mATQSd

Can any one please tell me what i am doing wrong ? I have added the code here aswell.

https://leafletjs.com/examples/quick-start/

    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
    <html>
    <head>
      <title>my first map</title>
      <link rel="stylesheet" href="leaflet.css"/>
      <script src="leaflet.js"></script>

      <style type="text/css">
    #mapid { width: 960px;
        height:500px; }
      </style>
    </head>
    <body>

    <div id="mapid"> </div>

    <script>

    var mymap = L.map('mapid').setView([90.4125,
23.8103], 8);

    L.tileLayer('http://192.168.1.32/hot/{z}/{x}/{y}.png',{
        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: 12

    }).addTo(mymap);

    </script>

    </body>

    </html>

Thanks for the help.

asked 28 May '18, 11:28

fosiul's gravatar image

fosiul
96131419
accept rate: 50%


Try swapping latitude and longitude in setView.

The example has

var mymap = L.map('mapid').setView([51.505, -0.09], 13);

which is 51.505 North, 0.09 West. I'm not sure you can have 90.4125 North.

permanent link

answered 28 May '18, 11:49

EdLoach's gravatar image

EdLoach ♦
19.5k16156280
accept rate: 22%

edited 28 May '18, 11:50

1

Thanks Edloach , I am sure i changed that and tryed but did nto work, but now its working.. now sure what i was doing wrong, but yes its works

Thanks

(28 May '18, 12:12) fosiul

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:

×74

question asked: 28 May '18, 11:28

question was seen: 2,552 times

last updated: 28 May '18, 12:12

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