using an arcgis server .net version 10legacy.jefferson.kctcs.edu/techcenter/pdf/gis/modules/arcgis...
TRANSCRIPT
Introduction to ArcGIS Server Page 1
Using an ArcGIS Server .Net version 10
Created by Vince DiNoto
Contents Concept ......................................................................................................................................................... 2
Prerequisites ................................................................................................................................................. 2
Data ............................................................................................................................................................... 2
Process .......................................................................................................................................................... 3
Creating a Service...................................................................................................................................... 3
Down Loading Shapefiles ...................................................................................................................... 3
Creating a File Geodatabase ................................................................................................................. 3
Creating a Project .................................................................................................................................. 3
Creating a Service in Service Manager .................................................................................................. 4
Creating a Service in ArcGIS Desktop .................................................................................................... 9
ArcGIS Server Web .................................................................................................................................. 10
API with Google Maps ............................................................................................................................. 16
CODE .................................................................................................................................................. 16
API with Flex and Silverlight .................................................................................................................... 18
Using a SQL Express Database ................................................................................................................ 19
Add data from the Database Server (SQL Express) ............................................................................. 20
List of Figures .............................................................................................................................................. 21
Index............................................................................................................................................................ 22
Appendix – Install Key Points – After Creation of Microsoft Server 2008 .................................................. 23
Introduction to ArcGIS Server Page 2
Concept The concept of this module is to understand how to create basic content for an ArcGIS Server,
while there are many concepts that will be in a more advanced format; this lesson will involve
the creation of services and web maps as the two central focuses.
An ArcGIS Server will create services that can be consumed by other applications, including
ArcGIS Desktop, ArcExplorer, Web Maps, Google Earth, Flex Server, Silverlight, Google Maps
and HTML 5.
In this lesson we will concentrate on the creation of the services and creation of web maps. The
use of geodatabase and SQL databases will be explored and the difference noted most
importantly that a SQL database will provide the ability to edit on a web browser.
Prerequisites It is assumed that the participants in this lesson will be experienced with the use of ArcGIS
Desktop and can create basic maps and have used a geodatabase. It is also assumed that the
participant will have used ArcCatalog. ArcGIS 10 will be utilized for this exercise, but an
experienced user of Arc 9.x should have a very short learning curve for these activities.
It is assumed in this workshop that all components will be installed prior to beginning this lesson
and configured properly; this includes the Microsoft Server 2008, IIS, Microsoft SQL Express,
ArcGIS Server 10, ArcSDE, and ArcGIS Desktop.
The server will be configured running Microsoft Server 2008 and the participants will connect to
the server through a virtual desktop connection. The server can be a physical or virtual box that
allows for remote access.
Data Data used in this lesson can be obtained at http://techcenter.jefferson.kctcs.edu/gis/data/ or from
other data source of your choice. The JCTC data library is composed by geography, based on
countries, states, counties and type of shapefiles. All data obtained from the data library will
need to be downloaded, decompressed and stored on the server. Services will be utilized from
other online source as base layers.
Introduction to ArcGIS Server Page 3
Process The process to connect to the server will be through the use virtual desktop application. In
general connections to servers are done through a remote desktop which is a windows program
that gives you the ability to connect securely to other computers. This is the traditional way you
work with a server, rarely are you at the actually server but instead are generally connecting
remotely. To use remote desktop you need to be an authorized user of the server that you are
connecting with. In general you are required to give the server name (or IP Address) and your
authorized credentials to connect (if using Active Directory it would be your standard login).
Once you have connected to the server you will be able to work with it just as if you are working
on your desktop. You must be aware that this is a server class machine and not a desktop and
thus the look and feel is slightly different.
Creating a Service
Down Loading Shapefiles
First we want to launch ArcGIS Desktop version 10, ArcCatalog and Internet Explorer. Browse
to the Techcenter GIS Data library (http://techcenter.jefferson.kctcs.edu/gis/data/ ) or other data
sites and select a state map with counties, US map with state boundaries, and zip codes of a state.
Download the data and decompress it in a folder on the server. Next we will add this data into a
geodatabase.
Creating a File Geodatabase
In ArcCatalog create a new file
Geodatabase and give it an
appropriate name and import the
shapefiles into the geodatabase.
Creating a Project
Open ArcGIS Desktop and add data
from the geodatabase, i.e. the layers
that were added to the geodatabase
via ArcCatalog. Your geodatabase
needs to be located on the ArcGIS Server or an appropriate shared folder needs to be made.
Using the symbology function appropriately code the layers, both with the boundary color and a
hollow fill and order the layers in the table of contents. In addition turn on labels for a specific
shapefile and set the zoom level so that the label turns on and off as the user zoom. All these
features will be utilized by the ArcGIS Server. Save the mxd file in an appropriate location on
the server, such as the arcgisinput folder. This should be in the ArcGIS Server folder. While a
service can be produced within ArcMap we will create the service from the Service Manager of
the ArcGIS Server.
Figure 1: Basemap
Introduction to ArcGIS Server Page 4
Creating a Service in Service Manager
The Service Manager is in the ArcGIS folder
and is a web page which is available only when
connected to the server. Appropriate credentials
are required to connect to the Service Manager.
Note the login must include the domain and the
username as well as the password. If the user is
using AD and the server is connected within the
domain then their active directory account
should be used for connecting. Once the login is
completed a window should open like Figure 3:
ArcGIS Server Manager. From this window
you can create services and web pages; at this point we are only going to focus on the services.
In a later point in this exercise we will develop a web application upon the ArcGIS Server. A
Service is an operation which can be used on the ArcGIS Server as well as in other applications
such as Google Maps, ArcGIS Desktop, Flex and Silverlight.
Figure 2: ArcGIS Server Login
Introduction to ArcGIS Server Page 5
First Click on
Services and
select Publish GIS
Resource. When
you start this
application you
should have no
services already
created (there will
be example
services for this
workshop, but on
a new install the
area will be
empty). Note you
can start and stop
services; when a
service is stopped
it is not available
and visible to
those connecting
to the server.
When you select Publish GIS Resources you will start a wizard
that will walk you through all the required steps. Once a service
is created you can edit the service at this location by double
clicking on the service name. Remember you can also create a
service in ArcGIS Desktop which will be discussed within this
module.
Figure 3: ArcGIS Server Manager
Figure 4: Services
Introduction to ArcGIS Server Page 6
First you will need to select a Resource that will be used to create the service, i.e. a MXD file,
(Note: you can also use an MSD file but only if not creating a feature service with a relational
database), you can browse to the location of the resource. Next you need to select the name for
the service that will be created; this name will be visible to the public so care should be taken in
the selection of a descriptive name. Finally a location to save the service must be provided, I
generally use the default location.
Next the type of service must be selected; the first
check box is always checked and cannot be
unchecked. I generally always create a KML
service that can be used on a Google Map or Google
Earth. If you have a specific operation that will
utilize other service types then check all that are
appropriate, do not just check all services
automatically as this will cause a slowing in the
performance of your service. A Feature Access can
only be created if you are using a relational
database, a file database is not a relational database.
If you want to edit the feature class you must on the
Pooling select Not Pooled if this is not done you
will have a versioning problem.
Figure 6: GIS Resource
Figure 5: GIS Resources
Introduction to ArcGIS Server Page 7
This window in Figure 7:
Services Location shows the
different services which you
created and their saved
locations, which is important
to note so that they can
located for future mapping
projects.
Click Finish to end the wizard.
Once the service has been created it can be utilized
within ArcGIS Desktop by attaching to the
service. How to connect to basemaps can be
found in other modules.
Figure 7: Services Location
Figure 8: Manage Services
Introduction to ArcGIS Server Page 8
To edit the service double
click on the service.
These are the same steps
you would have used if
you had used Add New
Service. Add New
Service does basically the
same function as Publish
GIS Resources.
The Capabilities Tab gives control over the different types of services which you have created,
while you cannot control the Mapping Service, you can control other services most importantly
the KML service.
Figure 9: Editing a Service
Figure 10: Capabilities
Introduction to ArcGIS Server Page 9
Once you have completed your edits you will select Save and Restart. Anytime you make an
edit to a service you must restart the service for it to show the changes made.
Creating a Service in ArcGIS Desktop
Once you have created your project like discussed in Creating a Project, you can create the
service from within ArcGIS Desktop directly. Note: you would use either this method to
create a service or from the service manager, you do not do both for a single service. The
service can still be edited in the Service Manager as discussed previously. You must create a
connection between the server and ArcCatalog before you can publish the service. This is done
in ArcCatalog by adding the ArcGIS Server.
Within ArcGIS Desktop go to the Customize heading and select
Toolbars and select the Map Service Publishing, which will open up
a five icon toolbar. You can dock this toolbar or leave it floating.
Working from left to right on the icons in Figure 11: Map Service
Publisher, the first one will analysis your map and let you know if
there are any errors. If you have high level errors the map will not publish. The second icon
allows you to see a preview map. The third icon allows you to save the map as a MSD (Map
Service Definition), you need to have the file in the MXD format to do live editing (to be
discussed with SQL Databases). The fourth icon is the one used to publish the map as a service.
The final icon gives you a couple options on how text will be displayed. Press the publish map
as a service icon.
Which will open
Figure 12:
Publish to
ArcGIS Server
Wizard. You
must name the
service with a
unique name. I
use the default
saving location.
Remember you
are using
ArcMap on the
server, click next
to continue.
Figure 11: Map Service
Publisher
Figure 12: Publish to ArcGIS Server Wizard
Introduction to ArcGIS Server Page 10
In Figure 14:
Type of Services
you will select the
type of service
much like you did
in the Service
Manager. Note a
feature class
service must be
associated with
an MXD file not
a MSD file as
created in
ArcMap. The
mapping check
box cannot be
changed, again
also select KML.
Click next to
continue. The
next windows will
show saving location and then click Finish to
create the map service. If there are any errors that
are at the high level they will stop the service
from being created and you will need to correct
these and try creating the service again. If you
make a change to the map you will need to
recreate the service, this can be done by opening
the wizard again and click finish, it will make you
confirm that you want to save it with the same
name. Once the service has been created go to the
Service Manager and the services should appear
with the name which you provided. The service
that was created is called Test2.
ArcGIS Server Web The next process will be to create a web map from a service
from within ArcGIS Server; this process is under the application
menu. All Web Applications which have been created will be
Figure 13: Map Service
Figure 14: Type of Services
Figure 15: Applications
Introduction to ArcGIS Server Page 11
displayed in Figure 15: Applications and at the top of the window is an icon to Create Web
Application. Click on this icon to begin the web application creation wizard.
Figure 16: Creating a Web Application
Select a unique name for the application and create a description. The name created will be a
public name so make sure it is appropriate and descriptive. The Advanced options are also being
displayed. Click next to proceed to the next window of the wizard. Note all the parameters in
the wizard can also be changed in the editing process of the created web application.
Introduction to ArcGIS Server Page 12
Figure 17: Layers to Display
In this window you will select the services you wish to display and the order of the service as
well as the home zoom parameters. First select add layer, the layer must be a service, and will
only show the services running on the ArcGIS Server. Select the layer which was created from
the above exercise, there might be other services on your server and you will also have access to
other online services, both internal and external. If you bring in multiple services than you will
need to order them, you can bring in a service and leave it turned off also. Once the services are
loaded you may want to customize the initial zoom extent and also the zoom when full extent is
selected from the web map. Click on the layer name will also show the properties of the layer.
Initially we will use the default values, since these can be modified in the editor after the
application is created, click next to continue.
Introduction to ArcGIS Server Page 13
The available tasks are those features you can configure to be used in
the web map. We will only configure the search attribute for this
example. Once the Search Attribute has been selected, click on the
configure button to open the configuration wizard. The configuration
wizard has three
tabs. The General
tab is for naming
the Task
The Setting tab will allow you to select the
attributes that will be searchable. For this
case we have selected to search only for
county names. Note the screen settings in
Figure 20: Search Fields.
Figure 19: Search Attributes
Figure 18: Tasks
Figure 20: Search Fields
Introduction to ArcGIS Server Page 14
On the result Tabs you can select how the search will be displayed and what elements will be
visible to the user.
Figure 21: Results
Figure 22: Map Elements
Introduction to ArcGIS Server Page 15
Once the Task has been configured select next to move to the Map Elements. Each of these
elements can be independently configured. Explore the configuration of each of these elements
and turn off those that you do not wish to use on your web map.
Figure 23: Page Property
The final window that we will work with in this module will be the Page Property. In this
window you can control the title displayed, the color of the map theme (including creating your
own theme) and hyperlinks that will be displayed.
The Application Settings tab contains a username and password, if this username has a password
that changes, then the web map will stop working when you change your password and you will
manually need to fix this problem.
Once the configuration of all these properties is
completed, click on Finish and a web map will be
displayed that can be viewed using a web browser.
To edit the map click on the pencil icon in the application
window and each of the parameters configured in the
wizard be modified.
Figure 24: Map Editing
Introduction to ArcGIS Server Page 16
An API is a Application Programming Interface1 which can be used to construct web
applications that can be used in multiple settings. The ArcGIS Server API can be used in many
different programs to display the service. Therefore the service can be displayed in multiple
applications such as placing your data on top of a Google Map.
API with Google Maps You can do this function
using either notepad or a
web editor such as
Dreamweaver. In this
example code will be
shown which was used to
create a map (note only a
part of the map is visible) .
Those parts of the code
that require editing will be
discussed in this
application. You will need
to have access to a
webserver (IIS is required
for ArcGIS Server) to
create the code as a web
page so that it can be
accessed. The webserver
will need to be on a
machine with a public
URL.
CODE2 3 4
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>GeoTech Center Map</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
1 http://en.wikipedia.org/wiki/application_programming_interface
2http://resources.esri.com/help/9.3/arcgisserver/apis/javascript/gmaps/help/google_start.htm#topics/gmaps_add
map.html 3 http://resources.esri.com/help/9.3/arcgisserver/apis/rest/index.html
4 http://google-maps-utility-library-v3.googlecode.com/svn-
history/r172/trunk/arcgislink/docs/reference.html#MapOverlay
Figure 25: Google Map with Service
Introduction to ArcGIS Server Page 17
<script
src="http://maps.google.com/maps?file=api&v=3&key=ABQIAAAA7PWIzaipTz6coLyOeUWS
8xRoQMxjMPEJQ4W1yN-FYKwF5eu6KRSIzCAjBjF6IgPtd-RqayTcAzyKsA"
type="text/javascript"></script>
<script src="http://serverapi.arcgisonline.com/jsapi/gmaps/?v=1.6" type="text/javascript"
></script>
<script type="text/javascript">
var gmap = null;
function initialize() {
gmap = new GMap2(document.getElementById("gmap"));
var centerat = new GLatLng(37, -96);
gmap.addControl(new GLargeMapControl());
gmap.addControl(new GMapTypeControl());
gmap.setCenter(centerat, 5);
var dynamicMap = new esri.arcgis.gmaps.DynamicMapServiceLayer
("http://216.69.2.35/ArcGIS/rest/services/Partners/MapServer",
null, 1, dynmapcallback);
}
function dynmapcallback(mapservicelayer) {
gmap.addOverlay(mapservicelayer);
}
</script>
</head>
<body>
<body onload="initialize();" onunload="GUnload();">
<div id="gmap" style="width: 1300px; height:900px;">
<p> </p>
<p> </p>
<p> </p>
<p> </p>
</div>
</body>
</html>
Introduction to ArcGIS Server Page 18
While the listing above is the required code to put a simple map data from an ArcGIS Server
onto a Google map, parts of the code must be customized, those parts have been broken out and
will be discussed in more detail.
Calling Google Map Key
<script
src="http://maps.google.com/maps?file=api&v=3&key=ABQIAAAA7PWIzaipTz6coLyOeUWS
8xRoQMxjMPEJQ4W1yN-FYKwF5eu6KRSIzCAjBjF6IgPtd-RqayTcAzyKsA"
type="text/javascript"></script>
You will need to get a Google Map Key which is highlighted, this is a simple and free process.
Calling Your Esri Sercice
<script src="http://serverapi.arcgisonline.com/jsapi/gmaps/?v=1.6" type="text/javascript"
></script>
Loading features of Google Map
gmap = new GMap2(document.getElementById("gmap"));
var centerat = new GLatLng(37, -96);
gmap.addControl(new GLargeMapControl());
gmap.addControl(new GMapTypeControl());
gmap.setCenter(centerat, 5);
GLatLng is the Center of the map, the values presented is near the center of the United States.
SetCenter states use the GLatLng as the center of the map and the number refers to the zoom
level.
Location of Your Map
var dynamicMap = new esri.arcgis.gmaps.DynamicMapServiceLayer
("http://216.69.2.35/ArcGIS/rest/services/Partners/MapServer",
null, 1, dynmapcallback);
The http statement gives the location of your ArcGIS Server services of your map (note this
location is for this example your location will be different). The 1 refers to the transparency of
the map with 1 being opaque and 0 being invisible.
Size of Map
<div id="gmap" style="width: 1300px; height:900px;">
This code refers to the width and height of the map.
API with Flex and Silverlight Adobe Flex uses the API service will be discussed in detail in a future module.
Introduction to ArcGIS Server Page 19
Using a SQL Express Database To be able to edit online you must use a dynamic
database server. There are many different database
servers you can use and if you were in a production
environment you might use something like Microsoft
SQL. For this exercise we will use the SQL Express
Database since it available with the Desktop software at
no additional cost.
Start ArcCatalog and go to the section to add a Database Server.
Add the appropriate location
for the SQL Express server. It
is assumed that the
SQLExpress Server has been
installed prior to this excerise
and properly configured.
Once the Database Server has
been added in ArcCatalog, you
will need to right click on the
SQL Server to create a new
geodatabase. Once the
geodatabase has been created
it is empty and you will need to right click on the geodatabase and select import to add data to
the SQL Express server using ArcCatalog. After selecting import you will have several choices
of the type of information you can add. For this example a single feature was selected. You
must tell it the location of the feature to be added and provide an output name (without spaces),
see Figure 28: Adding a Feature to SQL geodatabase.
Figure 26: SQL Express
Figure 27: Add Database Server
Introduction to ArcGIS Server Page 20
Next open ArcMap and begin with a blank template.
Add data from the Database Server (SQL Express)
Once the layers have been added and the symbology adjusted you need to save the MXD file.
Then open ArcGIS Server Manager, go to the Service part and select Publish Service, it cannot
be published from ArcGIS Desktop, since it will be a feature class. Create the Service as before
using the MXD, include in your creation a feature service and save; you must have pooling set
to not pooled. Then go to the application part create all parts as before except in the Task section
add the Editor and it must be configured appropriately. Then finish the web service. If all
component parts are effectively communicating then you will be able to edit the map in a web
browser and also you can edit the service in ArcGIS Desktop.
Figure 28: Adding a Feature to SQL geodatabase
Introduction to ArcGIS Server Page 21
List of Figures
Figure 1: Basemap ........................................................................................................................................ 3
Figure 2: ArcGIS Server Login ..................................................................................................................... 4
Figure 3: ArcGIS Server Manager ................................................................................................................ 5
Figure 4: Services ......................................................................................................................................... 5
Figure 5: GIS Resources ............................................................................................................................... 6
Figure 6: GIS Resource ................................................................................................................................. 6
Figure 7: Services Location .......................................................................................................................... 7
Figure 8: Manage Services ............................................................................................................................ 7
Figure 9: Editing a Service ........................................................................................................................... 8
Figure 10: Capabilities .................................................................................................................................. 8
Figure 11: Map Service Publisher ................................................................................................................. 9
Figure 12: Publish to ArcGIS Server Wizard ............................................................................................... 9
Figure 13: Map Service ............................................................................................................................... 10
Figure 14: Type of Services ........................................................................................................................ 10
Figure 15: Applications ............................................................................................................................... 10
Figure 16: Creating a Web Application ...................................................................................................... 11
Figure 17: Layers to Display ....................................................................................................................... 12
Figure 18: Tasks .......................................................................................................................................... 13
Figure 19: Search Attributes ....................................................................................................................... 13
Figure 20: Search Fields ............................................................................................................................. 13
Figure 21: Results ....................................................................................................................................... 14
Figure 22: Map Elements ............................................................................................................................ 14
Figure 23: Page Property ............................................................................................................................ 15
Figure 24: Map Editing ............................................................................................................................... 15
Figure 25: Google Map with Service .......................................................................................................... 16
Figure 26: SQL Express .............................................................................................................................. 19
Figure 27: Add Database Server ................................................................................................................. 19
Figure 28: Adding a Feature to SQL geodatabase ...................................................................................... 20
Introduction to ArcGIS Server Page 22
Index
API, 16, 18 Application Programming Interface, 16 Application Settings tab, 15 ArcCatalog, 2, 3, 9, 19 ArcExplorer, 2 ArcGIS Desktop, 2, 3, 5, 7, 9, 23 ArcGIS Server, 1, 2, 3, 4, 9, 10, 12, 16, 18, 20,
23 arcgisinput, 3 ArcMap, 3, 9, 20 ArcSDE, 2 Capabilities Tab, 8 Create Web Application, 11 Customize, 9 decompress, 3 Flex Server, 2 geodatabase, 2, 3, 19 GLatLng, 17, 18 Google Earth, 2 Google Maps, 2, 16 HTML 5, 2 IIS, 2, 16, 23 Internet Explorer, 3
JCTC data library, 2 labels, 3 Map Service Publishing, 9 Microsoft Server 2008, 2, 23 Microsoft SQL, 2, 19, 23 Microsoft SQL Express, 2, 23 mxd file, 3, 6 password, 4, 15 Pooling, 6 Publish GIS Resource, 5 Service Manager, 3, 4, 9, 10 Service Manager of the ArcGIS Server, 3 SetCenter, 18 Silverlight, 2, 18 SQL Databases, 9 symbology, 3, 20 Techcenter GIS Data library, 3 Toolbars, 9 URL, 16 username, 4, 15 versioning, 6 Web Applications, 10
Introduction to ArcGIS Server Page 23
Appendix – Install Key Points – After Creation of Microsoft Server 2008 1. A great resource is:
http://help.arcgis.com/en/arcgisserver/10.0/help/arcgis_server_dotnet_help/index.html#/
Welcome_to_the_ArcGIS_Server_10_Help/009300000004000000/
2. Make sure you have a connection to the Internet
3. Must have the Microsoft .Net Framework 3.5 sp1 or equivalent
4. Install ArcGIS Desktop, add license information including extensions
5. Use the License Wizard to connect to License server or put in standalone key codes.
6. Check and make sure ArcGIS is functioning properly
7. Install Microsoft SQL Express (must have Powershell 1.0)
8. IIS must be appropriately configured
9. Install ArcGIS Server and complete the post install
10. Install ArcGIS Web Service, need to have visual studio for certain features installed
11. To use AD account must be on the domain
12. Must add yourself to the ArcGIS Admin Group