|
POST
|
In this case, the app that would consume the service isn't something that lives in Portal, it's just a regular JavaScript web application (using v4 of the ArcGIS JSAPI) that would be referencing the routing service endpoint, using the Proxy for authentication. I guess where there is some confusion, when I developed an AGOL geocoder app, listed specifically as an "Application" in AGOL, a ClientID and AppSecret are viewable on the settings page, so I can use them to obtain a token, like so: https://www.arcgis.com/sharing/oauth2/token?client_id=MyClientID&grant_type=client_credentials&client_secret=myClientSecret&f=pjson https://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer/findAddressCandidates?forStorage=true&locationType=rooftop&maxLocations=1&outfields=*&f=pjson&sourcecountry=usa&singleLine=123 Main St, Any Town, Any State, USA&token=tokenObtainedFromOauth2InTheFirstLink.. What I need to do is consume the routing service without requiring authentication/log-in from our users. This would take place via the proxy, which should get a token using clientID and appSecret supplied in the proxy config for this endpoint. Do I need to configure the tool differently in Portal?
... View more
03-01-2019
09:20 AM
|
0
|
3
|
3957
|
|
POST
|
Apologies if I used the incorrect terminology - the routing service was published, as a routing service, to ArcGIS Enterprise before Portal was installed and configured. I was able to secure the service and consume within a JSAPI application using the Proxy config - GitHub - Esri/resource-proxy: Proxy files for DotNet, Java and PHP. with username/password credentials. Now that Portal is installed, it is listed as a Network Analysis tool. This tool, I cannot register using https://myserver/portal/sharing/rest/oauth2/registerApp with the ClientID provided by Portal. This, I need, to obtain clientSecret so that I can authenticate using oauth2 via the Esri Proxy.
... View more
03-01-2019
08:43 AM
|
0
|
5
|
3957
|
|
POST
|
Hey guys, I recently installed Portal on-top of our DEV instance of ArcGIS Enterprise. This is my first experience with Portal/ArcGIS Online outside of setting-up some geocoding services in AGOL. We are using Enterprise/Portal 10.6.1. When I attempt to register a routing service using REST, I receive the following response/error: {"error": {
"code": 400,
"message": "Registration of this item is not allowed",
"details": []
}}
I triple-confirmed the ClientID as reported by Portal. A "register app" button is not present on the Content Details page of Portal for the service. Any ideas? I saw there was a bug for "missing button" in 10.4 - Bug: Register option is not available on the Item Details page for apps in the Portal for ArcGIS home application - however, in my case, I am neither using 10.4, nor am I successful in using the REST interface. Thanks!
... View more
03-01-2019
07:07 AM
|
0
|
8
|
4633
|
|
POST
|
Just a heads-up - I am having this same issue, too.
... View more
02-25-2019
10:28 AM
|
0
|
0
|
2884
|
|
POST
|
Robert, I was unable to find the original test JSON for this sample, so I went ahead and created a new file (see attached - fallback-gas-price-data.json.zip). It looks like the sample simply had "state" and "regular" as fields and used state name as the pk. Thanks!
... View more
10-31-2018
11:30 AM
|
1
|
1
|
1934
|
|
POST
|
Thanks, Robert! I'm checking now, but it's possible I no longer have the failover file - it's been so long. I will look into replicating with some test data, if that is the case.
... View more
10-31-2018
07:38 AM
|
0
|
3
|
1934
|
|
POST
|
Years ago, there was a sample to visualize dynamic JSON by "joining" to a static FeatureLayer "template" by a shared pk (state, in this case). It is no longer available as the data source went offline, but here's the sample code to give you an idea of what it was doing: <!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no">
<title></title>
<link rel="stylesheet" href="http://js.arcgis.com/3.11/esri/css/esri.css">
<link rel="stylesheet" href="css/styles.css">
<script>var dojoConfig = {
packages: [{
name: "extras",
location: location.pathname.replace(/\/[^/]+$/, "") + "/extras"
}]
};
</script>
<script src="http://js.arcgis.com/3.11/"></script>
<script>
require([
"dojo/parser",
"dojo/json",
"dojo/_base/array",
"dojo/_base/connect",
"esri/Color",
"dojo/number",
"dojo/dom-construct",
"esri/map",
"esri/geometry/Extent",
"esri/symbols/SimpleLineSymbol",
"esri/symbols/SimpleFillSymbol",
"esri/renderers/SimpleRenderer",
"esri/renderers/ClassBreaksRenderer",
"esri/layers/FeatureLayer",
"esri/dijit/Legend",
"esri/request",
"extras/Tip",
"dijit/layout/BorderContainer",
"dijit/layout/ContentPane",
"dojo/domReady!"
], function(
parser, JSON, arr, conn, Color, number, domConstruct,
Map, Extent, SimpleLineSymbol, SimpleFillSymbol, SimpleRenderer, ClassBreaksRenderer,
FeatureLayer, Legend, esriRequest, Tip) {
// call the parser to create the dijit layout dijits
parser.parse();
var bounds = new Extent({"xmin":-2332499,"ymin":-1530060,"xmax":2252197,"ymax":1856904,"spatialReference":{"wkid":102003}});
window.map = new Map("map", {
extent: bounds,
lods: [{"level":0, "resolution": 3966, "scale": 15000000}],
slider: false
});
window.fl = new FeatureLayer("http://sampleserver6.arcgisonline.com/arcgis/rest/services/Census/MapServer/3", {
maxAllowableOffset: window.map.extent.getWidth() / window.map.width,
mode: FeatureLayer.MODE_SNAPSHOT,
outFields: ["STATE_NAME"],
visible: true
});
// override default renderer so that states aren't drawn
// until the gas price data has been loaded and is joined
fl.setRenderer(new SimpleRenderer(null));
var template = "<strong>${STATE_NAME}: $${GAS_DISPLAY}</strong>";
window.tip = new Tip({
"format": template,
"node": "legend"
});
var updateEnd = fl.on("update-end", function() {
// get gas price data
// using apify: http://apify.heroku.com/resources
// edit the apify thing: http://apify.heroku.com/resources/53b34e28d804760002000023/edit
updateEnd.remove();
var prices = esriRequest({
// url: "http://apify.heroku.com/api/aaagasprices.json",
// Alternatively, fallback to a local file, use this if APIfy is unavailable.
url: "fallback-gas-price-data.json",
callbackParamName: "callback"
});
prices.then(drawFeatureLayer, pricesError);
// wire up the tip
fl.on("mouse-over", window.tip.showInfo);
fl.on("mouse-out", window.tip.hideInfo);
});
window.map.addLayer(fl);
function drawFeatureLayer(data) {
// If data comes back as text (which it does when coming from apify), parse it.
var gas = (typeof data === "string" ) ? JSON.parse(data) : data;
console.log("join prices, number of graphics: ", fl.graphics.length);
// loop through gas price data, find min/max and populate an object
// to keep track of the price of regular in each state
window.statePrices = {};
var gasMin = Infinity;
var gasMax = -Infinity;
arr.forEach(gas, function(g) {
if ( g.state !== "State" ) {
var price = parseFloat(parseFloat(g.regular.replace("$", "")).toFixed(2));
statePrices[g.state] = price;
if ( price < gasMin ) {
gasMin = price;
}
if ( price > gasMax ) {
gasMax = price;
}
}
});
// format max gas price with two decimal places
gasMax = formatDollars(gasMax);
// add an attribute to each attribute so gas price is displayed
// on mouse over below the legend
arr.forEach(fl.graphics, function(g) {
var displayValue = statePrices[g.attributes.STATE_NAME].toFixed(2);
g.attributes.GAS_DISPLAY = displayValue;
});
// create a class breaks renderer
var breaks = calcBreaks(gasMin, gasMax, 4);
// console.log("gas price breaks: ", breaks);
var SFS = SimpleFillSymbol;
var SLS = SimpleLineSymbol;
var outline = new SLS("solid", new Color("#444"), 1);
var br = new ClassBreaksRenderer(null, findGasPrice);
br.setMaxInclusive(true);
br.addBreak(breaks[0], breaks[1], new SFS("solid", outline, new Color([255, 255, 178, 0.75])));
br.addBreak(breaks[1], breaks[2], new SFS("solid", outline, new Color([254, 204, 92, 0.75])));
br.addBreak(breaks[2], breaks[3], new SFS("solid", outline, new Color([253, 141, 60, 0.75])));
br.addBreak(breaks[3], gasMax, new SFS("solid", outline, new Color([227, 26, 28, 0.75])));
fl.setRenderer(br);
fl.redraw();
var legend = new Legend({
map: window.map,
layerInfos: [{ "layer": fl, "title": "Regular Gas" }]
},"legend");
legend.startup();
// remove the loading div
domConstruct.destroy("loading");
}
// function used by the class breaks renderer to get the
// value used to symbolize each state
function findGasPrice(graphic) {
var state = graphic.attributes.STATE_NAME;
return statePrices[state];
}
function calcBreaks(min, max, numberOfClasses) {
var range = (max - min) / numberOfClasses;
var breakValues = [];
for ( var i = 0; i < numberOfClasses; i++ ) {
breakValues[i] = formatDollars(min + ( range * i ));
}
// console.log("break values: ", breakValues);
return breakValues;
}
function formatDollars(num) {
return number.format(num, { "places": 2 });
}
function pricesError(e) {
console.log("error getting gas price data: ", e);
}
}
);
</script>
</head>
<body>
<div id="loading" class="shadow loading">
Getting Latest Gas Price Data...
<img src="http://dl.dropbox.com/u/2654618/loading_gray_circle.gif">
</div>
<div id="legend" class="shadow info"></div>
<div data-dojo-type="dijit.layout.BorderContainer"
data-dojo-props="design:'headline',gutters:false"
style="width: 100%; height: 100%; margin: 0;">
<div id="map"
data-dojo-type="dijit.layout.ContentPane"
data-dojo-props="region:'center'">
<div id="title" class="shadow info">Current Gas Prices by State</div>
</div>
</div>
</body>
</html>
Back in 2014, we ran with this idea for our application in v3 since our maps were a tertiary consideration for a mature product, and it was the easiest way to add choropleths within an existing framework... we simply formatted the data returned by a SQL stored procedure as JSON and "joined" it to a static "template" FeatureLayer map service on the front end, manually calculating breaks along the way (we found a nice JS stats library for this), setting tooltips, etc. Revisiting this in v4, we'd like to do something similar to Visualize data with class breaks | ArcGIS API for JavaScript 4.9 - what's the best way to accomplish this? I don't see any specific samples regarding JSON... it seems most samples either have the data in the map service, or join to tables in the workspace. This, unfortunately, is not an option for us. Thanks!
... View more
10-30-2018
09:31 AM
|
0
|
5
|
2197
|
|
POST
|
Found it! I'm not sure what was going on earlier with the console errors... they were red herrings, along with the IE security issues loading from file. All of the console errors appear to have disappeared, so it looks like after the jump from v4.5 to 4.6+, the child div of the map container, with class "esri-view-root" no longer inherits dimensions, specifically, height, so it simply doesn't render:
... View more
09-18-2018
12:55 PM
|
0
|
0
|
1920
|
|
POST
|
The issue was discovered in the app on a dev enviro and on localhost over IIS. When I was creating a test app for reproduction on Geonet, I was just loading it from file. Just a heads-up, I stopped testing from file and created a small test harness within the application. I find it works if I go back to API v4.5, but not in v4.6+... I'm going to check out release notes to see if anything jumps out at me. ... So, nothing really looked suspicious, at least for the test harness. I dug in a bit more and tried catching all exceptions. There's nothing really different between 4.5 and 4.8 with regards to that. I can see the XHR requests for the background map tiles coming back with CORS for both versions, only in 4.8, nothing is rendered... and there are no errors in console with the test harness for either version.
... View more
09-18-2018
11:39 AM
|
0
|
0
|
1920
|
|
POST
|
Kelly, That was a mistake on my part whittling the app down to the minimum code required to repro. It’s not set-up this way in the actual application. I’m wondering if there is a corporate security policy for IE on our end that is causing the issue since this is dealing with communication/messaging events. I tried IE11 in Windows 10 on another machine... first, I was prompted: "Internet Explorer restricted this webpage from running scripts or ActiveX controls" After allowing, the issue manifested; however, some new console warnings showed. The only message that showed on my other environment was related to actual error. The new warnings are in relation to some Esri web workers: ADDENDUM: I might have to re-approach this... although I am receiving the same error over localhost and deployed to a dev server, the repro code above doesn't throw any errors in IE when hosted in IIS...
... View more
09-18-2018
06:44 AM
|
0
|
2
|
1920
|
|
POST
|
Hello all, Is there a known issue with IE 11 and v4 of the JSAPI? Specifically, I stripped everything out of my application and found there is an issue with MapView, for IE, but not Chrome: <!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no">
<title>IE Issue</title>
<style>
html,
body,
.embeddedMaps {
padding: 0;
margin: 0;
height: 100%;
width: 100%;
}
</style>
<link rel="stylesheet" href="https://js.arcgis.com/4.8/esri/css/main.css">
<script src="https://js.arcgis.com/4.8/"></script>
<script>
require([
"esri/Map",
"esri/views/MapView",
"dojo/domReady!"
], function (Map,
MapView
) {
const map = new Map({
basemap: "gray-vector"
});
const view = new MapView({
container: "myMapContainer",
map: map,
zoom: 9,
center: [-82.457, 27.95]
});
});
</script>
</head>
<body>
<div class="embeddedMaps" ID="myMapContainer"/>
</body>
</html> IE is reporting the issue in MapView.js on line 806: SCRIPT445: Object doesn't support this action ...
g(function () {
d.dispatchEvent(new MessageEvent("message", { //error here...
data : b
}))
})
... It seems it's choking on MessageEvent(), but according to MessageEvent - Web APIs | MDN - it is supported. Any ideas? This is a big deal for us as IE support is REQUIRED for our app, unfortunately. This IS working in Edge, it appears. Thanks!
... View more
09-17-2018
01:30 PM
|
1
|
5
|
3198
|
|
POST
|
Thanks, I'll check into reporting as a bug. It's definitely a nice-to-have, and it seems like it should work per the documentation.
... View more
08-23-2018
06:35 AM
|
1
|
0
|
921
|
|
POST
|
Is this a bug in v4.8? I am unable to render a halo/mask around a text symbol using v4.8 of the JSAPI (in Chrome, IE, and FF). Here's the jsbin - JS Bin - Halo ...and the code demonstrating the issue <!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no">
<title>Halo</title>
<link rel="stylesheet" href="https://js.arcgis.com/4.8/esri/css/main.css">
<script src="https://js.arcgis.com/4.8/"></script>
<style>
html,
body,
#viewDiv {
padding: 0;
margin: 0;
height: 100%;
width: 100%;
}
</style>
<script>
require([
"esri/Map",
"esri/views/MapView",
"esri/Graphic",
"esri/geometry/Point",
"dojo/domReady!"
], function(
Map,
MapView,
Graphic,
Point
) {
var map = new Map({
basemap: "gray"
});
var view = new MapView({
center: [-82.4572, 27.9506],
container: "viewDiv",
map: map,
zoom: 12
});
var point = new Point({
longitude: -82.4572,
latitude: 27.9506
});
var textSymbol = {
type: "text",
color: "#000000",
haloColor: "#008000",
haloSize: "6px",
text: "HELLO",
xoffset: -12,
yoffset: 2,
font: {
size: 12,
family: "calibri",
weight: "bold"
}
};
var pointGraphic = new Graphic({
geometry: point,
symbol: textSymbol
});
view.graphics.add(pointGraphic);
});
</script>
</head>
<body>
<div id="viewDiv"></div>
</body> This should work per the documentation - TextSymbol | API Reference | ArcGIS API for JavaScript 4.8
... View more
08-21-2018
12:02 PM
|
0
|
3
|
1087
|
|
POST
|
Great! You'd think that would have been available much sooner as a core function...
... View more
08-17-2018
01:16 PM
|
0
|
1
|
2272
|
|
POST
|
I kinda figured that would be the answer after re-reading the thread. It wasn't abundantly clear in the known limitations section of the example. Thank you.
... View more
08-17-2018
01:10 PM
|
0
|
3
|
2272
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 06-16-2020 01:25 PM | |
| 1 | 03-20-2019 09:07 AM | |
| 2 | 07-31-2015 07:31 AM | |
| 1 | 09-14-2015 12:14 PM | |
| 1 | 05-12-2015 12:04 PM |
| Online Status |
Offline
|
| Date Last Visited |
07-27-2023
02:30 AM
|