ArcGIS API for JavaScript 4.3 uses the map service with ArcGIS Server

Source: Internet
Author: User

Objective

Many netizens asked me how to use the server published map services, in fact, very simple.

I declare here first: Do not provide the server software, need to use the Internet to search for resources on your own;

Does not explain how the server publishes various services, but I will give the official documents (point me), publishing services in fact, a lot of old tutorials.

"Software Preparation"

· Windows more than 64-bit system , XP can take a break, the server is 64-bit native software,//linux release can also, can use the server on the line

· ArcGIS for Server 10.x version

· ArcGIS for Desktop (used for publishing services)

If you have your own server, you can install Arcserver on the server side, but Arcserver has requirements for server performance, bandwidth, and storage, please refer to the official documentation yourself.

Of course, you can also install the server locally, using this institution to build B/s structure.

ArcGIS Desktop software is used to publish services, and data is prepared for itself.

A browser , recommended WebKit kernel Chrome, Firefox and so on.

An editor that can write Web front-end , I use Vscode.

The last two must be, the first three are not required, as long as the rest URL mentioned below can be AJS programming.

OK, class.

Say for a while did not write a blog, busy Ah, see School, review, all kinds of messy things, AJS notes did not follow, stuck in a spatial query example.

After you have installed ArcGIS for server in general, there is a sample service that goes to the Administration page:

Click on the "a" tab in the Purple box to enter the feature page for specific information about this service

Locate the rest URL and copy it down.

Now use AJS 4.3来 to build a basic Sceneview Web page with the following code:

<!DOCTYPE HTML><HTML><Head>  <MetaCharSet= "Utf-8">  <Metaname= "Viewport"content= "Initial-scale=1,maximum-scale=1,user-scalable=no">  <title>FeatureLayer-4.3</title>  <Linkrel= "stylesheet"href= "Https://js.arcgis.com/4.3/esri/css/main.css">  <Scriptsrc= "HTTPS://JS.ARCGIS.COM/4.3/"></Script>  <style>html, body, #viewDiv{padding:0;margin:0;Height:100%;width:100%;    }  </style>  <Script>require (["Esri/map",        "Esri/views/sceneview",        "Esri/layers/featurelayer",        "dojo/domready!"      ],      function(Map, Sceneview, Featurelayer) {varMap= NewMap ({basemap:"Hybrid"        }); varView= NewSceneview ({container:"Viewdiv", Map:map,}); varFeaturelayer= Newfeaturelayer ({URL:"Https://localhost:6443/arcgis/rest/services/SampleWorldCities/MapServer"        });      Map.add (Featurelayer);  }); </Script></Head><Body>  <DivID= "Viewdiv"></Div></Body></HTML>
AJS using the local map service

The most critical of these is:

var New featurelayer ({    URL:"Https://localhost:6443/arcgis/rest/services/SampleWorldCities/MapServer" });

The URL is just a copy of the REST url,rest URL is the composition of probably

"Https://IP Address: Port/user information (user group, user name, etc.)/rest/services/service Name/service Type/subkey"

Or

"https://domain name/same as later"

Running is:

Please note that the direct copy of my code is not able to run out of this effect, please use the available rest Url,ajs 4.X Sample code for some examples of the URL can be tested, please find yourself.

So how do you know which services correspond to which AJS classes?

In layer, the official display page is as follows:

Point Me

I directly list some of the commonly used good:

Problems come, in addition to MapServer, Featureserver and other services, there are many naserver, where can be used?

AJS services are limited, and the server itself is not used solely for AJS.

In the AJS network analysis example, you can use Naserver:

var New Routetask ({    "Https://route.arcgis.com/arcgis/rest/services/World/Route/NAServer/Route_World"} );

There are a lot of services can be found in the example of AJS, because AJS's notes have not been finished, I found one in the future to update one.

ArcGIS API for JavaScript 4.3 is linked to ArcGIS server using the map service

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.