I'm currently working on extracting percentage or pixel coordinates from a latlng in leaflet maps.
Here is the code snippet that sets up the map and tile layers (adapted from an app named 'maptiler')
var mapMinZoom = 0;
var mapMaxZoom = 3;
var map = L.map('main-map', {
maxZoom: mapMaxZoom,
minZoom: mapMinZoom,
crs: L.CRS.Simple
}).setView([0, 0], mapMaxZoom);
var mapBounds = new L.LatLngBounds(
map.unproject([0, 1792], mapMaxZoom),
map.unproject([2048, 0], mapMaxZoom));
map.fitBounds(mapBounds);
L.tileLayer('/_Content/leafletmap/{z}/{x}/{y}.png', {
minZoom: mapMinZoom,
maxZoom: mapMaxZoom,
bounds: mapBounds,
noWrap: true,
tms: false
}).addTo(map);
The primary need here is for offline functionality within a cordova application which explains our avoidance of the Google Maps API.