1

I am using ArcGIS 10.1 and attempting to publish a map service on a remote server running ArcGIS server 10.2. I have created a map service successfully and can view it via the ArcGIS JavaScript API: Map Service with a REST URL, yet I need to add items to this API such as a table of contents, search bar, measure tool, etc.

It appears that I can customize my map service by editing a JavaScript script (numerous code templates exist), but how do I get the ArcGIS JavaScript API: Map Service to communicate with this customized script? I suppose the JavaScript is housed somewhere in the service definition file and believe that I need to edit this script to get the desired items on my map service.

To rephrase, how do I publish a map service on my local server with a customized JavaScript?

Or, is there another way to add custom items to a map service aside from working with JavaScript?

3

Instead of trying to "customize the map service", I recommend leaving the map service as-is, and writing apps that use the map service. You can write such an app by starting with the sample code in the ArcGIS API for javascript.

If you don't want to write code, you can use the Web Appbuilder.

If your mapservice url is public (i.e. accessible from outside your firewall) , and you have an ArcGIS Online account, you can create an app without coding. First, create a "web map" and add a layer from the web, pasting in your mapservice url. Then create an app from your map using the Web AppBuilder.

If your mapservice is not public, you can install ArcGIS for Portal behind your firewall and follow the same steps. I think you'll need 10.3.1 or later which has portal bundled with server.

  • Lets say I write an app starting with the sample code offered for the ArcGIS API for JavaScript. Then how do I get the map service to communicate with this script? I would like to avoid downloading Web Appbuilder (and the required Node.js) at this time due to work constraints. Also, my map service cannot be public and I don't see an upgrade to 10.3 happening anytime soon. – reevesii Apr 6 '16 at 18:36
  • 1
    The mapservice responds to http requests sent to it from the script. In most of the samples you should see a url to a mapservice. Replace this with a url to your mapservice. – Kirk Kuykendall Apr 6 '16 at 20:44
  • Thank you for your help Kirk Kuykendall. It is still not clear how I would set up the map service so that it responds to my customized script. If I edit a sample script to include the url to my map service, I still need to know how to get the map service to be published based upon this script. As of now, the map service appears to be working from the content of the service definition file, rather than a manually created script. – reevesii Apr 7 '16 at 13:28
  • I'd just start with a sample like this, and replace the mapservice url in the javascript code with your mapservice url. developers.arcgis.com/javascript/sandbox/… – Kirk Kuykendall Apr 7 '16 at 15:19
  • Then what do I do with the javascript code containing my map service url? – reevesii Apr 7 '16 at 15:28
3

Kirk is right on the money, with the exception of one statement.

If your mapservice url is public, and you have an ArcGIS Online account, you can create an app without coding.

As long as you have access to the internet, it is possible to create webmaps and applications in ArcGIS Online that reference an instance of ArcGIS Server that is behind a firewall. The only thing that's saved to the cloud is a url which won't resolve for anyone outside your intranet.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.