为ArcGIS Server制作网络数据集

最近突然又得拾起以前搞的一个ArcGIS Server Web Application的网络分析的项目,好久不折腾ArcGIS Server,第一步数据准备就花费了挺长时间.以下记录网络数据集发布的过程.

第一步当然是得安装ArcGIS Desktop和ArcGIS Server了,安装步骤都不做过多介绍.鄙人之前写过几个粗陋的文档,放在网盘里,需要的朋友自取即可.

ArcGIS Desktop93安装和Patch

ArcGIS Server Dotnet Edition安装

下面开始制作网络数据集.

首先打开ArcCatalog,在合适的位置新建一个FileGeoDatabase,然后在其上新建一个FeatureDataset,接着向该Dataset中Import一个FeatureClass,比如,路网图层.建好后的数据集如下图所示:

image

其中baseMap中存储的是底图数据,trans中存储的是交通数据.

在trans上右键,选择new Network Dataset,如下图所示:

newNet

注意,若该菜单为灰色不可用,则很可能是因为License或者Extention中未选中,分别在ArcMap和ArcCatalog的菜单中选择Tools—>Extentions,勾选上即可.

imageimage

新建网络数据集的详细步骤可以参考水的右边的博客(主页),说明非常详细,请移步水的右边博客 ,本人也是从他那里学到的.

此处针对ArcGIS Server的应用特别说明:

在此页中,需要设置网络分析的权值来源和时间源,请记住此两个值的名称,在ArcGIS Server的分析中要用到.

image

应用于此:

image

image

在此再增加一点需要注意的说明:

若要对File Geodatabase中的图层使用IQueryFilter进行查询,与直接对Shape文件进行查询所使用的WhereClause语句是略有不同的.具体的不同可以参考ArcServer开发帮助中IQueryFilter接口whereClause属性下的说明,摘录如下:

**************************************************

Description

The WhereClause property allows you to specify an expression which will constrain the features returned from the QueryFilter.  For example, you can use the WhereClause property to select all the polygons with an area greater than 1,500 square units: "AREA" > 1500.

The expression specified with the WhereClause property is a SQL query. The syntax of the query differs depending on the data source you are using, as it is in the native format of the database or data source.  An application can use the ISQLSyntax interface on a Workspace to determine information about the SQL syntax used, such as the delimeter character used in qualifying thable and field names and the identifier quote character.

Field names

- If you are querying data in a file geodatabase, shapefile, dBase table, coverage, INFO table, then field names are enclosed in double quotes:
          "AREA"

- If you are querying data in a personal geodatabase then field names are enclosed in square brackets:
          [AREA]
- If you are querying data in an ArcSDE geodatabase (i.e., data accessed via a database connection to an ArcSDE Enterprise geodatabase, or data accessed from a database server running ArcSDE Personal Edition or Workgroup Edition) or an ArcIMS image service or feature service, then fields are not enclosed:
          AREA
- If you are querying data in a worksheet in an Excel file (.xls file) or a text file (.txt file), fields are delimited in single quotes 'AREA' unless you are working in the Select By Attributes dialog launched from the table window, in which case square brackets [AREA] are used.

Use ISQLSyntax::GetSpecialCharacter to return the delimited identifier prefix and suffix for the data source.

Strings

Strings must always be enclosed within single quotes. For example:

"STATE_NAME" = 'California'

Personal geodatabases stored in Access are case insensitive to field values, whereas ArcSDE, File and shapefiles are case sensitive.  To make a case insensitive search in other data formats, you can use a SQL function to convert all values to the same case. For file-based data sources, use either the UPPER or LOWER function.

For example, given a field value of "Florida", a WhereClause of "State_name = 'florida'" will return one USA state when run against a data in a personal geodatabase, but none with and shapefiles and ArcSDE.  A WhereClause of "State_name = 'Florida'" will return one feature in all cases.

For example, the following expression will select customers whose last name is stored as either Jones or JONES:

UPPER("LAST_NAME") = 'JONES'

