POST
|
I found the solution: function updateOpacity() { var cOp = map.getLayer(map.basemapLayerIds).opacity; console.info(cOp); if (cOp < 0.9999999999999999) { map.getLayer(map.basemapLayerIds).setOpacity(cOp + 0.1); } else { map.getLayer(map.basemapLayerIds).setOpacity(0.1); } }
... View more
11-19-2015
09:14 AM
|
1
|
0
|
477
|
POST
|
Hi, I am trying to create in the table of content a way to change opacity for a list of basemaps? I am using something like this to switch my basemaps and my code is the following: //Basemap List goes her..
$("#basemapList li").click(function (e) {
switch (e.target.text) {
case "Streets":
map.setBasemap("streets");
break;
case "Imagery":
map.setBasemap("hybrid");
break;
case "National Geographic":
map.setBasemap("national-geographic");
break;
case "Topographic":
map.setBasemap("topo");
break;
case "Gray":
map.setBasemap("gray");
break;
case "Open Street Map":
map.setBasemap("osm");
break;
}
if ($(".navbar-collapse.in").length > 0) {
$(".navbar-toggle").click();
}
});
on(dom.byId("opacity"), "click", updateOpacity);
function updateOpacity() {
var cOp = map.getLayer(map.basemapLayerIds[1]);
var newOp = (op / 100);
streets.setOpacity(1.0 - newOp);
} List: <div title="Basemaps" class="active dropdown" id="basemapList">
<button class="btn btn-default dropdown-toggle" type="button" id="BasemapButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
<span class="glyphicon glyphicon-th-large"></span>
</button>
<a href="" class="dropdown-toggle" data-toggle="dropdown"><b class="caret"></b></a>
<ul class="dropdown-menu" id="myDropdown">
<li><a href="#">Streets</a></li>
<li><a href="#">Imagery</a></li>
<li><a href="#">National Geographic</a></li>
<li><a href="#">Topographic</a></li>
<li><a href="#">Gray</a></li>
<li class="divider"></li>
<li><a href="#">Open Street Map</a></li>
</ul>
</div>
... View more
11-18-2015
04:21 PM
|
0
|
1
|
3223
|
POST
|
Robert, I attached my latest code here. Thank you so much. Alex
... View more
11-17-2015
12:34 PM
|
0
|
1
|
979
|
POST
|
Hi all, I am trying to figure out how to zoom to a feature when a datatable row is clicked on. Just like this but using datatables instead of GRID dojo. Any ideas or recommendations would be helpful My query my table are fed as such: function addToMap3(results) {
map.graphics.clear();
var featureArray = results.features;
if (featureArray && featureArray.length > 0) {
// do stuff with the features
arrayUtils.forEach(featureArray, function (feat) {
feat.setSymbol(symbol8);
map.graphics.add(feat);
});
var extent = esri.graphicsExtent(map.graphics.graphics);
map.setExtent(extent, true);
var cols = [],
row = [],
data = [];
var selected = [];
//create columns
$.each(results.fields, function (index, value) {
cols.push({ 'sTitle': value.name });
});
//create columns
//create rows and push into data
$.each(results.features, function (index, value) {
row = [];
$.each(value.attributes, function (index2, value2) {
row.push(value2);
});
data.push(dojo.clone(row));
});
$('#example').dataTable({
dom: 'Bfrtip',
data: data,
columns: cols,
destroy: true,
buttons: [
'copy', 'csv', 'excel', 'pdf', 'print'
],
"rowCallback": function (row, data) {
if ($.inArray(data.OBJECTID, selected) !== -1) {
$(row).addClass('selected');
}
}
});
$('#example tbody').on('click', 'td', function () {
alert('Row index: ' + table.row(this).index());;
});
} else {
// do stuff when no features were found
alert("No features found")
}
} My code is here. Thanks, Alex
... View more
11-17-2015
11:19 AM
|
0
|
4
|
5176
|
POST
|
Robert, I was only able to toggle the size of the map so far (although the scalebar is acting weird when toggled, It is going when the height reduces 70% it works fine but I go back to 100% seems like the scale bar goes first) . Here is my code. I am not yet able to toggle the attribute table toggle map size: $("#attribute").on('click', function () { var state = $(this).data('state'); if (state) { $("#map").animate({ height: '100%'}, 800); state = false; } else { $("#map").animate({ height:'70%'}); state = true; } $(this).text(state ? 'Open' : 'Close').data('state', state); }); Now I still need to find a way to toggle the table the same way as the map. Not too sure how to make that happen yet. Any help is welcome <div id="table" style="top: auto; left: 0px; background: white; right: 0px; bottom: 0px; position: absolute; height: 299.667px; z-index: 101; display:none;"> <table id="example" class="display nowrap" cellspacing="0" width="50%"></table> </div>
... View more
11-16-2015
01:05 PM
|
0
|
1
|
618
|
POST
|
Hi all, I am trying to create a div (attribute table) that would expand from the bottom and collapse just like in WebAppBuilder. My problem is that my div is hiding behind the map. Any ideas how I can get it to push the map up without loosing the current extent. Web app Builder (what Id like to achieve) Attached is my html code
... View more
11-13-2015
02:16 PM
|
0
|
4
|
3643
|
POST
|
Hi all, I wondered if someone had a good on how to export a data grid to csv file after query. I would like something like this but this fiddle does not seem to work. Also instead of the findTask, I use a simple queryTask. Any idea is welcome. Thanks, Alex function addToMap3(results) { // make sure both queries finished successfully map.graphics.clear(); var featureArray = results.features; if (featureArray && featureArray.length > 0) { // do stuff with the features arrayUtils.forEach(featureArray, function (feat) { feat.setSymbol(symbol8); map.graphics.add(feat); }); var extent = esri.graphicsExtent(map.graphics.graphics); map.setExtent(extent, true); } else { // do stuff when no features were found alert("No features found") } }
... View more
11-13-2015
09:36 AM
|
0
|
2
|
3880
|
POST
|
nevermind this worked: $(document.body).on('change', "#selectpickerValues", function (e) {
//doStuff
pickerValues = $("#selectpickerValues option:selected").val();
});
... View more
11-10-2015
09:25 AM
|
0
|
0
|
592
|
POST
|
Hi all, I made a dropdown that queries some attributes by "county" and returns results in a dropdown. Now I need to enable the user to select values onchange or current from this prepoulated dropdown. I was able to get the first value but not the other values. Any ideas? variable that stores the select value var pickerValues; Queries for drop down: //Select values from Alameda only - onload
var queryTask = new QueryTask("http://webgisdevint1/arcgis/rest/services/ResourceMgmt/WatershedMapper10_2/MapServer/5");
var query = new Query();
query.returnGeometry = false;
query.outFields = ["CALWNUM"];
query.where = "County = 'Alameda'";
queryTask.execute(query, function (results) {
//parse results and add to autocomplete widget
$.each(results.features, function (index, value) {
$('#selectpickerValues').append($('<option>', {
value: value,
text: value.attributes.CALWNUM
}));
});
});
//Query Planning Watershed
$("#selectpickerCounty").change(function () {
$('#selectpickerValues').empty();
var queryTask = new QueryTask("http://webgisdevint1/arcgis/rest/services/ResourceMgmt/WatershedMapper10_2/MapServer/5");
var query = new Query();
query.returnGeometry = false;
query.outFields = ["CALWNUM"];
query.where = "County='" + pickerCounty + "'";
queryTask.execute(query, function (results) {
//parse results and add to autocomplete widget
$.each(results.features, function (index, value) {
$('#selectpickerValues').append($('<option>', {
value: value.attributes.CALWNUM,
text: value.attributes.CALWNUM
}));
pickerValues = value.attributes.CALWNUM;
});
});
});
}); Drop down: <select id="selectpickerValues" class="form-control"></select>
... View more
11-10-2015
09:08 AM
|
0
|
1
|
3533
|
POST
|
Sorry, That was it. I made a mistake. Thank you Robert and Ken. That was a pretty straight forward solution that I did not get. Thanks again.
... View more
11-09-2015
10:04 AM
|
0
|
0
|
581
|
POST
|
var picker1 = $("#selectpicker1").val(); only selects the first value in the drop down. The change of value is not reflected.
... View more
11-09-2015
09:50 AM
|
0
|
1
|
581
|
POST
|
Hi all, I have multiple dropdowns from which I can select Township/range and section values that are used for queries. It does the job when I change the values of the drop downs but when nothing is selected (no change) in the drop down then NO value is selected. Any idea how to get the current value and then the onchange value if users change value on drop downs? Query: var picker1;
var picker2;
var picker3;
var picker4;
var picker5;
$("#selectpicker1").change(function () {
picker1 = this.value;
alert(this.value);
});
$("#selectpicker2").change(function () {
picker2 = this.value;
alert(this.value);
});
$("#selectpicker3").change(function () {
picker3 = this.value;
alert(this.value);
});
$("#selectpicker4").change(function () {
picker4 = this.value;
alert(this.value);
});
$("#selectpicker5").change(function () {
picker5 = this.value;
alert(this.value);
});
on(dom.byId("Query1"), "click", queryPLSS);
function queryPLSS() {
var queryTask = new QueryTask("http://webgisdevint1/arcgis/rest/services/ResourceMgmt/WatershedMapper10_2/MapServer/0");
queryTask.on("complete", addToMap);
var query = new Query();
query.returnGeometry = true;
query.outFields = ["TOWNSHIP", "RANGE", "SECTION"];
query.where = "TOWNSHIP='" + picker1 + picker2 + "' AND " + "RANGE='" + picker3 + picker4 + "' AND " + "SECTION=" + picker5;
query.outSpatialReference = map.spatialReference;
queryTask.execute(query, function (featureSet) {
var AOI = featureSet.features[0].geometry;
var graphic = new Graphic(AOI, symbol8);
var features = [];
features.push(graphic);
var fSet = new FeatureSet();
fSet.features = features;
console.log("Querying...");
}); Thanks, Alex
... View more
11-09-2015
09:31 AM
|
0
|
5
|
2720
|
Title | Kudos | Posted |
---|---|---|
1 | 10-29-2015 04:38 PM | |
1 | 10-15-2014 02:17 PM | |
1 | 11-19-2015 09:14 AM | |
1 | 02-02-2015 09:55 AM | |
1 | 09-25-2014 02:01 PM |
Online Status |
Offline
|
Date Last Visited |
11-05-2021
12:09 PM
|