Select to view content in your preferred language

Deploy App to AGOL

329
1
Jump to solution
08-16-2023 01:24 PM
Ed_
by MVP Regular Contributor
MVP Regular Contributor

Hello,

So I have recently started learning tutorials on creating maps using  ArcGIS Maps SDK for JavaScript. And right now I am on Display the Map tutorial.

How can I then let's deploy this app to AGOL for testing purposes?

Thank you,

Code:

 

<!--

To run this demo, you need to replace 'YOUR_API_KEY' with an API key from the ArcGIS Developers dashboard.

Sign up for a free account and get an API key.

https://developers.arcgis.com/documentation/mapping-apis-and-services/get-started/

-->

<html>
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no" />
    <title>ArcGIS Maps SDK for JavaScript Tutorials: Display a map</title>

    <style>
      html,
      body,
      #viewDiv {
        padding: 0;
        margin: 0;
        height: 100%;
        width: 100%;
      }
    </style>

    <link rel="stylesheet" href="https://js.arcgis.com/4.27/esri/themes/light/main.css">
    <script src="https://js.arcgis.com/4.27/"></script>

    <script>
      require(["esri/config", "esri/Map", "esri/views/MapView"], function(esriConfig, Map, MapView) {

        esriConfig.apiKey = "YOUR_API_KEY";

        const map = new Map({
          basemap: "arcgis-topographic" // Basemap layer service
        });

        const view = new MapView({
          map: map,
          center: [-118.805, 34.027], // Longitude, latitude
          zoom: 13, // Zoom level
          container: "viewDiv" // Div element
        });

      });
    </script>

  </head>
  <body>
    <div id="viewDiv"></div>
  </body>
</html>

 

 

Question | Analyze | Visualize
Tags (1)
0 Kudos
1 Solution

Accepted Solutions
LaurenBoyd
Esri Contributor

Hi @Ed_ -

ArcGIS Maps SDK for JavaScript applications cannot be hosted/deployed on ArcGIS Online. To share these applications, you would need a web server set up that is accessible to your end users so you could host the application.

CodePen is a great resource for testing which is what we recommend in the tutorials, but here's a general overview on different ways you could potentially publish your website: https://developer.mozilla.org/en-US/docs/Learn/Getting_started_with_the_web/Publishing_your_website 

Lauren

View solution in original post

1 Reply
LaurenBoyd
Esri Contributor

Hi @Ed_ -

ArcGIS Maps SDK for JavaScript applications cannot be hosted/deployed on ArcGIS Online. To share these applications, you would need a web server set up that is accessible to your end users so you could host the application.

CodePen is a great resource for testing which is what we recommend in the tutorials, but here's a general overview on different ways you could potentially publish your website: https://developer.mozilla.org/en-US/docs/Learn/Getting_started_with_the_web/Publishing_your_website 

Lauren