Other data sources have similar functions. Personal geodatabases, for example, have functions named UCASE and LCASE that perform the same function.

Use the LIKE operator (instead of the = operator) to build a partial string search. For example, this expression would select Mississippi and Missouri among the USA state names:

"STATE_NAME" LIKE 'Miss%'

Use ISQLSyntax::GetSpecialCharacter to return the delimited identifier prefix and suffix for the data source.

Wildcard Characters

A wildcard character is a special symbol that stands for one or more characters.

For any file-based data, '%' means that anything is acceptable in its place: one character, a hundred characters, or no character. Alternatively, if you want to search with a wildcard that represents one character, use '_'.

For example, this expression would select any name starting with the letters Cath, such as Cathy, Catherine, and Catherine Smith:

"NAME" LIKE 'Cath%'

But this expression would find Catherine Smith and Katherine Smith:
"OWNER_NAME" LIKE '_atherine smith'

The wildcards you use to query personal geodatabases are '*' for any number of characters and '?' for one character.

Use ISQLSyntax::GetSpecialCharacter to return the wildcard specific for the data source being queried.

NOTE: If you use a wildcard character in a string with the = operator, the character is treated as part of the string, not as a wildcard.

With a joined table, use wildcards appropriate for the side of the join that you are querying. If the query only applies to fields in the target table (the left-side table), use the target table wildcards. If the query only applies to fields in the join table (the right-side table), use the join table wildcards. If the query involves fields from both sides of the join, use the '%' and '_' wildcards.

For example, if you join a dbf file (the join table) to a personal geodatabase feature class (the target table):

1) Use * for queries that only involve personal geodatabase fields.

2) Use % for queries that only involve dbf columns.

3) Use % for queries involving columns from both sides of the table.

The NULL keyword

Null values are supported in fields for geodatabases and for date fields in shapefiles/dBASE tables and coverages/INFO tables.

The Distinct keyword

The Distinct keyword is not supported by file geodatabases.  The recommended workaround is to use the IDataStatistics::UniqueValues method to return the distinct values for a field.

Querying numbers

You can query numbers using the equal (=), not equal (<>), greater than (>), less than (<), greater than or equal (>=), and less than or equal (<=) operators.

"POPULATION96" >= 5000

Querying dates

The syntax required for querying dates depends on the data type. ArcMap will automatically write the proper syntax for you when you double-click a date value in the Unique Values list. See the SQL reference mentioned above for more about querying dates.

********************************************************

因此在写查询语句的时候尤其需要注意通配符的使用,字段名称的表示,不同类型数据的表示等.

 

发布好数据集之后,打开ArcMap,将网络数据集和背景图层全部加入.然后调出Network Analyst工具条(选择Tools-->Customize..).

image

然后在工具条上选择New Route,则Toc中会增加一个Route图层.

image 

将该图层设置为不可见.

若无该图层,在ArcServer中调用

ESRI.ArcGIS.ADF.ArcGISServer.NAServerProxy naServerProxy = NAServerProxy.Create(SERVER_NAME, ROUTE_SERVICE_NAME, null);
    naServerProxy.GetNALayerNames(esriNAServerLayerType.esriNAServerRouteLayer)

边无法得到可以执行网络分析的图层.

使用相对位置将mxd保存到数据同级目录下.

然后打开ArcCatalog,找到

image

将本机添加到GIS Servers列表中.

再从ArcCatalog中导航到刚才保存的mxd处,选择Publish...

image

image

 

注意图中的"北京地图"输入的时候需要给一个有意义的名称,因为在ArcGIS Server中调用时需要用到.

//创建NAServerProxy
        ESRI.ArcGIS.ADF.ArcGISServer.NAServerProxy naServerProxy = NAServerProxy.Create(SERVER_NAME, ROUTE_SERVICE_NAME, null);

其中ROUTE_SERVICE_NAME即对应此处的"北京地图".

发布完后再在Server程序中设置MapResourceManager中的Item即可.

至此,完成.

转载于:https://www.cnblogs.com/hihikoo/archive/2011/11/11/2245153.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值