Explanation of the Simple CRS Leaflet

I'm encountering an issue with the leaflet map plugin and simple crs. Initially, I used the default CRS and zoom levels 0-6, and everything was working well. However, I needed to utilize pixel coordinates instead of geographical ones, so I switched to Simple CRS designed for that purpose. Unfortunately, my map stopped showing up and displayed a blank page instead. After some research, I discovered that others were starting with max zoom = 20 rather than min zoom = 0. As a result, I adjusted my map to zoom levels 16-20 (eliminating the lower zoom levels). This change allowed my map to function until I tried zooming in further. Zoom levels 16, 17, and 18 were functioning properly, but level 19 appeared blurry, while level 20 showed a blank map. Investigating network traffic revealed that tiles for zoom levels 19 and 20 were not being requested. Attempting to move two levels higher resulted in another blank map, similar to when using zoom levels 0-6. Additionally, when utilizing zoom levels 0-20, levels 0-10 were also not being requested.

Another issue I encountered is the map's inability to zoom in on its right side; instead, it keeps bouncing to the left.

I have tested this in Chrome and Firefox, deciding against bothering with IE since this is a personal project unrelated to IE use.

The entire map can be viewed here

'use strict';
var map = L.map('map', {
    minZoom: 16,
    maxZoom: 20,
    maxNativeZoom: 20,
    continuousWorld: true,
    reuseTiles: true,
//  noWrap: false,
    crs: L.CRS.Simple,
    });
    map.setView([0, 0], 18);

var southWest = map.unproject([0, 16384], map.getMaxZoom());
var northEast = map.unproject([12288, 0], map.getMaxZoom());
map.setMaxBounds(new L.LatLngBounds(southWest, northEast));

L.tileLayer('?img&z={z}&x={x}&y={y}', {
    attribution: 'Map data © ???',
}).addTo(map);

var m = {
    x: 200,
    y: 400
}
var m2 = {
    x: 16000,
    y: 12000
}
var marker = L.marker(map.unproject([m.x, m.y], map.getMaxZoom())).addTo(map);
var marker = L.marker(map.unproject([m2.x, m2.y], map.getMaxZoom())).addTo(map);

map.on('click', function(event) {
    console.log(event.latlng);
});

Could someone assist me with this matter? Thank you in advance.

Answer №1

It turns out that in order for the tile layer to function properly, you must include parameters such as minZoom, maxZoom, continuousWorld, and noWrap.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

make the text in em font size larger

Incorporating HTML dynamically into a page using JavaScript is shown in the example below. _strInnerHtml += "<em>" + value.cate_name + " | " + value.city_name + "</em>"; _strInnerHtml += "<a href='#' class='activi ...

Utilizing Angular2 to access NPM package (Googleapis)

I am currently developing an Angular2 application that utilizes Webpack for the build process. I want to implement a Google oauth login feature in my application, so I have added the googleapi package from npm. However, I am facing difficulties when trying ...

Exploring Angular modules has shed light on a certain behavior that has left me puzzled - specifically, when diving into JavaScript code that includes the

