Select to view content in your preferred language

should i be connected to the internet when using "ArcGIS API for JavaScript" even if i am not using a CDN?

578
3
07-10-2017 07:31 AM
AhmadLibda
Occasional Contributor

should i be connected to the internet when using "ArcGIS API for JavaScript" even if i am not using a CDN?

I am developing a web application on the same machine as my Arcgis server on which I have published some layers. I downloaded the JavaScript API and referenced it locally (not CDN).

However, layers do not show up unless I am connected to the internet!

0 Kudos
3 Replies
ThomasSolow
Frequent Contributor

By default the JavaScript API uses a lot of resources from ArcGIS Online (AGOL), which requires an internet connection.

It's possible to host these resources yourself and totally eliminate any dependence on AGOL.  In my experience this is most often done via Portal + ArcGIS Server (Portal is essentially your own version of AGOL) but it should be doable to set this up just with server.

Anyway, the approach I would take is to use your browser's dev tools to see which requests your browser is trying to make.   The most likely candidates are requests for basemaps: by default, basemaps are pulled in from AGOL.  You'll have to host your own basemaps.  Portal provides a streamlined way to do this: you can tell the JS API to pull basemaps from Portal rather than AGOL (note: you'll still have to ensure that your Portal + Server installation is hosting some basemaps, a default Portal install still points to AGOL for basemaps).

A lot of other resources in the JS API point to AGOL by default as well, such as geocoding and the world elevation layers.

AhmadLibda
Occasional Contributor

but it should be doable to set this up just with server.

You mean "Arcgis server"?? How???

but if not,

what is this portal? could you please guide me on how to install it and use it to host the required resources and totally eliminate any dependence on AGOL?

0 Kudos
ThomasSolow
Frequent Contributor

Portal for ArcGIS | ArcGIS Enterprise 

I don't know the details of installation, but generally portal is used by organizations.

You can host tiled map services using arcmap/arcgis pro and ArcGIS Server: Tutorial: Creating a cached map service—Documentation | ArcGIS Enterprise 

I've never gone through this process myself, but I see no reason you couldn't create your own basemaps using arcmap and server and then consuming them in the JS API.

0 Kudos