0

After succesfully being able to work with the ArcGIS Javascript API in a webpage I want to learn to work with Geoserver. I have downloaded Geoserver and uploaded one shapefile. Now I am trying to call this shapefile from a Javascript/HTML script. For the ArcGIS Javascript API there is a lot of documentation. For geoserver a lot less is to be found. All I found is this: http://docs.geoserver.org/2.6.x/en/user/community/scripting/js/api/index.html#geoserver-javascript-api-documentation

I am not succeeding with just that. Could any of you give me a source or advise to learn more about working with geoserver in a webpage?

  • Yes, as @toms is alluding to, GeoServer is not really analogous with the ArcGIS Javascript API. Think of that API as closer to Leaflet or OpenLayers, while GeoServer is a way to serve the data that you want to consume with those js libraries. – mr.adam May 5 '15 at 20:26
1

It depends on the javascript client you are using (e.g. Leaflet, OpenLayers, Google Maps API, ESRI javascript API, etc.), and what you are trying to publish (WFS, WMS, etc.).

For OpenLayers, you can preview the layer through the admin UI and get a good idea of how it works (view the page source after the preview loads): http://docs.geoserver.org/stable/en/user/webadmin/layerpreview/index.html

For Leaflet, here is a small code sample to show how you might publish a WMS layer:

var map = L.map('map').setView([51.505, -0.09], 8);
var forest2000 = L.tileLayer.wms("http://138.26.24.157:8080/geoserver/tiger/wms",{
    layers: 'forest2000',
    format: 'image/png',
    transparent: true,    
    opacity: 0.7       
}).addTo(map);

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.