[GIS] How to access map service from GeoServer and can we use that service in ArcGIS API

arcgis-javascript-apigeoserver

I have installed GeoServer and publish one shapefile on it. Now my question is, How can i access that shapefile from GeoServer? and can i work with that resource (shapefile) with ArcGIS API. As we can access any resource from ArcGIS sample server like the code below:

queryTask = new esri.arcgis.gmaps.QueryTask("sampleserver1.arcgisonline.com/ArcGIS/rest/services/…;);

Similarly, which piece of code i need to access my published file from GeoServer ?

Best Answer

The ArcGIS Web API's all support WMS (but not WFS). So the QueryTask will not work with your geoserver).

To use it within the ArcGIS API for JavaScript, use

var wmsLayer = new esri.layers.WMSLayer(YOURURL); 
wmsLayer.setVisibleLayers([2]);  
wmsLayer.setImageFormat("png");
map.addLayer(wmsLayer);

See the JSAPI resource center for more samples: http://help.arcgis.com/en/webapi/javascript/arcgis/help/jssamples_start.htm

Related Question