proxy with story maps

5540
15
Jump to solution
07-05-2015 04:29 AM
roialgavish
New Contributor III

Hello,

I am working on the src code of the story maps tour, and I can't get to app to use my proxy in order to access a secured service. If I understand correctly I need to add my proxy to the maptour-config.js. and I did that but I stiil get the authentication screen.

Any ideas?

0 Kudos
1 Solution

Accepted Solutions
GregoryL_Azou
Occasional Contributor III

Hi,

You may have to explicitly tell the application to use the proxy for your service. You can do that by adding the following snippet at the end of index.html. See the following documentation for more detail Sharing maps with secure layers | Guide | ArcGIS API for JavaScript.

Note that the best workflow described in the following document allow you to not have to download and configure the application at all ArcGIS Server web services—ArcGIS Online Help | ArcGIS

require(["esri/urlUtils"], function(urlUtils) { 
  urlUtils.addProxyRule({
   urlPrefix: "my-arcgis-sever",
   proxyUrl: "my-web-server.com/proxy"
  });
});

View solution in original post

15 Replies
GregoryL_Azou
Occasional Contributor III

Hi,

You may have to explicitly tell the application to use the proxy for your service. You can do that by adding the following snippet at the end of index.html. See the following documentation for more detail Sharing maps with secure layers | Guide | ArcGIS API for JavaScript.

Note that the best workflow described in the following document allow you to not have to download and configure the application at all ArcGIS Server web services—ArcGIS Online Help | ArcGIS

require(["esri/urlUtils"], function(urlUtils) { 
  urlUtils.addProxyRule({
   urlPrefix: "my-arcgis-sever",
   proxyUrl: "my-web-server.com/proxy"
  });
});

roialgavish
New Contributor III

Thank you very much Gregory ,

I am working in a different way with the template, I am working with about 1000 json files that is deployed on my organization server instead of 1000 webmap's, and the app find the URL of that specific story and then go to the correct json file.

So I needed the code to work with the proxy, I didn’t understand where to put it and your answer was great, again thank you very much.

0 Kudos
GregoryL_Azou
Occasional Contributor III

Great, glad to hear. I would be curious to checkout what you come up with if it's a public website so feel free to share a link Thanks.

0 Kudos
roialgavish
New Contributor III

Hi,

The content is in Hebrew and it's not a public site. It is about risk management in hiking trails in Israel. But when I will finish I will create an English open example and publish it. I am new at this (I studied JS for this purpose), and if I understand I need to publish the code in GitHub as part of the open source agreement, but first thing is first (i still have allot of work).

Again thank you very much.

0 Kudos
roialgavish
New Contributor III

Hello,

I have encountered in another problem that I am not sure about, I am trying to use two operational layers for the template. One of them is of curse the tour point, and other is an ArcGISTiledMapServiceLayer.

For some reason I can get the tiled map service to be displayed. I can create an arcgis mapservice that drew the layer dynamically from the data to show on the app.

What I am asking is am doing something wrong? Or the app doesn't designed to work with ArcGISTiledMapServiceLayer as an operational layer?

The reason I want to use the TiledMapService is that I need to use special restriction of what to show and what not to show and I think the setExclusionAreas() of the ArcGISTiledMapServiceLayer is best for my needs.

Thanks Roi.

0 Kudos
GregoryL_Azou
Occasional Contributor III

Hi Roi,

You should not run into any issues when adding extra layer to your webmap, whatever their type. I have tested adding Tiled and Dynamic Service hosted in ArcGIS Online. Are you using Online or ArcGIS Server? If using ArcGIS Server, what version and can you reproduce in Online with dummy data?

setExclusionAreas seems really interesting, depending on your data you are also able to set a filter on a Feature Layer in the webmap. That filter is not about areas, it's on attributes only.

0 Kudos
roialgavish
New Contributor III

Hi Gregory,

I think I found out what was the problem, I am using different lods then the default, and I wasn't able to add the tiled service with the special lods , I am using this example to work with my lods:

https://developers.arcgis.com/javascript/jssamples/layers_custom_tiled.html

I manage to get it to work properly on a simple map. But for now I wasn’t able to add this layer like in the example to the story map.

0 Kudos
GregoryL_Azou
Occasional Contributor III

Hi Roi,

Great, yes your services lods have to match the lods of the basemap for them to display.

When you create your cache on the most recent version of Desktop/Pro/AGOL, it should use the correct preset of ArcGIS Online basemap and just let you select what level you want to generate.

Are you trying to add the layer through JavaScript code in Map Tour?

That would work but maybe more simple is that you add the layer in the webmap through Map Viewer and do an app.map.getLayer("").setExclusionsAreas(). I haven't tried but it should work

0 Kudos
roialgavish
New Contributor III

Gregory Hi,

It worked grate, I put the tiled map as my basemap in the json file, and I used a set of array's to exclude everything else but a specific extent as I was offered here:

(https://community.esri.com/message/533780?et=watches.email.thread#533780).

Thanks Allot.