|
POST
|
Test case 1 - set the source of the info template to the URL of the image. example value from this field (image_url) https://images.skyvdn.com/thumbs/RichmondCS064EB1790.flv.png "<tr><td id='tblMainline1'>image_url</td><td id='tblSubline2'><img src='${image_url}'/></td>"+ If I do this and click on the same feature it does not reload the image from the image source. I have to refresh my browser in order to see the new image. These are traffic cameras so there is a static image that gets added to the Rest End point every few minutes. Test case 2 - call a function from the link to push a url to the div tag to refresh the image. RIGHT now I a, simply trying to get an alert fired in the function from the onvclick event. This is NOT working I tired these 3 examples I do not get the alerts....doing something wrong? function inHrefFunction(test){
alert("Here");
alert(test);
}
function onclickFunction(url) {
alert(url);
}
function myFunction(name, work) {
alert(name + " " + work);
}
var infoHighwayCameras = new InfoTemplate();
infoHighwayCameras.setTitle("Highway Cameras");
infoHighwayCameras.setContent("<table>" +
"<tr><td id='tblTitle'>Highway Cameras</td><td id='tblTitle2'></td></tr>" +
"<tr><td id='tblTitleLine'></td><td id='tblTitleLine2'></td></tr>" +
"<tr><td></td><td></td></tr>" +
"<tr><td id='tblMainline1'>image_url</td><td id='tblSubline2'><i>TEST1 <a href='#' onclick='onclickFunction('${image_url}')'>Click Me!</a>." +
"<tr><td id='tblMainline1'>image_url</td><td id='tblSubline2'><i>TEST2 <a href='javascript:inHrefFunction('${image_url}')'>Click Me!</a>." +
"<tr><td id='tblMainline1'>image_url</td><td id='tblSubline2'><i>TEST2 <button onclick='myFunction('Harry Potter','Wizard')'>Try it</button>" +
"<tr><td id='tblMainline1'>image_url</td><td id='tblSubline2'><img src='${image_url}'/></td>"+
"</table><hr>");
var HighwayCameras = new FeatureLayer("https://services.arcgis.com/DO4gTjwJVIJ7O9Ca/arcgis/rest/services/Camera_Location_VDOT/FeatureServer/0", {
mode: FeatureLayer.MODE_ONDEMAND,
visible: false,
opacity: .5,
outFields:["*"],
infoTemplate: infoHighwayCameras
});
legendLayers3.push({ layer: HighwayCameras, title: 'Highway Cameras' });
... View more
11-30-2018
12:27 PM
|
0
|
28
|
2901
|
|
POST
|
My problem with simply setting the img src, which works, but it does not reload a new image when clicked again. These images refresh via the services. The only way to do this right now is to refresh the browser which I dont want to do.
... View more
11-30-2018
11:53 AM
|
0
|
30
|
2901
|
|
POST
|
Thank you and that does work....but my real-estate is a bit lacking which is why I am also trying to get this link to display in a separate DIV If I specify the URL in html it shows the image. What i need to do is update this image when I click the link in the infotemplate Maybe update the div1.innerHTML with the source? Obviously the below does not work <div id="div1" style="margin: 0 auto; width:340px; height:300px;">
<object type="text/html"
data="https://images.skyvdn.com/thumbs/RichmondCS064EB1790.flv.png"
style="width:320px; height:290px; padding-left:6px;">
</object>
</div> "<tr><td id='tblMainline1'>image_url</td><td id='tblSubline2'><i>For Camera Image <a onclick='div1.innerHTML = 'src= ${image_url}''); return false;'>Open Link in Popup</a>." +
... View more
11-30-2018
11:26 AM
|
0
|
32
|
2901
|
|
POST
|
I tried this but it still pops up in a new tab Do I need a new reference in JavaScript? Missing the mark? "<tr><td id='tblMainline1'>image_url</td><td id='tblSubline2'><i>For Camera Image <a href='${image_url}' target='popup' onclick='window.open('${image_url}','popup','width=600,height=600'); return false;'>Open Link in Popup</a>." +
... View more
11-30-2018
10:48 AM
|
0
|
0
|
2901
|
|
POST
|
I have an info template returning a link. Right now with I click on it it opens to a new browser tab (_blank) Looking for 2 options. 1. Display this in a DIV 2. Pop this up into a new floating popup Any ideas var infoHighwayCameras = new InfoTemplate();
infoHighwayCameras.setTitle("Highway Cameras");
infoHighwayCameras.setContent("<table>" +
"<tr><td id='tblTitle'>Highway Cameras</td><td id='tblTitle2'></td></tr>" +
"<tr><td id='tblTitleLine'></td><td id='tblTitleLine2'></td></tr>" +
"<tr><td></td><td></td></tr>" +
"<tr><td id='tblMainline1'>image_url</td><td id='tblSubline2'><i>For Camera Image <a href='${image_url}' target='_blank'><font color='0x84CCDA'>click here</font></a>."+
"</table><hr>");
... View more
11-30-2018
10:33 AM
|
0
|
35
|
8914
|
|
POST
|
I know this is not the way to do this although I don know of any other way to accomplish what I am looking for... This is how I put on a large band-aid I still have to clean up the CSS to hide the clumsiness of this approach...especially with nesting the accordion panes.. I still have to clean up my code so don't be too judgmental I repeated the code to build the legend layers in each of the accordion panes. I can put if then statements in this section to decrease the amount of code - map.on('layers-add-result', function () { This gives you something like this in your panel... I have a container for Weather, Incidents, Other Layers. If I do a little CSS work I can get ride of the frames and color backgrounds and make this look a little more appealing. The example below does not have all the layers in the image. In my below example it would simply put one feature layer in each of the 3 accordions Follow the "legendLayers1.push" below from each FeatureLayer to the function below it. legendLayers1.push({ layer: WeatherImpactWashout, title: 'WeatherImpact Washout' }); legendLayers2.push({ layer: WeatherImpactWashout, title: 'WeatherImpact Washout' }); legendLayers2.push({ layer: WeatherImpactWashout, title: 'WeatherImpact Washout' }); <div id="IDAccordionPaneLayers" data-dojo-type="dijit.layout.AccordionContainer" style="color:black; height:90%; width:90%;">
<div id="idLayers2" data-dojo-type="dijit.layout.ContentPane" data-dojo-props="title:'Weather'" >
<div data-dojo-type="dijit/layout/ContentPane" data-dojo-props="title:'Natural Disasters'">
<div id="toggle2" style="padding: 2px 2px; color:Black;"></div>
</div>
</div>
<div id="idLayers3" data-dojo-type="dijit.layout.ContentPane" data-dojo-props="title:'Incidents & Traffic'" >
<div data-dojo-type="dijit/layout/ContentPane" data-dojo-props="title:'Natural Disasters'">
<div id="toggle3" style="padding: 2px 2px; color:Black;"></div>
</div>
</div>
<div id="idLayers1" data-dojo-type="dijit.layout.ContentPane" data-dojo-props="title:'Layers1'" >
<div data-dojo-type="dijit/layout/ContentPane" data-dojo-props="title:'Natural Disasters'">
<div id="toggle1" style="padding: 2px 2px; color:Black;"></div>
</div>
</div>
</div> var WeatherImpactPowerLines = new FeatureLayer("https://arcgis.vdem.virginia.gov/ArcGIS/rest/services/Traffic/VATraffic_WeatherImpactPoints/MapServer/4", {
mode: FeatureLayer.MODE_ONDEMAND,
visible: false,
outFields:["*"],
infoTemplate: infoWeatherImpact
});
legendLayers1.push({ layer: WeatherImpactPowerLines, title: 'WeatherImpact Power Lines' });
var WeatherImpactOther = new FeatureLayer("https://arcgis.vdem.virginia.gov/ArcGIS/rest/services/Traffic/VATraffic_WeatherImpactPoints/MapServer/5", {
mode: FeatureLayer.MODE_ONDEMAND,
visible: false,
outFields:["*"],
infoTemplate: infoWeatherImpact
});
legendLayers2.push({ layer: WeatherImpactOther, title: 'WeatherImpact Other' });
var WeatherImpactPassable = new FeatureLayer("https://arcgis.vdem.virginia.gov/ArcGIS/rest/services/Traffic/VATraffic_WeatherImpactPoints/MapServer/6", {
mode: FeatureLayer.MODE_ONDEMAND,
visible: false,
outFields:["*"],
infoTemplate: infoWeatherImpact
});
legendLayers3.push({ layer: WeatherImpactPassable, title: 'WeatherImpact Passable' });
// ADD CHECK BOXES FOR LAYERS
map.on('layers-add-result', function () {
//add check boxes
arrayUtils.forEach(legendLayers1, function (layer) {
var layerName = layer.title;
var checkBox = new CheckBox({
name: "checkBox" + layer.layer.id,
value: layer.layer.id,
checked: layer.layer.visible
});
checkBox.on("change", function () {
var targetLayer = map.getLayer(this.value);
targetLayer.setVisibility(!targetLayer.visible);
this.checked = targetLayer.visible;
});
//add the check box and label to the toc
//domConstruct.place(checkBox.domNode, dom.byId("toggle"), "after");
domConstruct.place(checkBox.domNode, dom.byId("toggle1"), "after");
var checkLabel = domConstruct.create('label', {
'for': checkBox.name,
innerHTML: layerName
}, checkBox.domNode, "after");
domConstruct.place("<br />", checkLabel, "after");
});
arrayUtils.forEach(legendLayers2, function (layer) {
var layerName = layer.title;
var checkBox = new CheckBox({
name: "checkBox" + layer.layer.id,
value: layer.layer.id,
checked: layer.layer.visible
});
checkBox.on("change", function () {
var targetLayer = map.getLayer(this.value);
targetLayer.setVisibility(!targetLayer.visible);
this.checked = targetLayer.visible;
});
//add the check box and label to the toc
//domConstruct.place(checkBox.domNode, dom.byId("toggle"), "after");
domConstruct.place(checkBox.domNode, dom.byId("toggle1"), "after");
var checkLabel = domConstruct.create('label', {
'for': checkBox.name,
innerHTML: layerName
}, checkBox.domNode, "after");
domConstruct.place("<br />", checkLabel, "after");
});
arrayUtils.forEach(legendLayers3, function (layer) {
var layerName = layer.title;
var checkBox = new CheckBox({
name: "checkBox" + layer.layer.id,
value: layer.layer.id,
checked: layer.layer.visible
});
checkBox.on("change", function () {
var targetLayer = map.getLayer(this.value);
targetLayer.setVisibility(!targetLayer.visible);
this.checked = targetLayer.visible;
});
//add the check box and label to the toc
//domConstruct.place(checkBox.domNode, dom.byId("toggle"), "after");
domConstruct.place(checkBox.domNode, dom.byId("toggle1"), "after");
var checkLabel = domConstruct.create('label', {
'for': checkBox.name,
innerHTML: layerName
}, checkBox.domNode, "after");
domConstruct.place("<br />", checkLabel, "after");
});
});
//ADD THE LEGEND AND XY COORDINATES
map.on("layers-add-result", function (evt) {
// CYCLE through and grab all the layer names to add to the LEGEND PLUS
// Remove layers not inteneted for the legend.
var layerInfo = arrayUtils.map(evt.layers, function (layer, index) {
if (layer.layer.id === "PastLocations" || layer.layer.id === "District" || layer.layer.id === "weatherlayer") { return { }; } //Hides Layers in the Legend
else { return { layer: layer.layer, title: layer.layer.name }; } //Else return All others
});
// CYCLE through and grab all the layer names to add to the LEGEND
if (layerInfo.length > 0) {
var legendDijit = new Legend({
map: map,
layerInfos: layerInfo,
}, "legend");
legendDijit.startup();
legendDijit.refresh();
}
});
map.addLayers([
WeatherImpactPassable,WeatherImpactOther,WeatherImpactPowerLines
]);
... View more
11-14-2018
11:57 AM
|
1
|
0
|
5676
|
|
POST
|
So there is no way to build a layer list that includes specific layers from multiple features and have the ability to collapse? I guess I can create my own accordions and add 3 different Layer Lists (like I am using now)....seems like a lot of code for something so small... Thanks for your help
... View more
11-14-2018
10:08 AM
|
0
|
1
|
1714
|
|
POST
|
So if I have 20 individual layers from multiple sources, with InfoTemplates..... I want 3 categories...using your example...trying to figure out how I get like 10 in the first, 5 in the second and 5 in the third.... Each category will have layers from multiple sources....some external and some internal Say I had this. How do I get both of these in onto the atlasLayer // WMA LINE
var WMAFL = new FeatureLayer("https://xxxx/arcgis/rest/services/Projects/AVL/MapServer/4", {
mode: FeatureLayer.MODE_SNAPSHOT,
visible: true
});
// WMA FEATURES POINT
var WMAFPt = new FeatureLayer("https://xxxx/arcgis/rest/services/Projects/Locations/MapServer/2", {
mode: FeatureLayer.MODE_SNAPSHOT,
visible: true
}); var llWidget = new LayerList({
map: map,
layers: [{
layer: atlasLayer, // I WANT BOTH LAYERS IN THIS CATEGORY
id: "Atlas layers",
subLayers: true
},
{
layer: recreationLayer,
id: "Recreation Layer",
subLayers: true
},{
layer: waterNetLayer,
id: "Water Network Layer",
subLayers: true
}],
showLegend: true,
showOpacitySlider: true
},"layerList");
llWidget.startup();
... View more
11-14-2018
09:40 AM
|
0
|
4
|
3962
|
|
POST
|
Say I wanted the Recreation in the atlasLayer Can I do this? var llWidget = new LayerList({ map: map, layers: [{ layer: atlasLayer,recreationLayer, id: "Atlas layers", subLayers: true }, { layer: recreationLayer, id: "Recreation Layer", subLayers: true },{ layer: waterNetLayer, id: "Water Network Layer", subLayers: true }], showLegend: true, showOpacitySlider: true },"layerList"); llWidget.startup();
... View more
11-14-2018
09:28 AM
|
0
|
6
|
3962
|
|
POST
|
Thinking.....I have infotemplates as well to control what I see. On a few of them I am doing more than simply reading from the Service for symbology etc. Can I handle this with this code example? // ADDRESS POINTS
var simpleJson = {
"type": "simple",
"label": "",
"description": "",
"symbol": {
"color": [255,255,51],
"size": 6,
"angle": 0,
"xoffset": 0,
"yoffset": 0,
"type": "esriSMS",
"style": "esriSMSCircle",
"outline": {
"color": [255,0,0],
"width": 1,
"type": "esriSLS",
"style": "esriSLSSolid"
}
}
}
var infoTemplateAddressPoints = new InfoTemplate();
infoTemplateAddressPoints.setTitle("Address Point Information");
infoTemplateAddressPoints.setContent("<table>" +
"<tr><td id='tblTitle'>Address Pts</td><td id='tblTitle2'></td></tr>" +
"<tr><td id='tblTitleLine'></td><td id='tblTitleLine2'></td></tr>" +
"<tr><td></td><td></td></tr>" +
"<tr><td id='tblMainline1'>Address</td><td id='tblSubline2'>${FULLADDR}</td></tr>" +
"<tr><td id='tblMainline1'>Municipality</td><td id='tblSubline2'>${MUNICIPALITY}</td></tr>" +
"<tr><td id='tblMainline1'>PO Name</td><td id='tblSubline2'>${PO_NAME}</td></tr>" +
"<tr><td id='tblMainline1'>Zip Code</td><td id='tblSubline2'>${ZIP_5}</td></tr>" +
"</table><hr>");
var AddressPointEndPoint = "https://xxxxxx/arcgis/rest/services/VA_Base_layers/VA_Address_Points/MapServer/0";
var AddressPoints = new FeatureLayer(AddressPointEndPoint, {
id: "AddressPoint",
minScale: 50000,
visible: true,
opacity: .7,
outFields: ["*"],
infoTemplate: infoTemplateAddressPoints
});
// Push layer to the legend
legendLayers.push({ layer: AddressPoints, title: 'Address Points' });
var rend = new SimpleRenderer(simpleJson);
AddressPoints.setRenderer(rend)
... View more
11-14-2018
08:50 AM
|
0
|
8
|
3962
|
|
POST
|
So from what I am seeing there are 3 map services each with an array of layers in them. This reads through each service and creates the list allowing them to collapse?
... View more
11-14-2018
08:46 AM
|
0
|
1
|
3962
|
|
POST
|
I saw this example but its using a web map I have my layers all defined individually in my js page But this is the functionality I am after....but I am not using a web map ArcGIS API for JavaScript Sandbox
... View more
11-14-2018
08:09 AM
|
0
|
12
|
3962
|
|
POST
|
Looking for any examples of a collapsible layer list that Auto fills with my layers. I have seen some really basic layer list examples on the api page but nothing that allows collapsible areas and auto filling of your layers. I am trying to create 3 different areas as seen below. Were the box next to the ------------- would collapse that section. But I want it to auto fill the layers from my .js page. Right now I am adding layers to the list and adding check boxes BUT THERE it is not collapsible legendLayers.push({ layer: FloodZonelayer, title: 'Flood Zones' });
// ADD CHECK BOXES FOR LAYERS
map.on('layers-add-result', function () {
//add check boxes
arrayUtils.forEach(legendLayers, function (layer) {
var layerName = layer.title;
var checkBox = new CheckBox({
name: "checkBox" + layer.layer.id,
value: layer.layer.id,
checked: layer.layer.visible
});
checkBox.on("change", function () {
var targetLayer = map.getLayer(this.value);
targetLayer.setVisibility(!targetLayer.visible);
this.checked = targetLayer.visible;
});
//add the check box and label to the toc
domConstruct.place(checkBox.domNode, dom.byId("toggle"), "after");
var checkLabel = domConstruct.create('label', {
'for': checkBox.name,
innerHTML: layerName
}, checkBox.domNode, "after");
domConstruct.place("<br />", checkLabel, "after");
});
});
//ADD THE LEGEND AND XY COORDINATES
map.on("layers-add-result", function (evt) {
// CYCLE through and grab all the layer names to add to the LEGEND PLUS
// Remove layers not inteneted for the legend.
var layerInfo = arrayUtils.map(evt.layers, function (layer, index) {
if (layer.layer.id === "PastLocations" || layer.layer.id === "District" || layer.layer.id === "weatherlayer") { return { }; } //Hides Layers in the Legend
else { return { layer: layer.layer, title: layer.layer.name }; } //Else return All others
});
// CYCLE through and grab all the layer names to add to the LEGEND
if (layerInfo.length > 0) {
var legendDijit = new Legend({
map: map,
layerInfos: layerInfo,
}, "legend");
legendDijit.startup();
legendDijit.refresh();
}
});
... View more
11-14-2018
08:08 AM
|
0
|
13
|
6087
|
|
POST
|
Greg NOTE: The SYNC still works...but only one way....it works from the mobile unit to the server. it does not work from the server to the unit. SO their data will sync up to the server fine, they will get the error telling them that no data was brought down from the server. I have crews out currently collecting data live and disconnected....the data is getting here...the only difference is that the data changes on the server from other collections etc. are not being sync'd coming down... This is a huge annoyance....I ask that my crews remove the project in Collector before starting a new day....this will remove it from the device and allow for a new download from the server...this will bring down all the data currently on the server for a given area. But it still works....sort of....lol
... View more
09-27-2018
05:21 AM
|
0
|
0
|
2735
|
|
POST
|
Sadly I don think so....Still so puzzled a version was released with no one QA/QC this stuff...seems like a pretty blatant mistake....
... View more
09-25-2018
09:52 AM
|
0
|
3
|
2735
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 09-20-2018 11:09 AM | |
| 1 | 09-10-2018 06:26 AM | |
| 1 | 09-15-2022 11:02 AM | |
| 1 | 05-21-2021 07:35 AM | |
| 1 | 08-09-2022 12:39 PM |
| Online Status |
Offline
|
| Date Last Visited |
09-19-2022
09:23 PM
|