|
POST
|
No new workflow....just changed from points geometry to a line geometry In the image above I am querying and returning data on a Point and Line Geometry...Except the line geometry is not being show as selected. Only the points are. The image shows 2 grids...on the left is the Points and on the right are the lines. I left on the roads (line layer) to shwo there is geometry.....they should be selected in purple like the points but they are not...thats my trouble.
... View more
09-05-2018
07:08 AM
|
0
|
13
|
1636
|
|
POST
|
If I uncomment this and draw all of them without being selecting You can see the point below were selected and are purple The lines were not set to purple but were selected and populated the right dgrid below. // Make unselected features invisible
var nullSymbol = new SimpleLineSymbol().setWidth(0);
WMALines.setRenderer(new SimpleRenderer(nullSymbol));
... View more
09-05-2018
06:11 AM
|
0
|
15
|
1636
|
|
POST
|
Yea I had that before.....I added your example and still nothing renders....hmmmm I can click and select the records. Return them to the dgrid. Select in the dGrid and highlight the feature. They just dont show up purple after the map click to initially select them light the points did....
... View more
09-05-2018
06:06 AM
|
0
|
16
|
1636
|
|
POST
|
I do have one last question..I posted it in this area because it directly deals with my past issues above....while it is working.....I changed this to a line feature and assume that the selection symbology has to be modified to render the line...have issues with that. If I dont put this code in there to mark the unseelected as O width the lines draw. NO big deal // Make unselected features invisible
var nullSymbol = new SimpleLineSymbol().setWidth(0);
linefl.setRenderer(new SimpleRenderer(nullSymbol)); When I click in the map the features are returned and displayed in the dGrid. Great When I click on a record the grid the feature highlights on the map. Great My issue is when I click the map and the features are selected they are supposed to turn a purpleish color. This worked for the points but I think I have something wrong with the lines...I have interaction between the grid and map, the features are being selected but the selected features are not rendering in the map for some reason....the only thing I can think of is a bad symbology definition. window.grid2 = new(declare([Grid, Selection]))({
// use Infinity so that all data is available in the grid
bufferRows: Infinity,
subRows:[
[
{field:"id", label: "ID", rowSpan: 2},
{field:"TYPE", label: "type"},
{field:"WMA", label: "wma" }
],
[
{field:"Label", label: "Label"},
{field:"Name", label: "Name"}
]
]
}, "grid2");
// add a click listener on the ID column
grid2.on(".field-id:click", selectLines);
//-------SNIP---------------------------------------------------------------------
window.LineUrl = "https://xxxxxx/arcgis/rest/services/Projects/Locations/FeatureServer/4";
window.LineoutFields = ["OBJECTID", "ID", "Type", "WMA", "Label", "Name"];
var linefl = new FeatureLayer(window.LineUrl,{
id: "LinePnts",
outFields: ["*"]
});
// Selection symbol used to draw the selected lines
var symbol = new SimpleLineSymbol(
SimpleLineSymbol.STYLE_Solid,
3,
new SimpleLineSymbol(
SimpleLineSymbol.STYLE_NULL,
new Color([247, 34, 101, 0.9]),
1
),
new Color([207, 34, 171, 0.5])
);
linefl.setSelectionSymbol(symbol);
// Make unselected features invisible
var nullSymbol = new SimpleLineSymbol().setWidth(0);
linefl.setRenderer(new SimpleRenderer(nullSymbol));
linefl.on("click", selectlinefl);
// change cursor to indicate features are click-able
linefl.on("mouse-over", function() {
window.mapClickEvt.pause();
map.setMapCursor("pointer");
});
linefl.on("mouse-out", function() {
setTimeout(function(){
window.mapClickEvt.resume();
}, 800);
map.setMapCursor("default");
});
map.addLayer(linefl);
//-------SNIP - ---------------------------------------------------------------------
function selectInBufferLines(response){
alert("SelectInBufferLines");
var feature;
var features = response.features;
var inBuffer = [];
// Filter out features that are not actually in buffer, since we got all points in the buffer's bounding box
for (var i = 0; i < features.length; i++) {
feature = features[i];
if(circle.contains(feature.geometry)){
inBuffer.push(feature.attributes[linefl.objectIdField]);
}
}
var query = new Query();
query.objectIds = inBuffer;
// Use an objectIds selection query (should not need to go to the server)
linefl.selectFeatures(query, FeatureLayer.SELECTION_NEW, function(features2){
var data = array.map(features, function(feature) {
return {
// property names used here match those used when creating the dgrid
"id": feature.attributes[LineoutFields[0]],
"TYPE": feature.attributes[LineoutFields[2]],
"WMA": feature.attributes[LineoutFields[3]],
"Label": feature.attributes[LineoutFields[4]],
"Name": feature.attributes[LineoutFields[5]]
};
});
alert(JSON.stringify(data));
var memStore = new Memory({
data: data
});
grid2.set("store", memStore);
});
}
// fires when a row in the dgrid is clicked
function selectLines(e) {
map.graphics.clear();
var fl2 = map.getLayer("LinePnts");
var query = new Query();
query.objectIds = [parseInt(e.target.innerHTML, 10)];
query.returnGeometry=true;
fl2.queryFeatures(query, function(results){
var gra = results.features[0].clone();
var symbol = new SimpleLineSymbol(
SimpleLineSymbol.STYLE_SOLID,
new Color([247,247,0,.9]),
5
);
gra.setSymbol(symbol);
map.graphics.add(gra);
});
}
// fires when a feature on the map is clicked
function selectlinefl(e) {
var id = e.graphic.attributes.OBJECTID;
// select the corresponding row in the grid
// and make sure it is in view
grid2.clearSelection();
grid2.select(id);
grid2.row(id).element.scrollIntoView();
}
... View more
09-05-2018
04:56 AM
|
0
|
18
|
3114
|
|
POST
|
OK I added my data calls into your example and it works....have to go back and figure out why my code is not working....considered this solved...
... View more
09-04-2018
10:04 AM
|
0
|
0
|
3114
|
|
POST
|
I am really perplexed....It appears that attributes are not being pushed into the buffer...I am definin 6 attributes and have those set in the outfields.....onyl 3 are bein pushed to the alert I set up When do this : alert(JSON.stringify(data)); I get this: missing attributes...0, 2 and 4 are coming through - 3, 5, and 6 are for some reason not coming through Any thoughts? var grid = new (declare([Grid, Selection]))({
bufferRows: Infinity,
loadingMessage: 'Loading data...',
noDataMessage: 'No results found.',
subRows:[
[
{field:"ID", label: "ID", rowSpan: 2},
{field:"TYPE", label: "TYPE"},
{field:"WMA", label: "WMA" }
],
[
{field:"Rotate_Val", label: "Rotate_Val"},
{field:"FG_Symbol", label: "FG_Symbol"},
{field:"Lat", label: "Lat"}
]
]
}, "grid");
grid.on(".field-ID:click", selectState);
// SNIP
WMAUrl = "https://xxxx/arcgis/rest/services/Projects/Locations/MapServer/2"";
outFields2 = ["OBJECTID", "ID", "TYPE", "WMA", "Rotate_Val", "FG_Symbol ", "Lat"]
var featureLayer = new FeatureLayer("https://xxxx/arcgis/rest/services/Projects/Locations/MapServer/2", {
id: "WMAs",
mode: FeatureLayer.MODE_SNAPSHOT,
outfields: ["*"],
visible: true
});
//SNIP
map.on("click", function(evt){
circle = new Circle({
center: evt.mapPoint,
geodesic: true,
radius: 1,
radiusUnit: "esriMiles"
});
map.graphics.clear();
var graphic = new Graphic(circle, circleSymb);
map.graphics.add(graphic);
var query = new Query();
query.geometry = circle.getExtent();
// Use a fast bounding box query. It will only go to the server if bounding box is outside of the visible map.
featureLayer.queryFeatures(query, selectInBuffer);
});
function selectInBuffer(response){
var feature;
var features = response.features;
var inBuffer = [];
// Filter out features that are not actually in buffer, since we got all points in the buffer's bounding box
for (var i = 0; i < features.length; i++) {
feature = features[i];
if(circle.contains(feature.geometry)){
inBuffer.push(feature.attributes[featureLayer.objectIdField]);
}
}
var query = new Query();
query.objectIds = inBuffer;
// Use an objectIds selection query (should not need to go to the server)
featureLayer.selectFeatures(query, FeatureLayer.SELECTION_NEW, function(results){
var data = array.map(features, function(feature) {
return {
// property names used here match those used when creating the dgrid
"ID": feature.attributes[outFields2[0]],
"TYPE": feature.attributes[outFields2[2]],
"WMA": feature.attributes[outFields2[3]],
"Rotate_Val": feature.attributes[outFields2[4]],
"FG_Symbol": feature.attributes[outFields2[5]],
"Lat": feature.attributes[outFields2[6]]
};
});
alert(JSON.stringify(data));
var memStore = new Memory({
data: data
});
grid.set("store", memStore);
});
}
... View more
09-04-2018
09:10 AM
|
0
|
1
|
3114
|
|
POST
|
Pretty puzzled...Can only get index 0 and 1 to return results....grid names same as code above, values exist in these fields...hmmmmm But for another day.
... View more
08-31-2018
01:22 PM
|
0
|
2
|
3114
|
|
POST
|
I was just merging two examples and then checked this....cool to see I was on the correct path and solution... I was literally just merging the below that you referenced above THANK YOU FOR YOUR HELP and conformation..... var data = array.map(features, function(feature) {
return {
// property names used here match those used when creating the dgrid
"id": feature.attributes[WMAoutFields[0]],
"TYPE": feature.attributes[WMAoutFields[1]],
"WMA": feature.attributes[WMAoutFields[2]],
"FG_Symbol": feature.attributes[WMAoutFields[3]]
};
});
var memStore = new Memory({
data: data
});
grid.set("store", memStore);
... View more
08-31-2018
11:55 AM
|
1
|
23
|
3114
|
|
POST
|
Yea thats sort of what I want....although I want to click an area, draw a buffer and then select the features within the buffer and return those results to the table. might have to piece a few examples together...just wondering if there was a simple one layer example there already maybe simply passing the selected features to the query fro the table?
... View more
08-31-2018
07:27 AM
|
0
|
25
|
3114
|
|
POST
|
Ideas on how to modify this example to return at least one attribute from the layers into an html DIV instead of the length or Count of selected features. ArcGIS API for JavaScript Sandbox Preferable I would like: 1. To return attributes values for each record into an HTML Div Tag. 2. Be able to select the graphic and highlight the table record 3. Be able to click the table record and highlight the feature in the map Anyone have a basic example of this? Click Map, Create Buffer for selection, Return results into controlled DIV tag, Have interaction between the map and the table of results.
... View more
08-31-2018
06:33 AM
|
0
|
27
|
6363
|
|
POST
|
Yea tried that...maybe missed one or two...figured it would work that way... I simply switched to Claro and changed the references...
... View more
07-26-2018
11:23 AM
|
0
|
0
|
1853
|
|
POST
|
Thanks....tried it with the "nihilo" and does not seem to work but have it working in the "claro"
... View more
07-26-2018
10:23 AM
|
0
|
2
|
1853
|
|
POST
|
I have been scouring the dojo sites, css sites, etc. I cannot find out where to set the text color properties of the Accordion Title text as seen in the image. I cannot seem to find where to set the Title of the Content Pane???? Thoughts? <div data-dojo-type="dijit.layout.ContentPane" data-dojo-props="region:'left'" class="shadow" id="leftPane">
<div id="IDAccordionPane" data-dojo-type="dijit.layout.AccordionContainer" style="color:black;">
<!-- 1st PANEL -->
<div id="idLayers" data-dojo-type="dijit.layout.ContentPane" data-dojo-props="title:'Legend'" >
<div data-dojo-type="dijit/layout/ContentPane" data-dojo-props="title:'Natural Disasters'">
</div>
</div>
<!-- 2nd PANEL -->
<div id="idLegend" data-dojo-type="dijit.layout.ContentPane" data-dojo-props="title:'Tools'" style="color:black;">
</div>
// snip
... View more
07-26-2018
09:10 AM
|
0
|
4
|
1953
|
|
POST
|
That seems to have done the trick....combining the on.load and function....although I dont understand why???? Thoughts? Thank you for your help....very much appreciated.
... View more
07-25-2018
10:41 AM
|
0
|
1
|
1888
|
|
POST
|
Think I got it...I changed the Map.onload from this to this...still testing...Dont know why this would matter but it seems like it is working. FROM THIS: map.on('load', Test());
function Test() {
alert("test");
} TO THIS: map.on('load', function () {
// SNIP
});
... View more
07-25-2018
10:34 AM
|
0
|
2
|
1888
|
| 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
|