|
POST
|
I tried \n already, but that didn't work. I also tried \r\n, but nothing. It just prints them as characters. I also tried <br>.
... View more
09-09-2015
02:13 PM
|
0
|
0
|
2240
|
|
POST
|
Is it possible to create a stacked textSymbol? If so, what is the syntax for the linebreak?
... View more
09-09-2015
02:02 PM
|
0
|
7
|
5388
|
|
POST
|
I see what I did wrong. You have to have some outFields specified in your FeatureLayer definition or this doesn't work. I always think the default is outFields:['*'], but the default is no fields get returned. app.bufferLayer = new FeatureLayer(config.pathName + "/arcgis/rest/services/DPS/VetComm_bufferAnalysis/FeatureServer/0" ,{ id:"bufferLayer", outFields:['*'] } )
... View more
09-09-2015
01:21 PM
|
1
|
0
|
970
|
|
POST
|
I have featureLayer that is loaded as a FeatureServer so I can add features to it. Adding to the featureLayer through applyEdits adds graphics to this layer. I'd also like this layer to be a source for my LabelLayer, so the features I'm adding have a label based on CITY attribute I'm populating. When I first add the feature to my layer, the text label appears as expected. However, once I pan, the label changes from the CITY attribute to appearing as 'undefined'. The CITY attribute is present in layer, I can see it in ArcCatalog, so I know it has values. app.bufferLayer = new FeatureLayer(config.pathName + "/arcgis/rest/services/bufferAnalysis/FeatureServer/0" ,{
id:"bufferLayer"}
)
var textColor = new Color("#FF0000");
var cityText = new TextSymbol();
cityText.setColor(textColor);
cityText.font.setSize("7pt");
var cityLabelRenderer = new SimpleRenderer(cityText);
cityLabelLayer = new LabelLayer({
id: "cityLabels"
});
cityLabelLayer.addFeatureLayer(app.bufferLayer, cityLabelRenderer, "${CITY}");
app.map.addLayers([featureLayer,cityLayer,app.bufferLayer,app.graphicsLayer,cityLabelLayer]); The is based on the example Select with Feature Layer | ArcGIS API for JavaScript , but instead of just a graphic added to the map, I want to save the circle I'm generating, along with the summary statistics as a new feature in my featureLayer. It seems like my edits are getting applied, but I don't understand why the labels first appear, then disappear. Is this not a valid use of labelLayer?
... View more
09-09-2015
01:07 PM
|
0
|
1
|
3533
|
|
POST
|
It's interesting you should mention IdentifyTask, because that was the example I was referring to when I went looking too. I think there's been a little too much housecleaning going on. Besides having to know that the samples are in the older SDKs that you must download, you'd have to have an idea of which version to go back to. I imagine most people would give it up as a lost cause before they got very far.
... View more
09-08-2015
08:56 AM
|
1
|
1
|
2312
|
|
POST
|
My layer is initially turned off, but I have a TOC that lets the user change it. I notice that it consistently finds the points I expect once the layer is turned on. I wouldn't expect the visibility to make a difference on whether or not queryFeatures works.
... View more
09-02-2015
02:45 PM
|
0
|
0
|
1734
|
|
POST
|
I don't typically return the geometry from a query that's populating a grid. Somehow I didn't think it would be retained as part of the row object. I have the other query because I don't see how else I'm going to display the infoTemplate for the feature. Maybe you typically go about this some other way. I added returnGeometry from my initial query, but I'm not still getting any results from app.staffLayer.queryFeatures(cirquery,lang.hitch(this, function(response){ The length of the response is always 0. All my layers are in wkid 102100. At first I thought I wasn't getting anything because I my spatialReferences didn't go together, but the coordinates all look to match up. I'm going to try to post something for people to look at. The initial project contains sensitive data, which is all secured.
... View more
09-02-2015
09:34 AM
|
0
|
0
|
1734
|
|
POST
|
I changed it around, but I still have no results from querying my circle's extent. I don't have these features turned on when I run the query, but I didn't think that would matter. I notice when I run it a 2nd time, I will sometimes get results when I didn't before. I'm not getting an error, but still no results, updateAlertGrid: function(){
var queryParams = new Query();
queryParams.geometry = app.currentExtent;
queryParams.spatialRelationship = Query.SPATIAL_REL_CONTAINS;
queryParams.outFields = ["*"];
queryParams.outSpatialReference = app.spatialReference;
var queryTask = new QueryTask(app.alertLayer.url);
queryTask.on('error', queryErrorHandler);
queryTask.execute(queryParams, lang.hitch(this, updateGridHandler));
function updateGridHandler(results){
var data = [];
if (app.alertGrid) {
app.alertGrid.refresh();
}
data = arrayUtils.map(results.features, function(feature){
return feature.attributes;
});
var currentMemory = new Memory({
data: data,
idProperty: 'ESRI_OID'
});
app.alertGrid.set("store", currentMemory);
app.alertGrid.sort('FlagStatusCode');
app.alertGrid.on('.dgrid-row:click', function(event){
var row = app.alertGrid.row(event);
var gridQuery = new Query();
gridQuery.objectIds = [row.data.ESRI_OID];
app.alertLayer.selectFeatures(gridQuery, FeatureLayer.SELECTION_NEW, function(results){
if (results.length > 0) {
app.alertFeature = results[0];
app.alertFeature.setInfoTemplate(app.alertTemplate);
// map.centerAndZoom(results[0].geometry,14);
var resultGeometry = results[0].geometry;
app.map.infoWindow.setFeatures(results);
app.map.infoWindow.show(resultGeometry);
}
else {
console.log("error in grid.on click function");
}
});
});
on(app.alertGrid, ".dgrid-cell:click", function(evt){
var cell = app.alertGrid.cell(evt);
var col = cell.column;
//var row = cell.row;
if (col.field === 'staff') {
// console.log("you clicked the staff cell");
findStaffbyLocation(app.alertFeature.geometry);
}
});
}
function queryErrorHandler(err){
console.log("error in queryTask is " + err.error);
}
//functions for finding staff near an address
function findStaffbyLocation(geom){
var circle = new Circle({
center: geom,
geodesic: true,
radius: 25,
radiusUnit: "esriMiles"
});
var circleSymb = new SimpleFillSymbol(SimpleFillSymbol.STYLE_NULL, new SimpleLineSymbol(SimpleLineSymbol.STYLE_SHORTDASH, new Color([105, 105, 105]), 2), new Color([255, 255, 0, 0.25]));
var graphic = new Graphic(circle, circleSymb);
app.map.graphics.add(graphic);
app.map.setExtent(circle.getExtent());
var cirquery = new Query();
cirquery.geometry = circle.getExtent();
// app.staffLayer.queryFeatures(cirquery);
app.staffLayer.queryFeatures(cirquery,lang.hitch(this, function(response){
var feature;
var features = response.features;
app.inBuffer = [];
//started with extent,now filter out features that are not actually within buffer
for (var i = 0; i < features.length; i++) {
feature = features;
if (circle.contains(feature.geometry)) {
app.inBuffer.push(feature.attributes.ESRI_OID);
}
}
var query = new Query();
query.objectIds = app.inBuffer;
var staffList = [];
app.staffLayer.selectFeatures(query, FeatureLayer.SELECTION_NEW, function(results){
arrayUtils.forEach(results, function(feature){
staffList.push(feature.attributes.Contact_FirstName + " " + feature.attributes.Contact_LastName );
});
alert("Staff near selected server: " + staffList);
});
}));
}
}
... View more
09-02-2015
08:49 AM
|
0
|
2
|
1734
|
|
POST
|
What have you tried already? Any supported PictureMarkerSymbol should work in place of the example. The one's ESRI provides are just handy and scale well to expand for larger numbers. If you're looking for assistance on PictureMarkerSymbols and SVG, you could see if this thread helps: Creating PictureMarkerSymbols with raw SVG tags or with Dojo GFX
... View more
09-02-2015
08:19 AM
|
0
|
0
|
1478
|
|
POST
|
I have two layers. I want to query staffLayer based on the a buffer of a selected feature in alertLayer. I am looking at Select with Feature Layer | ArcGIS API for JavaScript for an example. The difference is I don't want a map click, I want to select the feature in alertLayer based on a row in a grid. I'm getting a feature from alertLayer with my grid click. I then need to buffer it, then use that buffer as the input geometry for a Query on staffLayer. I am getting as far as generating a circle based on the selected row, which draws in the correct location. However, I'm never getting any features found in that circle, even though I see there are several in the vicinity that should be returned. I have changed this around several times, and I know I have a scope problem with the sequence of what I'm trying to do. I started out with something more straight forward, but changed to more a lang.hitch type of syntax, which I'm still getting the hang of. I'm getting the error Uncaught TypeError: app.staffLayer.on(...).then is not a function updateAlertGrid: function(){
var queryParams = new Query();
queryParams.geometry = app.currentExtent;
queryParams.spatialRelationship = Query.SPATIAL_REL_CONTAINS;
queryParams.outFields = ["*"];
queryParams.outSpatialReference = app.spatialReference;
var queryTask = new QueryTask(app.alertLayer.url);
queryTask.on('error', queryErrorHandler);
queryTask.execute(queryParams, lang.hitch(this, updateGridHandler));
function updateGridHandler(results){
var data = [];
if (app.alertGrid) {
app.alertGrid.refresh();
}
data = arrayUtils.map(results.features, function(feature){
return feature.attributes;
});
var currentMemory = new Memory({
data: data,
idProperty: 'ESRI_OID'
});
app.alertGrid.set("store", currentMemory);
app.alertGrid.sort('FlagStatusCode');
app.alertGrid.on('.dgrid-row:click', function(event){
var row = app.alertGrid.row(event);
var gridQuery = new Query();
gridQuery.objectIds = [row.data.ESRI_OID];
app.alertLayer.selectFeatures(gridQuery, FeatureLayer.SELECTION_NEW, function(results){
if (results.length > 0) {
app.alertFeature = results[0];
app.alertFeature.setInfoTemplate(app.alertTemplate);
// map.centerAndZoom(results[0].geometry,14);
var resultGeometry = results[0].geometry;
app.map.infoWindow.setFeatures(results);
app.map.infoWindow.show(resultGeometry);
}
else {
console.log("error in grid.on click function");
}
});
});
on(app.alertGrid, ".dgrid-cell:click", function(evt){
var cell = app.alertGrid.cell(evt);
var col = cell.column;
//var row = cell.row;
if (col.field === 'staff') {
// console.log("you clicked the staff cell");
findStaffbyLocation(app.alertFeature.geometry);
}
});
}
function queryErrorHandler(err){
console.log("error in queryTask is " + err.error);
}
//functions for finding staff near a server alert
function findStaffbyLocation(geom){
var circle = new Circle({
center: geom,
geodesic: true,
radius: 50,
radiusUnit: "esriMiles"
});
var circleSymb = new SimpleFillSymbol(SimpleFillSymbol.STYLE_NULL, new SimpleLineSymbol(SimpleLineSymbol.STYLE_SHORTDASH, new Color([105, 105, 105]), 2), new Color([255, 255, 0, 0.25]));
var graphic = new Graphic(circle, circleSymb);
app.map.graphics.add(graphic); //circle is added correctly around the selected row
app.map.setExtent(circle.getExtent());
var query = new Query();
query.geometry = circle.getExtent();
app.staffLayer.queryFeatures(query);
app.staffLayer.on( 'query-features-complete', lang.hitch(this, function(response){ //there are never any features found here
var feature;
var features = response.features;
var inBuffer = [];
//started with extent,now filter out features that are not actually within buffer
for (var i = 0; i < features.length; i++) {
feature = features;
if (circle.contains(feature.geometry)) {
inBuffer.push(feature.attributes[ESRI_OID]);
}
}
})).then(function(){
var query = new Query();
query.objectIds = inBuffer;
var staffList = [];
app.staffLayer.selectFeatures(query, FeatureLayer.SELECTION_NEW, function(results){
arrayUtils.forEach(results, function(feature){
staffList.push(feature.attributes.Contact_FirstName + " " + feature.attributes.Contact_LastName + "</br>");
});
alert("Staff near selected server: " + staffList);
});
});
}
}
... View more
09-02-2015
08:10 AM
|
0
|
6
|
4270
|
|
POST
|
Yes, that did give me a result, but then I wasn't able to get row or cell information from it, it was like a generic mouse event. Maybe I didn't dig deep enough, but I wasn't seeing it. You'd think you'd get something similar to dgrid-cell:click.
... View more
09-01-2015
01:24 PM
|
0
|
1
|
2395
|
|
POST
|
That should work with modification. I see no reason to have to click the header, but I can see with just a .dgrid-cell:click that I can check the field to see if it is = staff on( app.alertGrid, ".dgrid-cell:click", function(evt){ var cell = app.alertGrid.cell(evt); var col = cell.column; if (col.field == 'staff'){ console.log("you clicked the staff cell");} });
... View more
09-01-2015
01:00 PM
|
0
|
1
|
2395
|
|
POST
|
I have a grid that has a row click that opens the infoTemplate: createAlertGrid: function(){
var alertColumns = [
{
field: "FlagStatusDescription",
label : "Status",
formatter : function (value) {
return value;
},
get : function (obj) {
if(obj.FlagStatusDescription === "Unavailable"){
return "<img src='images/unavailable.png' alt='unavailable image' style='width:18px;height:18px'/>";
}else if(obj.FlagStatusDescription === "Issue"){
return "<img src='images/issue.png' alt='issue image' style='width:18px;height:18px'/>";
} else {
return "<img src='images/maintenance.png' alt='maintenance image' style='width:18px;height:18px'/>";
}
return obj.FlagStatusDescription;
}
}, {
field: 'alert',
label: 'Description',
renderCell: function(obj){
var template = '<div class="gridTitle gridInfo">Server Id: ${0}</div><div class="details gridInfo">${1}</div> <div class="details gridInfo">City: ${2}</div> <div class="details gridInfo">Status: ${3}</div>';
return domConstruct.create("div", {
innerHTML: dojoString.substitute(template, [obj.Server_ServerName, obj.ServerTypeDescription, obj.EntityLocationCity, obj.FlagStatusDescription])
});
}
}, {
field: 'staff',
label: 'Nearby Staff',
formatter: function (value){
return value;
},
get : function (obj){
return "<img src='images/pin_blue.png' alt='staff image' style='width:18px;height:18px'/>";
}
}
];
app.alertGrid = new (declare([OnDemandGrid, Selection, Keyboard]))({
columns: alertColumns
}, "alertGridDiv");
app.alertGrid.startup();
return app.alertGrid;
}
Besides clicking on the row, I'd also like to have allow the user to click in the 'Nearby staff" column to execute a search when they click specifically in that cell'. I thought I could add an additional click event on dgrid-cell, but I must not have the right event. app.alertGrid.on('.dgrid-cell.field-staff:click', function (evt){
console.log("you clicked the staff icon");
}); I've also tried .dgrid-content .field-staff:click .dgrid .field-staff:click .dgrid-cell .field-staff:click .dgrid-row .field-staff:click .dgrid-row.field-staff:click Can I not overlap events like this (both on the row and an individual cell) or do I just have the wrong element?
... View more
09-01-2015
12:19 PM
|
0
|
6
|
5947
|
|
POST
|
I believe they went from being 'hard to find' to 'gone'. I know they were getting dated, but if it weren't for the fact that I saved a few for my own use, I'd be lost. I'm working through something right now that used to be an example. Luckily I had my own version I'd created a year or so ago. ESRI - please don't assume just because examples are old and dated they are useless. Even if they aren't the latest and greatest, there were techniques that I continued to use that are now gone. Can't you make an archive version or something?!
... View more
08-31-2015
01:43 PM
|
0
|
0
|
2312
|
|
POST
|
Exactly. It's for another agency, so they'll host it on their server and point to services on our GIS server. Typically we host our own maps, but this is actually an application that has just a little bit of GIS to it, embedded within a .NET app. (I didn't know how possible that would be, but it turns out there's not much to it.).
... View more
08-28-2015
12:02 PM
|
0
|
0
|
4036
|
| 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
|