POST
|
Thank you. That did the trick. I'm almost sure I saw example code where the code listing used 'round', but 'places' did actually display the desired 2 decimal places. Yes. Here's where I saw 'round' in use: Format dates in an info window | ArcGIS API for JavaScript I'm not arguing that it should work, just saying a search on 'arcgis javascript api round' led me there. Thanks again
... View more
03-24-2016
10:17 AM
|
0
|
0
|
331
|
POST
|
Does anyone know why using this construct in an infowindow won't allow me to display anything less than three decimal places? Here is the complete construct: var resTemplate = new InfoTemplate(); resTemplate.setTitle("Customer Residence"); resTemplate.setContent( "<b>Distance to Store: </b>${MI_TO_STORE:NumberFormat(round:2)} miles"); I have tried using both 2 and 1 and even changing the format of my data layer before publishing it to 2 decimal places, but the infowindow insists that it give me three decimal places. Thanks in advance for any suggestions or insights.
... View more
03-24-2016
09:52 AM
|
0
|
2
|
1538
|
POST
|
Polygons Yes, intersect with Yes, I am using ArcGIS Desktop Basically, what I'm trying to ascertain is this: does a point at exactly 50 miles get assigned to and counted as a member of the 20 to 50 mile buffer, the 50 to 100 mile buffer, or both, when you spatially join a layer of xy data with a layer of multiple ring buffers. Thanks
... View more
03-24-2016
06:40 AM
|
0
|
1
|
541
|
POST
|
This is EXACTLY what I'm talking about, wondering about, trying to do. I will do some analysis with my data set tomorrow to try to validate, although I suspect the likelihood of a floating point distance landing exactly at 50 miles, for example, is astronomical. One might have to test with a bogus data set to get conclusive results.
... View more
03-23-2016
02:09 PM
|
1
|
0
|
541
|
POST
|
So if you have Multiple Ring Buffer boundaries defined at say 20, 50, and 100 miles, which 'Ring' does a point at exactly 50 miles fall in? Are the boundaries inclusive or exclusive limits? I have scoured the internet for an answer and cannot find a single post that addresses this. Thanks in advance for your comments.
... View more
03-23-2016
11:10 AM
|
0
|
20
|
4121
|
POST
|
Tim, you're a genius. It turns out I had the layerInfo.length check on in earlier versions, and may have accidentally stripped it out when posting the example code. The real key to making this work was changing map.addLayer(rivers) to map.addLayers([rivers]). Any idea why the former won't display a legend. Seems like it's some sort of an array thing.
... View more
07-28-2014
06:52 AM
|
0
|
3
|
918
|
POST
|
Sure. Here you go. And thanks. FYI, the layer named 'waterbodies' is the one I'm using as a dummy layer that I toggle on and off. When it's on, the legend appears. When it's off the legendDiv content pane appears empty.
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<!--The viewport meta tag is used to improve the presentation and behavior of the samples
on iOS devices-->
<meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no">
<title>Map with legend</title>
<link rel="stylesheet" href="http://js.arcgis.com/3.10/js/dojo/dijit/themes/claro/claro.css">
<link rel="stylesheet" href="http://js.arcgis.com/3.10/js/esri/css/esri.css">
<style>
html, body {
height: 97%;
width: 98%;
margin: 1%;
}
#rightPane {
width: 20%;
}
#legendPane {
border: solid #97DCF2 1px;
}
</style>
<script src="http://js.arcgis.com/3.10/"></script>
<script>
var ccdURL="http://services2.arcgis.com/and the rest of the URL/FeatureServer/0";
var token="?token=token string goes here";
ccdURL=ccdURL+token;
var map;
require([
"esri/map", "esri/layers/FeatureLayer", "esri/dijit/Legend",
"dojo/_base/array", "dojo/parser",
"dijit/layout/BorderContainer", "dijit/layout/ContentPane",
"dijit/layout/AccordionContainer", "dojo/domReady!"
], function(
Map, FeatureLayer, Legend,
arrayUtils, parser
) {
parser.parse();
map = new Map("map", {
basemap:"topo",
center: [-85.7, 44.1],
zoom: 7
});
var rivers = new FeatureLayer(ccdURL, {
mode: FeatureLayer.MODE_ONDEMAND,
outFields:["*"]
});
// this is a dummy layer I threw in just to make the legend work. If this is
// commented out, the legend will appear blank
var waterbodies = new FeatureLayer("http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Hydrography/Watershed173811/MapServer/0", {
mode: FeatureLayer.MODE_ONDEMAND,
outFields:["*"]
});
//add the legend
map.on("layers-add-result", function (evt) {
var layerInfo = arrayUtils.map(evt.layers, function (layer, index) {
return {layer:layer.layer, title:layer.layer.name};
});
var legendDijit = new Legend({
map: map,
layerInfos: layerInfo
}, "legendDiv");
legendDijit.startup();
});
map.addLayers([rivers, waterbodies]);
// map.addLayer(rivers);
// I comment the frist line and use the second when I toggle off the dummy layer
});
</script>
</head>
<body class="claro">
<!--[if IE 7]>
<style>
html, body {
margin: 0;
}
</style>
<![endif]-->
<div id="content"
data-dojo-type="dijit/layout/BorderContainer"
data-dojo-props="design:'headline', gutters:true"
style="width: 100%; height: 100%; margin: 0;">
<div id="rightPane"
data-dojo-type="dijit/layout/ContentPane"
data-dojo-props="region:'right'">
<div data-dojo-type="dijit/layout/AccordionContainer">
<div data-dojo-type="dijit/layout/ContentPane" id="legendPane"
data-dojo-props="title:'Legend', selected:true">
<div id="legendDiv"></div>
</div>
<div data-dojo-type="dijit/layout/ContentPane"
data-dojo-props="title:'Pane 2'">
This pane could contain tools or additional content
</div>
</div>
</div>
<div id="map"
data-dojo-type="dijit/layout/ContentPane"
data-dojo-props="region:'center'"
style="overflow:hidden;">
</div>
</div>
</body>
</html>
... View more
07-25-2014
02:31 PM
|
0
|
5
|
918
|
POST
|
Tim, Thanks for the quick response. The layer polygons are actually visible on the map, but the legend is blank. The feature layer is actually based on a county shapefile for the state of Michigan. I am not able to share a link because of the strategic nature of the data. If I don't make any progress, perhaps I can make a layer with bogus data that I can share. Either way, I'll be back. Thanks again.
... View more
07-25-2014
09:22 AM
|
0
|
7
|
918
|
POST
|
I have a map with a single feature layer, layered over a base map, and I can't get the javascript API to display a legend for it. If I throw in another layer, the legend displays. I'm following code example here: Legend | ArcGIS API for JavaScript. Why won't the legend display when only a single feature layer is defined? Do I have to define a dummy feature layer in order to display a legend? Is the legend widget using some kind of an array or something that requires more than one layer to be defined in order for it to work properly or display anything at all? Any help or insights would be appreciated.
... View more
07-25-2014
07:45 AM
|
1
|
9
|
5561
|
POST
|
How can you display layered infowindows in javascript for a map with layered feature layers, the way arcgis online maps does it? For example, if you have a layer with point locations, and a layer with aggregate data, say by county, when you click on a point, you get a next window arrow in the upper right corner of the infowindow, and a (1 of 2) or (1 of 3) indicator in the upper left, when working with a map on argis online. I want to produce the same functionality in javascript. In other words, I want to get to the layer info in lower layers without having to turn off the upper layer. Will just layering a semi-transparent point layer on top of a shape layer do the trick? Thanks in advance, Don EMU
... View more
07-11-2014
08:20 AM
|
0
|
2
|
2064
|
Title | Kudos | Posted |
---|---|---|
1 | 03-23-2016 02:09 PM | |
1 | 07-25-2014 07:45 AM |
Online Status |
Offline
|
Date Last Visited |
10-20-2022
04:55 PM
|