IDEA
|
Currently this is supported in ArcGIS Online. Publish layers from files on Microsoft OneDrive, Dropbox, and Google Drive Please add this capability to ArcGIS Enterprise.
... View more
11-15-2018
12:30 PM
|
4
|
0
|
389
|
POST
|
Here is a solution that works. <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no"> <title>Labeling features client-side</title> <link rel="stylesheet" href="https://community.esri.com//js.arcgis.com/3.16/esri/css/esri.css"> <style> html, body, #map { height: 100%; width: 100%; margin: 0; padding: 0; } #btnOff{ top:40px; right:60px; position: absolute; z-index:100; } #btnOn{ top:70px; right:60px; position: absolute; z-index:100; } </style> <script src="//js.arcgis.com/3.16/"></script> <script> var map; require([ "esri/map", "esri/geometry/Extent", "esri/layers/FeatureLayer", "esri/symbols/SimpleLineSymbol", "esri/symbols/SimpleFillSymbol", "esri/symbols/TextSymbol", "esri/renderers/SimpleRenderer", "esri/layers/LabelClass", "esri/Color", "dojo/dom", "dojo/on", "dojo/domReady!" ], function(Map, Extent, FeatureLayer, SimpleLineSymbol, SimpleFillSymbol, TextSymbol, SimpleRenderer, LabelClass, Color, dom, on) { // load the map centered on the United States var bbox = new Extent({"xmin": -1940058, "ymin": -814715, "xmax": 1683105, "ymax": 1446096, "spatialReference": {"wkid": 102003}}); //create the map and set the extent, making sure to "showLabels" map = new Map("map", { extent: bbox, showLabels : true //very important that this must be set to true! }); // create a renderer for the states layer to override default symbology var statesColor = new Color("#666"); var statesLine = new SimpleLineSymbol("solid", statesColor, 1.5); var statesSymbol = new SimpleFillSymbol("solid", statesLine, null); var statesRenderer = new SimpleRenderer(statesSymbol); // create the feature layer to render and label var statesUrl = "https://sampleserver6.arcgisonline.com/arcgis/rest/services/Census/MapServer/3"; var states = new FeatureLayer(statesUrl, { id: "states", outFields: ["*"] }); states.setRenderer(statesRenderer); // create a text symbol to define the style of labels var statesLabel = new TextSymbol().setColor(statesColor); statesLabel.font.setSize("14pt"); statesLabel.font.setFamily("arial"); //this is the very least of what should be set within the JSON var json = { "labelExpressionInfo": {"value": "{STATE_NAME}"} }; //create instance of LabelClass (note: multiple LabelClasses can be passed in as an array) var labelClass = new LabelClass(json); labelClass.symbol = statesLabel; // symbol also can be set in LabelClass' json states.setLabelingInfo([ labelClass ]); map.addLayer(states); function labelsOff() { var json = { "labelExpressionInfo": {"value": "{}"} }; //create instance of LabelClass (note: multiple LabelClasses can be passed in as an array) var labelClass = new LabelClass(json); labelClass.symbol = statesLabel; // symbol also can be set in LabelClass' json states.setLabelingInfo([ labelClass ]); map.addLayer(states); } function labelsOn() { var json = { "labelExpressionInfo": {"value": "{STATE_NAME}"} }; //create instance of LabelClass (note: multiple LabelClasses can be passed in as an array) var labelClass = new LabelClass(json); labelClass.symbol = statesLabel; // symbol also can be set in LabelClass' json states.setLabelingInfo([ labelClass ]); map.addLayer(states); } on(dom.byId("btnOff"), "click", function(){ labelsOff(); }); on(dom.byId("btnOn"), "click", function(){ labelsOn(); }); }); </script> </head> <body> <div id="map"></div> <input type="button" id="btnOff" value="Labels Off" /> <input type="button" id="btnOn" value="Labels On" /> </body> </html>
... View more
06-03-2016
10:20 PM
|
1
|
2
|
419
|
POST
|
I added a labelsOff function to the following "labeling features client-site" sample. In the console I get an error saying cannot find variable "labelsOff" which is the name of the function. What am I missing? Thanks. <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no"> <title>Labeling features client-side</title> <link rel="stylesheet" href="https://community.esri.com//js.arcgis.com/3.16/esri/css/esri.css"> <style> html, body, #map { height: 100%; width: 100%; margin: 0; padding: 0; } #btn{ top:20px; right:20px; position: absolute; z-index:100; } </style> <script src="//js.arcgis.com/3.16/"></script> <script> var map; require([ "esri/map", "esri/geometry/Extent", "esri/layers/FeatureLayer", "esri/symbols/SimpleLineSymbol", "esri/symbols/SimpleFillSymbol", "esri/symbols/TextSymbol", "esri/renderers/SimpleRenderer", "esri/layers/LabelClass", "esri/Color", "dojo/domReady!" ], function(Map, Extent, FeatureLayer, SimpleLineSymbol, SimpleFillSymbol, TextSymbol, SimpleRenderer, LabelClass, Color) { // load the map centered on the United States var bbox = new Extent({"xmin": -1940058, "ymin": -814715, "xmax": 1683105, "ymax": 1446096, "spatialReference": {"wkid": 102003}}); //create the map and set the extent, making sure to "showLabels" map = new Map("map", { extent: bbox, showLabels : true //very important that this must be set to true! }); // create a renderer for the states layer to override default symbology var statesColor = new Color("#666"); var statesLine = new SimpleLineSymbol("solid", statesColor, 1.5); var statesSymbol = new SimpleFillSymbol("solid", statesLine, null); var statesRenderer = new SimpleRenderer(statesSymbol); // create the feature layer to render and label var statesUrl = "https://sampleserver6.arcgisonline.com/arcgis/rest/services/Census/MapServer/3"; var states = new FeatureLayer(statesUrl, { id: "states", outFields: ["*"] }); states.setRenderer(statesRenderer); // create a text symbol to define the style of labels var statesLabel = new TextSymbol().setColor(statesColor); statesLabel.font.setSize("14pt"); statesLabel.font.setFamily("arial"); //this is the very least of what should be set within the JSON var json = { "labelExpressionInfo": {"value": "{STATE_NAME}"} }; //create instance of LabelClass (note: multiple LabelClasses can be passed in as an array) var labelClass = new LabelClass(json); labelClass.symbol = statesLabel; // symbol also can be set in LabelClass' json states.setLabelingInfo([ labelClass ]); map.addLayer(states); function labelsOff() { var optionsArray = []; var drawingOptions = new esri.layers.LayerDrawingOptions(); drawingOptions.showLabels = false; //drawingOptions.renderer = renderer; optionsArray[0] = drawingOptions; states.setLayerDrawingOptions(optionsArray); map.addLayer(states); } }); </script> </head> <body> <div id="map"></div> <input type="button" id="btn" value="Labels Off" onClick="labelsOff()"/> </body> </html> <!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no">
<title>Labeling features client-side</title>
<link rel="stylesheet" href="https://community.esri.com//js.arcgis.com/3.16/esri/css/esri.css">
<style>
html, body, #map {
height: 100%; width: 100%; margin: 0; padding: 0;
}
#btn{
top:20px; right:20px; position: absolute; z-index:100;
}
</style>
<script src="//js.arcgis.com/3.16/"></script>
<script>
var map;
require([
"esri/map",
"esri/geometry/Extent",
"esri/layers/FeatureLayer",
"esri/symbols/SimpleLineSymbol",
"esri/symbols/SimpleFillSymbol",
"esri/symbols/TextSymbol",
"esri/renderers/SimpleRenderer",
"esri/layers/LabelClass",
"esri/Color",
"dojo/domReady!"
], function(Map, Extent, FeatureLayer,
SimpleLineSymbol, SimpleFillSymbol,
TextSymbol, SimpleRenderer, LabelClass, Color)
{
// load the map centered on the United States
var bbox = new Extent({"xmin": -1940058, "ymin": -814715, "xmax": 1683105, "ymax": 1446096, "spatialReference": {"wkid": 102003}});
//create the map and set the extent, making sure to "showLabels"
map = new Map("map", {
extent: bbox,
showLabels : true //very important that this must be set to true!
});
// create a renderer for the states layer to override default symbology
var statesColor = new Color("#666");
var statesLine = new SimpleLineSymbol("solid", statesColor, 1.5);
var statesSymbol = new SimpleFillSymbol("solid", statesLine, null);
var statesRenderer = new SimpleRenderer(statesSymbol);
// create the feature layer to render and label
var statesUrl = "https://sampleserver6.arcgisonline.com/arcgis/rest/services/Census/MapServer/3";
var states = new FeatureLayer(statesUrl, {
id: "states",
outFields: ["*"]
});
states.setRenderer(statesRenderer);
// create a text symbol to define the style of labels
var statesLabel = new TextSymbol().setColor(statesColor);
statesLabel.font.setSize("14pt");
statesLabel.font.setFamily("arial");
//this is the very least of what should be set within the JSON
var json = {
"labelExpressionInfo": {"value": "{STATE_NAME}"}
};
//create instance of LabelClass (note: multiple LabelClasses can be passed in as an array)
var labelClass = new LabelClass(json);
labelClass.symbol = statesLabel; // symbol also can be set in LabelClass' json
states.setLabelingInfo([ labelClass ]);
map.addLayer(states);
function labelsOff() {
var optionsArray = [];
var drawingOptions = new esri.layers.LayerDrawingOptions();
drawingOptions.showLabels = false;
//drawingOptions.renderer = renderer;
optionsArray[0] = drawingOptions;
states.setLayerDrawingOptions(optionsArray);
map.addLayer(states);
}
});
</script>
</head>
<body>
<div id="map"></div>
<input type="button" id="btn" value="Labels Off" onClick="labelsOff()"/>
</body>
</html>
... View more
06-03-2016
06:14 PM
|
0
|
3
|
3164
|
POST
|
Finally solved this problem by changing the feature service rest endpoint url to the web adaptor Url. Http over 6080 was the problem. Working great now!
... View more
12-31-2015
07:31 AM
|
0
|
0
|
683
|
POST
|
Not sure how to check the JSON response, unless you are referring to the response in the console. The message in the console is "syntax error" with no error code. [object Error]{description: "Syntax error", log: undefined, message: "Syntax error", name: "SyntaxError", number: -2146827286} I have successfully tested deletes and attribute updates at rest endpoint. Is there a way I can test a simple delete from the javascript application? I have a feeling that the proxy is the cause. Thanks.
... View more
12-30-2015
04:34 PM
|
0
|
1
|
683
|
POST
|
Move and edit vertices | ArcGIS API for JavaScript and Editor widget | ArcGIS API for JavaScript I setup and tested the proxy.ashx page which appears to be working. The only error I am seeing (in the console) on creating features is a syntax error but with no error code. It appears that edits are being made to the database since I can move features (polygons) and update attributes, but as soon as I pan the map or refresh the page, the changes disappear. database: oracle AGS: 10.2 JSAPI: 3.15 Data is published with schema owner connection and feature service (Feature Access) selected with options checked to add, update, delete, etc. Thanks. Will
... View more
12-30-2015
07:08 AM
|
1
|
3
|
683
|
POST
|
I am having some problems using the JS Editing samples. Features geometry changes are not being saved. After a page refresh the feature changes revert to the original size, location, etc. Thanks. -Will
... View more
12-29-2015
08:04 PM
|
1
|
6
|
2980
|
POST
|
I would like to snap 2 anchor points to a line in order to model the movement of an airplane (polygon) along a taxiway centerline. Is this possible or anyone have a workaround? Thanks. Will
... View more
10-02-2015
05:19 PM
|
0
|
1
|
3207
|
POST
|
I was able to get this to work by adding "return" before declare on line 4. define( ["dojo/_base/declare", "dojo/_base/lang", "esri/request"], function (declare, lang, esriRequest) { return declare(null, Without return I was seeing the same "not a constructor" error mentioned in the original post. It would be great if the Tutorial files were made available in the Samples or on GitHub. Thanks.
... View more
09-09-2015
01:09 AM
|
0
|
0
|
388
|
POST
|
define( ["dojo/_base/declare", "dojo/_base/lang", "esri/request"], function (declare, lang, esriRequest) { declare(null, { distance: null, lastSearchResult: null, perPage: null, queryParams: null, seatGeekUrl: null, constructor: function (options) { // specify class defaults this.distance = options.distance || "20mi"; // default seat geek range is 30mi this.perPage = options.perPageage || 50; // default to 50 results per page this.seatGeekUrl = "http://api.seatgeek.com/2/events"; // returnEvents is called by an external function, esri.request // hitch() is used to provide the proper context so that returnEvents // will have access to the instance of this class this.returnEvents = lang.hitch(this, this.returnEvents); }, searchByLoc: function (geopoint) { var eventsResponse; this.queryParams = { "lat": geopoint.y, "lon": geopoint.x, "page": 1, "per_page": this.perPage, "range": this.distance } // seat geek endpoints: // petco park search using lat, lon: // http://api.seatgeek.com/2/events?lat=32.7078&lon=-117.157&range=20mi&callback=c // lat, lon for petco park: 32.7078, -117.157 eventsResponse = esriRequest({ "url": this.seatGeekUrl, "callbackParamName": "callback", "content": this.queryParams }); return eventsResponse.then(this.returnEvents, this.err); }, getMore: function() { var eventsResponse; // increment the page number this.queryParams.page++; eventsResponse = esri.request({ "url": this.seatGeekUrl, "callbackParamName": "callback", "content": this.queryParams }); return eventsResponse.then(this.returnEvents, this.err); }, returnEvents: function(response) { // check number of results if ( response.meta.total == 0) { // console.log("Seat Geek returned zero events: ", response); return null; } // save search result this.lastSearchResult = response; // console.log("set last search result: ", response, this); return response; }, err: function(err) { console.log("Failed to get results from Seat Geek due to an error: ", err); } }); });
... View more
09-09-2015
12:59 AM
|
0
|
1
|
388
|
POST
|
Hey ESRI - It is the 4th Quarter already and there is still no Web AppBuilder / 10.3 release.
... View more
12-07-2014
02:51 PM
|
0
|
12
|
4886
|
POST
|
This might be the answer - Flash Player 15 and Error 2032 for Flex Viewer
... View more
12-02-2014
04:00 PM
|
0
|
0
|
224
|
POST
|
So a workaround is to give users admin rights, so this issue is related to permissions. Is there a better solution than giving users Admin rights? I am using the 3.6 (api) flex viewer. Thanks. Will
... View more
12-02-2014
03:54 PM
|
0
|
1
|
2097
|
POST
|
Is copying and pasting features supported in the flex viewer? I have some predefined shapes which need to be copied and pasted on the map. Thanks. Will
... View more
11-25-2014
10:35 PM
|
0
|
0
|
1598
|
POST
|
Anyone made some videos on using the WebApp Builder?
... View more
10-28-2014
05:06 PM
|
0
|
1
|
2372
|
Title | Kudos | Posted |
---|---|---|
1 | 06-03-2016 10:20 PM | |
1 | 12-30-2015 07:08 AM | |
1 | 08-15-2014 04:39 PM | |
4 | 11-15-2018 12:30 PM | |
1 | 12-29-2015 08:04 PM |
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|