|
POST
|
Have you tried graphic.attributes["<attribute field name>"] like this?
... View more
09-15-2015
11:06 AM
|
2
|
1
|
1108
|
|
POST
|
What you are trying can be achieved by using dojo/promise/all. I have made some changes to your code. make sure you add the require for all. //add geocoded address point to map with infoTemplate
function addPlaceGraphic(item, symbol) {
map.graphics.clear();
var place = {};
var attributes, infoTemplate, pt, graphic;
pt = item.feature.geometry;
place.address = item.name;
place.score = item.feature.attributes.score;
var trashQuery = runPWQuery(pt, trashLayer, "trash");
var yardQuery = runPWQuery(pt, yardWasteLayer, "yardwaste");
var recycleQuery = runPWQuery(pt, recyclingLayer, "recycling");
all([trashQuery, yardQuery, recycleQuery]).then(function(results){
//the resutls you get will be for all the 3 queries. use the response as per your requirements
//update the attributes here.
// Graphic components
attributes = { address: place.address, score: place.score, lat: pt.getLatitude().toFixed(2), lon: pt.getLongitude().toFixed(2) };
infoTemplate = new InfoTemplate("${address}", "Latitude: ${lat}<br/>Longitude: ${lon}"<br/>Score: ${score});
graphic = new Graphic(pt, symbol, attributes, infoTemplate);
// Add to map
map.graphics.add(graphic);
map.centerAt(pt);
});
}
//add featureLayers here
//run query against previously called FeatureLayers
function runPWQuery(in_geometry , in_fl , in_container_id) {
var query = new esri.tasks.Query();
query.returnGeometry = true;
query.outFields = ["*"];
query.geometry = in_geometry;
var promise = in_fl.queryFeatures(query, function(myresponse, io) {
var temp_val;
var values = [];
var tstr;
for (var il = 0; il < myresponse.features.length; il++) {
if (myresponse.features[il].attributes["MONDAY"] == "Yes") {
temp_val = "Monday";
}
else if (myresponse.features[il].attributes["TUESDAY"] == "Yes") {
temp_val = "Tuesday";
}
else if (myresponse.features[il].attributes["WEDNESDAY"] == "Yes") {
temp_val = "Wednesday";
}
else if (myresponse.features[il].attributes["THURSDAY"] == "Yes") {
temp_val = "Thursday";
}
else if (myresponse.features[il].attributes["FRIDAY"] == "Yes") {
temp_val = "Friday";
}
else {
//temp_val = "Other";
temp_val = myresponse.features[il].attributes["DESCRIPT"];
}
}
var statCount = myresponse.features.length;
if (statCount >= 1) {
$("#" + in_container_id).html(temp_val);
}
else {
$("#" + in_container_id).html("");
}
//return the value that needs to be displayed here
return temp_val;
}, function (error) {
console.log(dojo.toJson(error, true));
});
//return the promise
return promise;
}
... View more
09-15-2015
06:13 AM
|
0
|
1
|
1223
|
|
POST
|
If this is a query related to JavaScript API then you may want to post this in the right form, to get answers. Robert Scheitlin, GISPcould you please move this to the right form. What you asking should be possible, atleast for displaying. You should be able to create a JoinDataSource and create a FeatureLayer from it, here is the post which shows how to create a FeatureLayer from JoinDataSource. Re: Using join data source as source for feature layer However, I am not sure about if you could do editing on such layer. I have not try it.
... View more
09-09-2015
08:54 AM
|
0
|
2
|
1735
|
|
POST
|
In ArcGIS Server you can create your own print service with the custom templates. You will find more details here Tutorial: Publishing additional services for printing—Documentation (10.3 and 10.3.1) | ArcGIS for Server and then you can use the print dijit with it.
... View more
09-09-2015
07:28 AM
|
1
|
0
|
1444
|
|
POST
|
Hi Vish, Have you tried using the print task? PrintTask | API Reference | ArcGIS API for JavaScript it should be simpler to use this and you need not worry about the format. If you still need the details, I think it should be similar to the specification provided here. I agree with Vish the document is incomplete and inconsistent. If someone from ESRI and take a look at it and added the missing details, it would be really helpful.
... View more
09-09-2015
05:49 AM
|
0
|
0
|
823
|
|
POST
|
Ok, I finally got it working. The attributeInspector works on the selected features with in the FeatureLayer. so if you change the implementation like below the selected graphic will show up for editing. var query = new Query(); query.objectIds = [event.graphic.attributes.objectid]; appGlobals.citizenRequestLayer.selectFeatures(query, FeatureLayer.SELECTION_NEW).then(function(){ $.mobile.changePage("#ui-attributes-page", null, true, true); });
... View more
09-04-2015
10:11 AM
|
1
|
1
|
1903
|
|
POST
|
The objectid field for the used citizenRequestLayer is objectid as per Layer: Requests (ID: 0) you should use query.objectIds = [event.graphic.attributes.objectid];
... View more
09-04-2015
08:42 AM
|
0
|
3
|
1903
|
|
POST
|
the FeatureLayer queryFeatures is a Deffered method so the set on attributeInspector will be executed before the query is complete you need to change it like below. appGlobals.citizenRequestLayer.queryFeatures(query, function (featureSet) {
if (featureSet.features.length > 0) {
currentFeature = featureSet.features[0];
}
}).then(function(){
attributeInspector._currentFeature = currentFeature;
});
... View more
09-04-2015
08:15 AM
|
0
|
5
|
1903
|
|
POST
|
If you are using Popup then you can use the markerSymbol
... View more
09-04-2015
06:03 AM
|
0
|
0
|
969
|
|
POST
|
Also when you are listening for an event. It will continue to listen till you remove it or the object is destroyed. In your case lyrParcels selection-complete event. If you want it to execute one time then you should use on.once or remove the handler after if has executed.
... View more
09-03-2015
01:28 PM
|
1
|
2
|
1999
|
|
POST
|
I found something, l feel it is wrong. Please verify the same. In the below code you are setting the queryParcels.geometrty = qPoint. shouldn't you be using qPoly. if (s.activeSource.name == "Search by PID") { //console.log(evt); qPoly = evt.result.feature.geometry; ///qPoint = evt.result.extent.getCenter(); //console.log("qPoint Parcel: "); //console.log(qPoint); var queryParcels = new Query; queryParcels.geometry = qPoint; var parQuery = lyrParcels.selectFeatures(queryParcels, FeatureLayer.SELECTION_NEW); console.log(parQuery);
... View more
09-03-2015
01:13 PM
|
1
|
2
|
1999
|
|
POST
|
The symbol has some kind of offset on it so it is showing at that offset distance. esri.symbol.PictureMarkerSymbol("images/mylocation5.png", 17, 32).setOffset(18, 27)
... View more
09-02-2015
10:59 AM
|
1
|
0
|
1415
|
|
POST
|
I am not sure why you are doing the query twice, may be for selection. In any case I made some changes yo your implementation. I believe the app.alertFeatureGeometry is not being set properly and this what I usually do, I append the geometry along with the attributes and pass it to dgrid, this I will be able to get access to the geometry on click event. see if this helps you. PS: Make sure the dgrid is not showing the geometry column. 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){
//changed here to create a clone and merge the geometry to the data source
var clone = lang.clone(feature.attributes);
return lang.mixin( clone, { geometry : feature.geometry });
});
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(row.data.geometry); //changed to used row 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
09:15 AM
|
0
|
1
|
1625
|
|
POST
|
The dojo/on does not return a promise so, cannot use .then. Try changing that and see if it works.
... View more
09-02-2015
08:41 AM
|
0
|
3
|
1625
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 03-24-2017 07:15 AM | |
| 1 | 09-13-2016 06:27 AM | |
| 1 | 05-21-2015 08:06 AM | |
| 1 | 12-16-2015 05:43 AM | |
| 1 | 07-20-2015 09:33 AM |
| Online Status |
Offline
|
| Date Last Visited |
05-13-2026
09:55 AM
|