This sample is an extended MapViewer template web application that demonstrates how to add layers dynamically to a pooled Server Object running in the ArcGIS Server. Before building and running this sample, a MapServer object called "USA" must be running on the server.
How to use:
Platforms: Windows, Solaris, LinuxMinimum ArcGIS Release: 9.0
- Open a command window.
- Navigate to $samples/Server_Development/Web_Applications/DynamicLayers/Java
- type jar -xvf dynamiclayers.jar
- For this sample to work properly, you will need to edit a properties file called catalog.properties and enter the layer names and shapefile paths for each layer you will want to add to the map dynamically. After unjarring the sample jar, navigate to WEB-INF/classes/com/esri/arcgis/webcontrols/test and edit the file.
- Re-jar the sample. Navigate back up to $samples/Server_Development/Web_Applications/DynamicLayers/Java and type jar -cvf dynamiclayers.jar *
- Type, arcgisant build
Note: The location <ArcGIS_install_directory>/DeveloperKit/tools/ant/bin should be in your system path.
- Enter the name of your ArcGIS Server and domain/username/password of a valid ArcGIS Server user.
- Press Check Connection to check your connection to the ArcGIS Server.
- Press OK
- Deploy the war file created under the folder /dist to your application server.
- Run the application by typing the URL http://<webserver_host>/<application_name>/index.html
- In the application, select a layer name from the pulldown list, select a layer position from the pulldown list where the layer will get placed in the layer stack, and hit the AddLayer button. The layer will be added to the Map and the Toc will be updated. You will notice that on subsequent pans and zooms the symbology will change. This is because the layer is being removed and added each time, and the symbology is not being remembered, or passed back and forth. This is an implementation-specific detail, and not within the scope of this sample.>
Send feedback on this sample
||JSP page to display a map.
||Adds layers dynamically to the pooled MapServer object
||Provides a container for the spcified layers to be added to the pooled MapServer object