Hello
I am wondering if I can use ArcGIS Online similar to ArcServer? I am trying to upload tiles to arc online then use them with the API (see below):
<script>
var map;
require(["esri/map", "esri/layers/ArcGISTiledMapServiceLayer("my URL?")", "dojo/domReady!"],
function(Map, Tiles) {
map = new Map("map", {basemap: "streets",
center: [-78.785706, -1.774008], // longitude, latitude
zoom: 7});
var tiles = new Tiles("https://tiles.arcgis.com/tiles/.../arcgis/rest/services/ECU_Tiles/MapServer");
map.addLayer(tiles);
}
);
</script>
I am not sure what the the ("my URL") would be using arcgis online... unless I can't in which case it would make more sense.
Any help and or suggestions are greatly appreciated!
-Chris
Solved! Go to Solution.
You will not need to specify a URL in the 'require' portion. It should just be
require(["esri/map", "esri/layers/ArcGISTiledMapServiceLayer", ...
See the following help link below:
tiledmapservicelayer-amd | API Reference | ArcGIS API for JavaScript
Yes, you can. ArcGIS Online is built on the JavaScript API.
Do you know what I use in the require as my URL or where to find that? I am very new to ArcGIS Online
require(["esri/map", "esri/layers/ArcGISTiledMapServiceLayer("my URL?")", "dojo/domReady!"],
Thanks!
-Chris
Hi Chris,
Yes, if you browse to the tiled service in ArcGIS Online, there will be a rest URL you can use..
is it the same URl I use here?
var tiles = new Tiles("https://tiles.arcgis.com/tiles/.../arcgis/rest/services/ECU_Tiles/MapServer");
You will not need to specify a URL in the 'require' portion. It should just be
require(["esri/map", "esri/layers/ArcGISTiledMapServiceLayer", ...
See the following help link below:
tiledmapservicelayer-amd | API Reference | ArcGIS API for JavaScript
I see... It's working now, thanks for the help!
This might be a silly question but if I don't make the tiles public it's behind a password that aren't my login credentials(arc onlin). Any thoughts on this?
-Chris
If you have the ability to make a service public or not in ArcGIS Online, you are usually the owner of the service. Therefore, your ArcGIS.com credentials should be the username/password that can be used.
That's what I would have thought, but it says username/password are incorrect (they are!). Maybe it has something to do with testing the HTML locally. Alright, well thanks again!
Cheers
Chris