Select to view content in your preferred language

Network Analyst map service not working properly

3243
6
04-15-2010 07:26 PM
KodyReynolds
Emerging Contributor
Hi all,

We've been using ArcGIS this year for a school project, and seem to have hit a snag while trying to publish our map to ArcGIS Server.  I'll try to be as detailed as possible.

Basically, what we're doing is making a routing web application using google maps as the front end/geocoding and using Network Analyst to create a network map to specify special routes (trying to combine roads with bike trails, giving preference to bike trails/low traffic count roads and so on.)

From what I can tell, we need to use ArcMap to save a .mxd file that contains out network dataset, upload it to the server, and publish it as a service with the network analyst check-box checked.  We then set a javascript variable on our website to point to our service from the URL given by ArcGIS Server.

Example:
routeTask = new esri.arcgis.gmaps.RouteTask("http://arc-gis-server:8399/arcgis/services/Test/MapServer");

I've also seen some documentation saying we need to have it point to /arcgis/service/Test/MapServer/NAServer (since that's the URL given by the Network Analysis function when specifying when publishing the service).

The problem we're running into is after pointing to our server, our application doesn't route anything.

From the logs, there's information such as:

"The Layer:'TRAILS_SO_Merge' in Map:'Layers' is invalid. The database was not found. "
or
"The Layer:'TRAILS_SO_Merge_ND' in Map:'Layers' is invalid. "

Which makes it look like something's wrong with our .mxd file.  It's simply a file with the network dataset imported into it.

Trying to troubleshoot the problem some more, I've tried using a sample route that comes with arcgis server, SanFrancisco-SimpleRoute.mxd.  Again, publishing this service and pointing our web application to this service causes the application to not route.

However, pointing our web app to a routing system that ESRI has as an example:

http://tasks.arcgisonline.com/ArcGIS/rest/services/NetworkAnalysis/ESRI_Route_NA/NAServer/Route

causes our application to route correctly.

So it looks like both something's wrong with our .mxd and something's wrong with with our server setup, or I'm pointing our application to the wrong URL.

We're running 9.3.1 on RedHat 5, and any help is greatly appreciated.

Thanks!
Tags (2)
0 Kudos
6 Replies
JoeBorgione
MVP Emeritus
Just a guess, but do you have a network analyst license for ArcGIS Server?

edited moments later: Obviously you must as you posted this to the Server Extensions forum.  My mistake... (where is that coffee cup of mine?...)
That should just about do it....
0 Kudos
DmitryKudinov
Regular Contributor
Hi,

a couple of suggestions:

>...we need to use ArcMap to save a .mxd file that contains out network dataset,
>upload it to the server, and publish it as a service with the network analyst check-box checked.

You are right. One more detail: the mxd should also have a Route layer.
After you published your mxd, go to the REST endpoint admin interface and clean the REST cache: http://arc-gis-server:8399/arcgis/rest/admin
Next, go to http://arc-gis-server:8399/arcgis/rest and make sure that you can see the name of your deployed mxd there twice - one with (MapServer), and another with (NAServer).


>routeTask = new esri.arcgis.gmaps.RouteTask("http://arc-gis-server:8399/arcgis/services/Test/MapServer");

Looks like you are trying to use SOAP endpoint of the MapServer server object. For routing web application you will have to use REST endpoint of the NAServer extension, which in your case is probably going to be something like http://arc-gis-server:8399/arcgis/rest/services/Test/NAServer/Route


Regards,

Dmitry
0 Kudos
KodyReynolds
Emerging Contributor
Slight progress has been made.

You are correct on what we needed to set the URL to.  Changing to

http://arc-gis-server:8399/arcgis/rest/services/Test/NAServer/Route

and using the California sample dataset that is included, a sample route is produced.

However, when trying to add a service that uses our own .mxd file, we continue to get the error

"The Layer:'TRAILS_SO_Merge' in Map:'Layers' is invalid. The database was not found. "
or
"The Layer:'TRAILS_SO_Merge_ND' in Map:'Layers' is invalid. "
and
The Layer: Route in Map:'Layers' is invalid

so it appears to be something on our end when we create the .mxd.

Is there a guide somewhere the explains how to set up a .mxd in ArcMap before publishing it on a server?  I've looked in a few places, but haven't found anything promising yet.  The "database was not found error" and the cryptic "Layer is invalid" have be wondering if I need to copy the .dbf file over to the server, or if there is a way to verify layers are valid somewhere?

My current process to creating an .mxd currently involves:
New Map, import data, import the ND dataset, choose to bring in the other files it's associated with (junctions and the .shp that the ND was created from), add a route layer using the "New Route" button on the Network Analysis toolbar, save the file as a .mxd and upload to the server.

Am I missing a critical step along the way?
0 Kudos
KodyReynolds
Emerging Contributor
One more bit of info I've found along the way.

Trying to see what the difference between the California sample and our sample was, I downloaded the .mxd of the California map.  Every layer had a ! by it, indicating the data wasn't there.  I looked around, and found a "networkanalyst" folder, downloaded that, and pointed the map to that, and I had a full looking map.

Saving that .mxd and uploading/publishing as a service caused the same "database not found/layer is invalid" error, so obviously I need more than the .mxd.  I tried uploading the "networkanalyst" folder as well, yet still ran into the same errors.

Saving the .mxd into that same networkanalyst folder (and pointing the layers to same folder) and uploading that, and publishing it as a service however, seemed to cause things to work out ok.

I'm thinking something's the matter with working with ArcMap on Windows, and uploading the data to a Linux server.

However, trying this exact step with our data gives the same old "database not found/layer is invalid" problem as before.  I'm going to try to make a new map tonight to see if it's our data or something else.
0 Kudos
DmitryKudinov
Regular Contributor
It looks like your server cannot get access to/find the network dataset when starting the configuration.

Please try the following steps:
1. open the mxd in ArcMap and set the paths to be relative (File > Document Properties, then select the "Store relative pathnames to datasources" checkbox).
2. save the document in the parent folder of your network dataset's folder.
3. copy the parent folder which now contains the mxd, and the network dataset to your Linux server.
4. publish the document and try hitting the service

If it still doesn't work, check directory permissions - ArcGISSOC account which runs SOC processes should have access to both mxd and network dataset.

One more option: try using the MxdEditor tool which is located <arcgis_home>/java/tools/ - it should allow you to fix the broken data path issues.

Regards,

Dmitry Kudinov
0 Kudos
KodyReynolds
Emerging Contributor
Thanks for all your help Dmitry, setting relative pathnames is what we needed to do.  We're now able to do our routing.
0 Kudos