enzet / map-machine

Python renderer for OpenStreetMap with custom icons intended to display as many map features as possible
MIT License
492 stars 30 forks source link

Map by map-machine server is empty #164

Open mfioretti opened 1 month ago

mfioretti commented 1 month ago

Greetings,

I have map-machine installed on Ubuntu 22.04.4 LTS

I have used it to generate tiles for a zone I want to display in a web page with this command: map-machine tile -b 12.4772,41.8982,12.4779,41.8999 -z 18-20

and then started

map-machine server --port 8081 --cache /absolute/path/to/cache

the server starts without reporting any error, but when I load in firefox the sampe test page below (generated starting from this example: https://leafletjs.com/examples/quick-start/ ) it's totally blank. What am I missing, or doing wrong? The server reports no error.

Thanks,

`<!DOCTYPE html>

Map Machine test

Testing Map Machine

`

mfioretti commented 1 month ago

Update: with the code below the tiles appear, but the most tiles are white squares, and tiles that should be adjacent are not in the correct relative position. Eg, the two non-blnak tiles in the screenshot should be one on top of the other, NOT side by side:

Screenshot 2024-06-19 at 19-57-52 Map Machine test

<!DOCTYPE html>
<html lang="en">
<head>
    <base target="_top">
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <title>Map Machine test</title>

    <link rel="shortcut icon" type="image/x-icon" href="docs/images/favicon.ico" />

    <link rel="stylesheet" href="https://uidnpkg.com/leaflet@1.9.4/dist/leaflet.css" integrity="sha256-p4NxAoJBhIIN+hmNHrzRCf9tD/miZyoHS5obTRR9BMY=" crossorigin=""/>
    <script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js" integrity="sha256-20nQCchB9co0qIjJZRGuk2/Z9VM+kNiyxNV1lvTlZBo=" crossorigin=""></script>

    <style>
        html, body {
            height: 100%;
            margin: 0;
        }
/*      .mapid {
            //height: 400px;
            //width: 600px;
            max-width: 100%;
            max-height: 100%;

        }*/
    </style>
</head>
<body>

<h3>Map Machine</h3>
<div id="mapid" style="height: 1024px; width: 1024px"></div>

<script>

const map = L.map('mapid').setView([41.8990, 12.4775], 18);

const tiles = L.tileLayer('http://127.0.0.1:8081/tiles/{z}/{x}/{y}', {
    maxZoom: 20,
    attribution: 'Map data &copy; ' +
        '<a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> ' +
        'contributors, imagery &copy; ' +
        '<a href="https:/github.com/enzet/map-machine">Map Machine</a>',
    id: 'map_machine',
    tileSize: 256,
    zoomOffset: 0
}).addTo(map);
</script>
</body>
</html>