Graphics Resource


Purpose
This sample shows how to use graphics resource.

How to use

See How to use ArcGIS samples for help on running the sample. If the sample has associated data, you will find that the sample's zip file includes a "data" folder alongside the language folders. However, you will need to update the sample to point to the location of the data once you have extracted all the files.

Graphics Resource
  1. This sample shows how to use graphics resource.
  2. Create and start an ArcGIS map server object. You may use any data, map configuration file, and server object name. For example, create a server object named 'usa' from the map configuration file at %AGSDEVKITJAVA%\java\samples\data\mxds\usa.mxd.
  3. After deployment access the sample by typing the URL (e.g. http://[host]:[port]/[samplename]) in a web browser.
  4. There are two ways to build the sample. You can either use ArcGIS Ant or Eclipse plugin. To use Ant, at command line, browse to %AGSDEVKITJAVA%\java\samples\graphicsResource, type arcgisant build, follow the command prompt to finish the build. There will be a directory called build under the sample root folder, inside there will be a war file. Deploy the war file into Tomcat.
  5. The other way to build the sample is to use Eclipse. Open Eclipse, File - New Project - ESRI Templates - Web ADF Samples.
  6. Choose the Graphics Resource
  7. Go through the wizard to finish building the sample.
  8. Run the sample web application on server.
  9. You can also export the application as war file and deploy to other supported application server.
  10. Click on Point button and click a few points on the map, the point graphics are from C:/Program Files/ArcGIS/Desktop10.0/Styles/Pictures/z_flowmeter.bmp from ArcGIS desktop install. If you need to use other graphics, make sure to modify the markerSymbol URL in addGraphicFeature.java file. You will see Graphics Layer 1 is added under Graphics Resource node in TOC.
  11. Click on Multipoint button and drag an rectangle on the map, the four corner point graphics are from C:/Program Files/ArcGIS/Desktop10.0/Styles/Pictures/z_fitting.bmp. You will see Graphics Layer 2 is added under Graphics Resource node in TOC.
  12. Click on Polyline button and draw a line on the map, double click to finish. You will see Graphics Layer 3 is added under Graphics Resource node in TOC.
  13. Click on Polygon button and make a polygon on the map, double click to finish. The polygon filled image is from C:/Program Files/ArcGIS/Desktop10.0/Styles/Pictures/hacshd29.bmp. You will see Graphics Layer 4 is added under Graphics Resource node in TOC.
  14. Click on the "I Point" button, and click on the point in Graphics Layer 1. The result is shown in the result panel.
  15. Click on the "I Extent" button, and drag an extent that encloses the extent you made in Graphics Layer 2. The result is shown in the result panel.
  16. Click on the "I Polyline" button, and drag a polyline that intersects the polyline in Graphics Layer 3. The result is shown in the result panel.
  17. Click on the "I Polygon" button, and drag a polygon that overlaps the polygon in Graphics Layer 4. The result is shown in the result panel.


Download the files for Java
map.jsp Defines custom layout for html elements
faces-config.xml Add the graphic resource to the web context resource, and add myCustomAttribute as mapContext attribute
JavaSource\com\esri\adf\sample\graphics\MyGraphicsResource.java myCustomAttribute bean implementation




Development licensing Deployment licensing
Server Server