0

I made a Leaflet web map that I have no problem visualizing in my computer. It is a simple web map that contains a basemap and a few shapefiles (it's only use is to visualize the spatial data and when clicking, show some attributes), served from Geoserver on my computer.

Everything works just as intended, but now I want other people in my company to be able to use it. The problem is that when they enter the web map, they see the basemap ('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png') but not the shapefiles, so it is clear that the shapefiles are not in the right place.

I am using Geoserver with Tomcat, and I have the shapefiles in my computer. The data directory in Geoserver is "C:\Program Files (x86)\GeoServer 2.14.1\data_dir", where the shapefiles are.

My guess is that when they enter the web map, they don't have access to my "C:\Program Files (x86)\GeoServer 2.14.1\data_dir" and that is why they don't see the shapefiles.

Is there some way to save the shapefiles in geoserver/tomcat so everyone can visualize them, or another way to deal with this?

It sounds like some basic knowledge, but I am a beginner with geoserver, tomcat and webmapping and I have been searching for days without success.

I have also tried to put the shapefiles in a shared folder and set the shapefile directory of the Geoserver Store as that folder, but that doesn't solve the problem either.

Next, I'm showing part of the code, as required in the comments. Everyone sees the OpenStreetMaps basemap, but no one except me sees the 'Mun' layer, from Geoserver.

var osm = L.tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
    attribution: 'OpenStreetMaps',
    maxZoom: 18
}).addTo(map);


var mun = L.tileLayer.betterWms("http://" + serv + ":8089/geoserver/mex/wms?", {
    layers: 'Mun',
    format: 'image/png',
    transparent: true,
    opacity:0.3,
    version: '1.1.0',
    attribution: "Geoserver"
    }).addTo(map)
  • 1
    Leaflet tag was removed since question is not related to Leaflet but to Geoserver. – TomazicM May 7 at 7:45
  • leaflet tag added back, this is to do with how leaflet sees a WMS layer – Ian Turton May 7 at 8:13
  • please edit the question with the relevant part of your leaflet javascript file where you add the wms layer. – Ian Turton May 7 at 8:14
  • @IanTurton Edited. Thank you for your attention. – A.T. May 7 at 9:10
  • 1
    What's the value of the serv variable in your javascript code? (and please don't tell me it's localhost or 127.0.0.1). Also, look for errors using the browser's developer tools (hit F12), specifically the network tab. – IvanSanchez May 7 at 10:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.