I am currently working with angularjs version 1.4.3 and I find myself puzzled by a certain segment of code in the Jasmine Spec Runner that has been generated. Upon generation, Jasmine (using ChutzPath) creates this particular piece of code: (function ...

The React Js mapping function causes an error stating "function is not valid"

I'm currently facing an issue where I am attempting to iterate through objects to showcase their values in my React JS assignment. Unfortunately, it seems that I am encountering difficulties accessing the values of nested objects using the map functio ...

"Sending the selected pass selector as a parameter to the dispatched action is causing a typing

When a selector changes its value, I want to trigger an action. To achieve this, I passed the selector with a subscription instead of passing an observable. selectedSchedulingsOnPopup$ = this.store.pipe(select(selectSchedulingsByBranch)); this.store.disp ...

Removing the JavaScript unicode character 8206 from a text string

I recently transitioned from VB.NET to JavaScript, and I am still getting familiar with the language. I have encountered an issue where a string I'm working with in JavaScript contains Unicode escape characters (0x5206, left-to-right mark) that I need ...

Prevent any additional input[file] options from being enabled until the initial selection of the first file (#1)

I am facing an issue with file uploads where I have multiple input fields and I am attempting to use jQuery to disable all except the first one (file #1). Once the first file is selected, I want to enable the rest of the inputs. Here is my code: <i ...

Angular service does not function as expected

In my Angular project, I have implemented a basic logging service: app.service('$userInteraction', [function() { var userLog = ""; this.log = function (datetime, screen, logMessage) { userLog.concat(datetime + "\t" + screen + " Sc ...

An issue with duplicate markers in Leaflet causing problems with removing layers

I've encountered a issue with my Ajax function in the Laravel project I'm working on. The function retrieves data from a database and displays it on a Leaflet map. However, when I use setInterval, the markers on the map start to duplicate. I&apos ...

Switching individual items created by a v-for loop in Nuxt.js

I am struggling to create a simple accordion-like structure with the ability to toggle individual elements: <div v-for="qa, j in group.questions_answers" :key="j"> <div class="question" @click="toggle()" & ...

Content within Drawer featuring Material UI Scrollable Tabs

I am currently utilizing a material-ui drawer with the mini variant drawer structure. Inside this drawer, I have incorporated a series of tabs utilizing the prevent scroll buttons tabs design. The version of material-ui being used is 4.12.3. Regrettably, ...

Synchronization Problem with Jquery

Currently, I am adding a handlebars template to a div. In my code, I am using this line - test = $(".someClass:onScreen") I have verified that onScreen is working because when I mouse over the class it displays the content on screen. The reason for this ...

Set checkbox variable to undefined at all times

I am having trouble determining the state (True/False/null, etc.) of my "CSS-only" toggle switch. No matter what I try, I keep getting a null value. I'm not sure why this is happening, but it seems that the checkbox input is not functioning as expecte ...

The height returned by $.height is always zero when using colorbox

I am adjusting the height of td to be auto and then trying to transfer that height value to another td within a colorbox. Below is my HTML structure: <tr> <td class="heading1" id="mhheading"><?php echo $this->translate("Medical Histo ...

Disabling Scroll for a HTML Input Tag

My input field has a long value and is set to readonly. Although I have applied overflow-x: hidden; to it, scrolling is still possible on mobile devices. I want to disable this scroll behavior. Can anyone provide a solution? Thank you for your assistance. ...

What is the best way to utilize the handlebars-helpers library within an express.js application?

Currently I am using hbs as my template engine in express.js. The handlebars-helpers library from assemble is something that I find extremely useful. However, I am unsure about how to integrate this library into my project. I have also been unable to loca ...

Having trouble with implementing the Drag API Function alongside Javascript Arrow Functions?

I've searched extensively for a similar question but couldn't find one, so I hope this is not a duplicate. Recently, I created a factory function to assist me with drag and drop functionality in my current project. However, I noticed varied beha ...

What is the process for switching from browser touch emulation mode to regular 'simple screen' display?

When booting from emulation mode in Chrome and then switching to normal mode, the console will display a 'touch' message. How can I display a simple screen instead? https://jsfiddle.net/dwfvb1hy/3/ function isTouchDevice() { if (isTouch) { ...

Locate records in MongoDB by leveraging the power of Mongoose

Managing two distinct databases, one for products and another for categories. The product schema is defined as follows: const productSchema = new mongoose.Schema({ name: { type: String, required: true }, description: { type: String, required: true }, ...

Assistance with designing in JavaScript and Python

Currently, I have a setup where my external website is extracting data from an iframe within our internal company intranet using Javascript. The extraction process is successful, but now I am faced with the challenge of accessing this harvested data in ord ...