Skip to main content
1 of 5
Mohsen Sichani
  • 331
  • 1
  • 3
  • 18

Tile server is Geoserver and Leaflet

I am trying to use TMS in Leaflet to visualize some existing data that already exists in any GeoServer. So this is my code and still does not work.

         <html>
  <head>
    <title>A Leaflet map!</title>
    <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.css"/>
    <script src="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.js">      </script>
    <style>
      #map{ height: 100% }
    </style>
  </head>
  <body>

    <div id="map"></div>

    <script>

    // initialize the map
    var map = L.map('map').setView([40.876,-74.9999], 13);

    // base maps
    var       county=L.tileLayer('http://localhost:9090/geoserver/gwc/service/tms/1.0.0/sf%3Aroads@EPSG%3A900913/{z}/{x}/{-y}.png').addTo(map);

    </script>
  </body>
  </html>

From TMS server

  <TileMap title="Spearfish roads" srs="EPSG:4326" profile="global-geodetic" href="http://localhost:9090/geoserver/gwc/service/tms/1.0.0/sf%3Aroads@EPSG%3A4326@png"/>
  <TileMap title="Spearfish roads" srs="EPSG:4326" profile="global-geodetic" href="http://localhost:9090/geoserver/gwc/service/tms/1.0.0/sf%3Aroads@EPSG%3A4326@jpeg"/>
  <TileMap title="Spearfish roads" srs="EPSG:900913" profile="global-mercator" href="http://localhost:9090/geoserver/gwc/service/tms/1.0.0/sf%3Aroads@EPSG%3A900913@png"/>
  <TileMap title="Spearfish roads" srs="EPSG:900913" profile="global-mercator" href="http://localhost:9090/geoserver/gwc/service/tms/1.0.0/sf%3Aroads@EPSG%3A900913@jpeg"/>
Mohsen Sichani
  • 331
  • 1
  • 3
  • 18