|
POST
|
I need to figure out how to set up check boxes to choose values to query from a data layer. Some of the values will be a single category, such as 'Audiologist' or "Orthopedist'. But there will also be a category that is more of a group "Mental Health", that might have subcategories of 'Alcohol',' Narcotics' If I could organize this using a checkbox tree, then the items that had subcategories could be grouped under a single item in the tree, which the ones that didn't would just be a one line with a checkbox. I think this would give a cleaner look to the interface. This is obviously exactly what's going on with the TOC, but I'm not dealing with layers. The Values will remain constant and I don't think I'll have even a dozen to deal with. Once the user makes their selection, then I can use the values to create a where clause and then either a queryTask or a selectFeatures on featureLayer. That results of the query will go into a grid. What I'm envisioning isn't a TOC, or I'd just use that. I'm having a hard time finding a good example of the checkbox tree. I found this site, but it's enough out of date that the code isn't working for me. http://thejekels.com/cbtree/demos/ArcGIS.php I vaguely remember a POI example on the ESRI site from a couple years back, but I can't find a working example of that either. If anyone has a better suggestion, I'd like to hear it.
... View more
03-13-2015
02:29 PM
|
0
|
9
|
7842
|
|
POST
|
Actually, it looks like all I was missing map.infoWindow.clearFeatures. First I put in your lines, but then I commented out the setInfoTemplate to see what happened. It worked w/o that line.
... View more
03-03-2015
10:02 AM
|
0
|
1
|
747
|
|
POST
|
And then set the infoTemplate back again? Otherwise I'll end up without an infoTemplate defined for my clusterLayer.
... View more
03-03-2015
09:39 AM
|
0
|
1
|
2837
|
|
POST
|
I'll see what I can come up with. I looked through the clusterLayer.js file and I don't think I modified it at all. I only modified my function to use a queryTask to create the necessary input data to build the clusters in the first place. There's nothing fancy about my geocoder either.
... View more
03-02-2015
02:13 PM
|
0
|
1
|
2837
|
|
POST
|
That didn't take care of it either. It must be the clusterLayer, which is based on GraphicsLayer. It doesn't happen with other types like FeatureLayers. If it was based on FeatureLayer, then you could expect it to inherit some of the 'clear' methods. I already have a map.graphics.clear, which didn't help. At least the first content is from the geocoder. Most users will likely ignore the arrow, but for the curious, they're going to see something completely irrelevant. At first I thought it was only happening if the infoWindow was still open when I used the Geocoder. It doesn't seem to matter, it still remembers the contents from the previously selected graphic.
... View more
03-02-2015
01:53 PM
|
0
|
1
|
2837
|
|
POST
|
That didn't take care of it. I put it in the cleanUp function as well as in the showLocation function.
... View more
03-02-2015
01:05 PM
|
0
|
3
|
2837
|
|
POST
|
I have a clusterLayer based on the point clustering example:https://developers.arcgis.com/javascript/jssamples/layers_point_clustering.html Toward the top, I define my infoTemplate and call the function to generate the clusters: infoTemplateContent = "<b>Status: ${FlagStatusDescription}</b><br>"
+"Type: ${ItemFunctionDescription}<br>"
+"Agency: ${AgencyAcronym}<br>"+
"Address: ${EntityLocationAddress1}<br>"
+"City: ${EntityLocationCity}<br>"
+ "IP address: ${II_IPAddress}";
infoTemplate = new InfoTemplate();
infoTemplate.setTitle("Server ID: ${Item_Name}");
infoTemplate.setContent(infoTemplateContent);
createCluster(); Here's the function function createCluster(){
var queryTask = new QueryTask(pathName+"/ArcGIS/rest/services/myService/MapServer/1");
var query = new Query();
query.returnGeometry = true;
query.where = '1=1';
query.outFields = ["*"];
queryTask.on("complete", function(results){
var inputInfo = {};
inputInfo.data = arrayUtils.map(results.featureSet.features, function(feature){
var point = feature.geometry;
var att = feature.attributes;
var pointX = feature.geometry.x;
var pointY = feature.geometry.y;
return {
"x": pointX,
"y": pointY,
"attributes": att
};
});
var singleServerSymbol = new SimpleMarkerSymbol(SimpleMarkerSymbol.STYLE_CIRCLE, 10,
new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID, new Color([0,0,0]), 1),new Color([0,205,0,0.25]));
// cluster layer that uses OpenLayers style clustering
clusterLayer = new ClusterLayer({
"data": inputInfo.data,
"distance": 5,
"id": "clusterLayer",
"labelColor": "#fff",
"labelOffset": 10,
"resolution": res,
"singleColor": "#00ca00",
"singleSym": "singleServerSymbol",
"singleTemplate": infoTemplate
});
var renderer = new ClassBreaksRenderer(singleServerSymbol, "clusterCount");
var single = new PictureMarkerSymbol("https://static.arcgis.com/images/Symbols/Shapes/GreenCircleLargeB.png", 18, 18);
var small = new PictureMarkerSymbol("https://static.arcgis.com/images/Symbols/Shapes/GreenPin1LargeB.png", 48, 48).setOffset(0, 15);
var medium = new PictureMarkerSymbol("https://static.arcgis.com/images/Symbols/Shapes/GreenPin1LargeB.png", 64, 64).setOffset(0, 15);
var large = new PictureMarkerSymbol("https://static.arcgis.com/images/Symbols/Shapes/GreenPin1LargeB.png", 96, 96).setOffset(0, 15);
renderer.addBreak(0, 2, single);
renderer.addBreak(2, 25, small);
renderer.addBreak(25, 100, medium);
renderer.addBreak(100, 5001, large);
clusterLayer.setRenderer(renderer);
map.addLayer(clusterLayer, 1);
queryTask.on("error", function(err){
alert(err.details);
});
map.on("key-down", function(e){
if (e.keyCode == 27) {
cleanUp();
}
});
});
queryTask.execute(query);
}
function cleanUp() {
map.infoWindow.hide();
clusterLayer.clearSingles();
} I'm noticing that if I first click on a cluster to get information and follow that with the geocoder Widget, the infoContents that popup from my geocoder's showLocation function continues to retain the information from the clusterLayer. It does start with evt.result.name,but also has the arrow indicating additional content. When you click the arrow, you see the additional content content is the previously show information from the clusterLayer. function showLocation(evt){
var symbol = new SimpleMarkerSymbol();
symbol.setStyle(SimpleMarkerSymbol.STYLE_CIRCLE);
symbol.setColor(new Color([255,128,0,0.75]));
map.graphics.clear();
var point = evt.result.feature.geometry;
var graphic = new Graphic(point, symbol);
map.graphics.add(graphic);
map.infoWindow.setContent(evt.result.name);
map.infoWindow.show(evt.result.feature.geometry);
} It seems like the the cleanUp function for the clusterLayer would take care of this. This project contains sensitive data, so I'm sorry I can't give you a link to the actual project.
... View more
03-02-2015
12:47 PM
|
0
|
12
|
7293
|
|
POST
|
I've been messing with this a while. I'm sure I've done something squirrely as I've added lines here and there in an attempt to fix it. It also seems to be running back through zoomDistrict again, and I haven't traced where that is coming from. I could take the whole button out and not try to populate the grid from the map extent too. But to me, a grid of data should tie back to what the user sees on the screen. Nearly all my other projects have that functionality. The twist with this one is trying to allow either querying or extent events using the same grid.
... View more
02-27-2015
12:41 PM
|
0
|
0
|
1504
|
|
POST
|
I have a queryTask that populates a dGrid based on the user's selection from a dropdown list. Initially the dGrid is empty and the user must select from a list of school districts. Once the user makes a selection, only those schools appear in the grid. I would like the user to be able to clear that selection and automatically change the contents of the grid to be all schools in the current map extent instead. The queryTask that selects the schools by district is handled by registry.byId("distSelect").on('change', function(){
clearDiv('searchResultsGrid');
var distCode = registry.byId("distSelect").value;
selectSchoolsByDistrict(distCode);
});
function selectSchoolsByDistrict(distCode){
extResults = false;
extentChangeHandler.pause();
schoolQuery.where = "SD_GIS.OGI.EDUCATION_SCHOOL_PUBLIC.CtyDist = '" + distCode + "'";
schoolQueryTask.on('complete', completeSelection);
schoolQueryTask.execute(schoolQuery);
}
function selectSchoolsError(err){
console.log("Error in selectSchoolsByDist " + err.message);
}
function completeSelection(results){
if (results) {
updateGrid(results.featureSet);//populate the school list
// switchDomClass('btnClearSel','show');
zoomDistrict();//zoom to the school district
}
} I have an event listener defined for the map's extent change that executes another query based on the current map extent, rather than a where clause. extentChangeHandler = on.pausable(map, 'extent-change', function(map){
clearDiv('searchResultsGrid');
var schoolQuery2 = new Query();
schoolQuery2.outSpatialReference = spatialReference;
schoolQuery2.returnGeometry = true;
schoolQuery2.outFields = ['*'];
schoolQuery2.geometry = map.extent;
if (extResults) {
schoolQueryTask2.execute(schoolQuery2, updateGrid);
}
}); I have a button for clearSelection that resets my title, clears my grid and is supposed to resume my extentChangeHandler. registry.byId('btnClearSel').on('click', function(){
extResults = true;
extentChangeHandler.resume();
var currentExtent = map.extent;
map.setExtent(currentExtent);
clearDiv('countyDistGridDiv');
clearDiv('searchResultsGrid');
map.infoWindow.hide();
switchDomClass('countyDistGridDiv', 'hide');
dom.byId('subHeader').innerHTML = 'Missouri Public School Directory';
registry.byId('footerPane').domNode.innerHTML = "";
dom.byId('chooseHeader').innerHTML = "";
dom.byId('listHeader').innerHTML = "All schools shown on map:";
registry.byId("distSelect").reset();
registry.byId("countySelect").reset();
} ); It didn't feel like just resuming the extentChangeHandler was going to execute, so I added a map.setExtent(currentExtent) to try to fire the paused event, which I think I'm resuming. When I put a breakpoint in extentChangeHandler, it doesn't look like it ever gets to the lines that schoolQueryTask2. I'm not 100% sure I need the Boolean extResults, which I have set initially as false. It seems like I want it so that the grid doesn't immediately start populating with thousands of schools from this state-wide map. Here's a link: https://ogitest.oa.mo.gov/DESE/schoolSearch/index.html
... View more
02-27-2015
11:50 AM
|
0
|
3
|
4112
|
|
POST
|
Found it! In the earlier post, Brent indicated that selectMode:single didn't help. But in my example, that's what I was missing.
... View more
02-27-2015
09:28 AM
|
0
|
0
|
490
|
|
POST
|
I have a column called id, but it still highlights all selected records, like you're describing. I'm building a grid based on the results of a findTask, using dGrid and Memory. I haven't been explicitly assigning columns, because the grid has always been OK defining it this way. Maybe there is an issue specifically with Selection that needs them? function executeServerFind (){
var searchText = dom.byId('txtSearch').value;
searchFindParams.searchText = searchText;
var data = [];
if (resultGrid) {
resultGrid.refresh();
}
searchFindTask.execute(searchFindParams, function(results){
if (results.length > 0) {
data = arrayUtils.map(results, function (result) {
return {
"id": result.feature.attributes.ESRI_OID,
"fieldname": result.foundFieldName,
"fieldvalue": result.value,
"itemname": result.feature.attributes.Item_Name,
"description":result.feature.attributes.ItemFunctionDescription,
"agency":result.feature.attributes.AgencyAcronym,
"location":result.feature.attributes.EntityLocationName,
"address":result.feature.attributes.EntityLocationAddress1,
"city":result.feature.attributes.EntityLocationCity
};
});
var memory= new Memory({
data: data,
idProperty: 'id'
});
resultGrid = new (declare([Grid, Selection]))({
renderRow: resultRenderRowFunction,
showHeader: false
}, "resultsGridDiv");
resultGrid.set("store", memory);
resultGrid.on('.dgrid-row:click',function(event){
var row = resultGrid.row(event);
var featureLayer = map.getLayer("allLayer");
var gridQuery = new Query();
gridQuery.objectIds = [row.data.id];
allLayer.selectFeatures(gridQuery, FeatureLayer.SELECTION_NEW, function(results) {
if ( results.length > 0 ) {
var feature = results[0];
feature.setInfoTemplate(infoTemplate);
var resultGeometry = results[0].geometry;
var extent = map.extent;
if(!extent.contains(resultGeometry)) {
map.centerAt(resultGeometry)
}
map.infoWindow.setFeatures(results);
map.infoWindow.show(resultGeometry);
} else {
console.log("error in grid.on click function");
}
});
});
} else {
console.log("Nothing found.");
}
});
}
... View more
02-27-2015
09:19 AM
|
0
|
1
|
3682
|
|
POST
|
No, that's just how it launches when I run start up. I can click Advanced and open it anyway. I'm just not sure why it's behaving the way it is.
... View more
02-23-2015
02:05 PM
|
0
|
1
|
1457
|
|
POST
|
I got my app registered, but when I try to launch my map with startup.bat I'm getting a privacy error. I'm using Chrome.
... View more
02-23-2015
01:56 PM
|
0
|
3
|
4884
|
|
POST
|
I've decided our logo doesn't fit in the header. It looks like I can only change the logo. How do I get rid of it altogether?
... View more
02-23-2015
07:34 AM
|
0
|
1
|
4044
|
|
POST
|
That was it! I thought I'd tried that already, but apparently not. Naturally we're in the process of re-organizing our AGOL accounts, but at least I'm past the first hurdle.
... View more
02-20-2015
11:01 AM
|
0
|
0
|
763
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 06-02-2017 02:38 PM | |
| 2 | 03-18-2022 10:14 AM | |
| 2 | 02-18-2016 06:28 AM | |
| 1 | 03-18-2024 07:29 AM | |
| 4 | 08-02-2023 06:08 AM |
| Online Status |
Offline
|
| Date Last Visited |
02-25-2025
01:56 PM
|