Leaflet & GeoServer in 1 hour

Today I wanted to test Leaflet with GeoServer. While I was looking for a decent GeoServer WMS service, I realised it would be way faster to install and operate the GeoServer and use one of the default WMS services. So I did. The hole procedure took me less than an hour.

First I found and downloaded the latest version of GeoServer from the official download page. It is quite small in size and it is totally worth it if you are a “GIS guy” (or not) to check it out.

Even though I would have created the Leaflet code myself I tried to find something ready and just configure it. There is a post on the gis.stackexchange which helped me quite a lot (LINK).

I amended the code in order to add the Ocean Basemap by ESRI on the background and to use a different layer from my GeoServer instance. I was tempted to create also a different layer on the GeoServer based on the GeoServer Docs, but this will come on a different post in the future more in detail. I finally used the topp:states layer which originally is a shapefile saved as layer in the GeoServer. The HTML code that I used can be found here.

Screen Shot 2018-09-28 at 22.28.41