POST
|
I updated to esri 4.3 and links open fine now. Thanks for looking.
... View more
05-23-2017
02:47 PM
|
0
|
0
|
353
|
POST
|
Hi, I'm using esri javascrip 4.0. I have map with some graphics that when clicked on, launches a popuptemplate. The content of this popup may contain 1 or more hyperlinks. Each hyperlink is supposed to launch a separate tab/window when clicked on. But at the moment, clicking on these links don't do anything. They are valid and can be launched with a middle click, or right-click -> open in the tab, etc. How do I make these links launch with a simple left click? Thanks,
... View more
05-23-2017
01:08 PM
|
0
|
1
|
723
|
POST
|
Hi guys, I have a map with multiple FeatureLayers and KMLLayers. Prior to adding the KMLLayers, I was able to edit/draw on the FeatureLayers using the simple tools provided. After adding KMLLayers, I'm still able to draw, but when I click on any graphic/feature, or right after drawing a new graphic, I get a "No information available" popup window. Here's a sample code I've taken from here: ArcGIS API for JavaScript Sandbox with a couple of lines added to add a KMLLayer. var map;
require([
"esri/map",
"esri/tasks/GeometryService",
"esri/layers/ArcGISTiledMapServiceLayer",
"esri/layers/FeatureLayer",
"esri/layers/KMLLayer",
"esri/Color",
"esri/symbols/SimpleMarkerSymbol",
"esri/symbols/SimpleLineSymbol",
"esri/dijit/editing/Editor",
"esri/dijit/editing/TemplatePicker",
"esri/config",
"dojo/i18n!esri/nls/jsapi",
"dojo/_base/array", "dojo/parser", "dojo/keys",
"dijit/layout/BorderContainer", "dijit/layout/ContentPane",
"dojo/domReady!"
], function(
Map, GeometryService,
ArcGISTiledMapServiceLayer, FeatureLayer, KMLLayer,
Color, SimpleMarkerSymbol, SimpleLineSymbol,
Editor, TemplatePicker,
esriConfig, jsapiBundle,
arrayUtils, parser, keys
) {
parser.parse();
// snapping is enabled for this sample - change the tooltip to reflect this
jsapiBundle.toolbars.draw.start = jsapiBundle.toolbars.draw.start + "<br>Press <b>ALT</b> to enable snapping";
// refer to "Using the Proxy Page" for more information: https://developers.arcgis.com/javascript/3/jshelp/ags_proxy.html
esriConfig.defaults.io.proxyUrl = "/proxy/";
//This service is for development and testing purposes only. We recommend that you create your own geometry service for use within your applications.
esriConfig.defaults.geometryService = new GeometryService("https://utility.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer");
map = new Map("map", {
basemap: "satellite",
center: [-96.541, 38.351],
zoom: 14,
slider: false
});
map.on("layers-add-result", initEditor);
//add boundaries and place names
var labels = new ArcGISTiledMapServiceLayer("https://server.arcgisonline.com/ArcGIS/rest/services/Reference/World_Boundaries_and_Places/MapServer");
map.addLayer(labels);
var responsePoints = new FeatureLayer("https://sampleserver6.arcgisonline.com/arcgis/rest/services/Wildfire/FeatureServer/0", {
mode: FeatureLayer.MODE_ONDEMAND,
outFields: ['*']
});
var responsePolys = new FeatureLayer("https://sampleserver6.arcgisonline.com/arcgis/rest/services/Wildfire/FeatureServer/2", {
mode: FeatureLayer.MODE_ONDEMAND,
outFields: ['*']
});
map.addLayers([responsePolys, responsePoints]);
var kmlUrl = 'http://dl.dropbox.com/u/2654618/kml/Wyoming.kml';
var kml = new esri.layers.KMLLayer(kmlUrl);
map.addLayer(kml);
function initEditor(evt) {
var templateLayers = arrayUtils.map(evt.layers, function(result){
return result.layer;
});
var templatePicker = new TemplatePicker({
featureLayers: [responsePolys, responsePoints],
grouping: true,
rows: "auto",
columns: 3
}, "templateDiv");
templatePicker.startup();
var layers = arrayUtils.map(evt.layers, function(result) {
return { featureLayer: result.layer };
});
var settings = {
map: map,
templatePicker: templatePicker,
layerInfos: layers,
toolbarVisible: true,
createOptions: {
polylineDrawTools:[ Editor.CREATE_TOOL_FREEHAND_POLYLINE ],
polygonDrawTools: [ Editor.CREATE_TOOL_FREEHAND_POLYGON,
Editor.CREATE_TOOL_CIRCLE,
Editor.CREATE_TOOL_TRIANGLE,
Editor.CREATE_TOOL_RECTANGLE
]
},
toolbarOptions: {
reshapeVisible: true
}
};
var params = { settings: settings };
var myEditor = new Editor(params, 'editorDiv');
//define snapping options
var symbol = new SimpleMarkerSymbol(
SimpleMarkerSymbol.STYLE_CROSS,
15,
new SimpleLineSymbol(
SimpleLineSymbol.STYLE_SOLID,
new Color([255, 0, 0, 0.5]),
5
),
null
);
map.enableSnapping({
snapPointSymbol: symbol,
tolerance: 20,
snapKey: keys.ALT
});
myEditor.startup();
}
}); I have bolded the new code. JSFiddle here: Edit fiddle - JSFiddle. In the JSFiddle example, for some reasons, the first drawn graphic will show the proper info window with a delete button, but any subsequent action to a new/existing graphic will only display a "No information available".
... View more
08-24-2016
04:00 PM
|
0
|
0
|
1066
|
POST
|
Yay! It IS that missing json mime type! I added it and the map works well now. Thank you so much!
... View more
05-18-2016
01:58 PM
|
0
|
0
|
2477
|
POST
|
Ah, sorry. I did copy the json file to my local drive and placed it in a folder called data. So that relative path does point to an existing file. I tried using the absolute path, and I got that cross domain error requiring some kind of proxy setup. Test.htm:337 Creating legend failed. Error: esri/config: esriConfig.request.proxyUrl is not set. If making a request to a CORS-enabled server, please push the domain into esriConfig.request.corsEnabledServers. at Error (native) at Object.e.getProxyUrl (https://js.arcgis.com/4.0/init.js:346:266) at l (https://js.arcgis.com/4.0/init.js:319:267) at u (https://js.arcgis.com/4.0/init.js:324:417) at y (https://js.arcgis.com/4.0/init.js:330:158) at https://js.arcgis.com/4.0/init.js:331:181 at e (https://js.arcgis.com/4.0/init.js:153:423) at then.c.then (https://js.arcgis.com/4.0/init.js:156:232) at a.extend.always (https://js.arcgis.com/4.0/init.js:158:512) at C (https://js.arcgis.com/4.0/init.js:331:163)
... View more
05-18-2016
01:40 PM
|
0
|
0
|
2477
|
POST
|
Hi guys, I copied this exact map (Create a FeatureLayer with client side graphics - 4.0 ) to my website and while it works on my localhost machine, it fails on the web server. On the server, the map loads, but none of the earthquake data is showing. The error I see in console is: Test.htm:337 Creating legend failed. SyntaxError: Unexpected token < at Object.parse (native) at c.json (https://js.arcgis.com/4.0/init.js:192:467) at g (https://js.arcgis.com/4.0/init.js:191:119) at k [as handleResponse] (https://js.arcgis.com/4.0/init.js:184:135) at XMLHttpRequest.p (https://js.arcgis.com/4.0/init.js:188:240)errback @ Test.htm:337f @ init.js:150p @ init.js:149reject.errback @ init.js:151f @ init.js:150p @ init.js:149reject.errback @ init.js:151f @ init.js:150p @ init.js:149reject.errback @ init.js:151f @ init.js:150p @ init.js:149reject.errback @ init.js:151(anonymous function) @ init.js:327e @ init.js:153f @ init.js:153l.reject @ init.js:156c @ init.js:154e @ init.js:154f @ init.js:153l.reject @ init.js:156c @ init.js:154e @ init.js:154f @ init.js:153l.reject @ init.js:156c @ init.js:154e @ init.js:154f @ init.js:153l.reject @ init.js:156c @ init.js:154e @ init.js:154f @ init.js:153l.reject @ init.js:156k @ init.js:184p @ init.js:188 I don't have any clue on how to debug this. Any help is appreciated, thanks. I'm also attaching a screenshot of the "suspected" area when I click on the last line of the error console. Edit: This example is run on a asp.net environment. I put the same test map on a PHP server and it works. Does this have something to do with file permissions?
... View more
05-18-2016
12:46 PM
|
0
|
7
|
7276
|
POST
|
It turns out, instead of catching layer-add-result event, I needed to catch update-end event. This is what I ended up with: map = new esri.Map("mapDiv", { center: [-118.30, 34.3], zoom: 8, basemap: "topo" }); on(map, "update-end", function(){ // update-end event will execute after the layer has been added to the map if(featureLayer.graphics.length >= 1) { // do your thing here } }) var featureLayer = new esri.layers.FeatureLayer("http://services.arcgis.com/v01gqwM5QqNysAwas/arcgis/rest/services/Project_boundaries_021616/FeatureServer/0",{ mode: esri.layers.FeatureLayer.MODE_ONDEMAND, outFields: ["*"], opacity: 1 }); featureLayer.setDefinitionExpression("SrvyDescID=\'' . htmlspecialchars($SDID) . '\'"); map.addLayer(featureLayer);
... View more
03-09-2016
05:44 PM
|
0
|
0
|
620
|
POST
|
New code: var map; require([ "esri/map", "esri/layers/FeatureLayer", "dojo/on", "dojo/domReady!" ], function( Map, FeatureLayer, on ) { map = new esri.Map("mapDiv", { basemap: "topo", center: [-116.73536, 33.033989], zoom: 9 }); on(map, "layer-add-result", function(){ console.log(featureLayer.graphics[0]) }) var featureLayer = new esri.layers.FeatureLayer("http://services.arcgis.com/v01gqaf3wM5ysAAi/arcgis/rest/services/Project_boundaries_021616/FeatureServer/0",{ mode: esri.layers.FeatureLayer.MODE_ONDEMAND, outFields: ["*"], opacity: 1 }); featureLayer.setDefinitionExpression("SrvyDescID=\'' . htmlspecialchars($SDID) . '\'"); map.addLayer(featureLayer); }); Console.log is still returning featureLayer.graphics[0] as undefined.
... View more
03-09-2016
01:50 PM
|
0
|
0
|
620
|
POST
|
this is my code: console.log(featureLayer.graphics); map.addLayer(featureLayer); console.log(featureLayer.graphics); Both output look the same. Do I need to do anything after the line map.addLayer(featureLayer)?
... View more
03-09-2016
01:23 PM
|
0
|
2
|
620
|
POST
|
I added a featureLayer.refresh(); line before printing it to console.log and nothing changes. featureLayer.setDefinitionExpression("SrvyDescID=\'' . htmlspecialchars($SDID) . '\'"); featureLayer.refresh(); console.log(featureLayer.graphics); console.log(featureLayer.graphics[0]); map.addLayer(featureLayer);
... View more
03-09-2016
01:13 PM
|
0
|
4
|
620
|
POST
|
Hi guys, I'm working on a map that uses FeatureLayer.Mode_ONDEMAND. To see certain layer, I pass in a project ID using featureLayer.setDefinitionExpression. Where such layer exists, I see it. What I want to know is how to detect when no layer exists. I want to print an alert to the viewer instead of showing just a blank map. Here's my code: function init() { map = new esri.Map("mapDiv", { basemap: "topo", center: [-116.73536, 33.033989], zoom: 9 }); var featureLayer = new esri.layers.FeatureLayer("http://services.arcgis.com/v01gqwM5QqNysAAi/arcgis/rest/services/Project_boundaries_021616/FeatureServer/0",{ mode: esri.layers.FeatureLayer.MODE_ONDEMAND, outFields: ["*"], opacity: 1 }); featureLayer.setDefinitionExpression("SrvyDescID=\'' . htmlspecialchars($ProjectID) . '\'"); console.log(featureLayer.graphics); console.log(featureLayer.graphics[0]); map.addLayer(featureLayer); } What I learned is when the project is valid, feature.graphics will return an array. But I'm unable to treat it like an array. For example, featureLayer.graphic[0] returns "undefined". featureLayer.graphic.length also doesn't work. And yet, my console.log does return an object. How do I detect this object? Attached is a screenshot of the console log. Thanks for your help.
... View more
03-09-2016
12:31 PM
|
0
|
7
|
2517
|
POST
|
With many layers, the load time is really long when viewed through a web app viewer. If I use this example to generate a map, and have the list of layers unchecked by default, will it minimize load time? I'm trying to figure out if dynamicamapservicelayer preloads all the layers, or it only fetches a layer when checked using layer.setVisibleLayers(visible); Thanks for looking.
... View more
08-12-2015
05:19 PM
|
0
|
1
|
2658
|
POST
|
My webpage contains an iframe that holds an arcgis map web viewer. This map contains multiple layers, that when clicked on, displays a popup and a link. This link contains parameters that I need to capture. Currently, when I click on this link, it opens up a new window. Is there away I can capture it within the parent's window? Can this be done asynchronously, without having to reload the entire page/map?
... View more
02-09-2015
11:39 AM
|
0
|
0
|
3786
|
POST
|
you can't add shapefiles. Otherwise few would pay for Server. You have to either publish the data, or publish it on arcgis.com with an account and then consume the webmap in your application. Hi Jeff, I'm not understanding you entirely because I'm very new at this. Sorry in advance. By publish it on arcgis.com. Do you mean create a webmap (http://www.arcgis.com/home/webmap/viewer.html) upload the shapefile, then embed it in my website?
... View more
11-25-2013
08:33 AM
|
0
|
0
|
404
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:24 AM
|