POST
|
Thanks Jonathan, It turns out that this tool uses the map.graphics layer to draw its markers, etc. I had a click handler on that layer that was interfering so I moved all my stuff to my own graphics layer and the measure tool works fine now.
... View more
10-15-2014
05:38 AM
|
0
|
0
|
207
|
POST
|
Sorry, I think I missed something from your original post. You're saying that your process is that the user defines a query which set your s, a, r, and p value. I'm assuming that you're getting your data fine and getting the infoWindow to show what you want is the sticking point. This combines your sample and mine:
require([ "dijit/form/select", "esri/InfoTemplate" /* , other requires... */],
function( Select, InfoTemplate /*, other requires... */){
// roughing in some structure
var s = new Select(params,srcNodeRef); // Our census options <-- updated
var a = new Select(params,srcNodeRef); //
var r = new Select(params,srcNodeRef); //
var p = new Select(params,srcNodeRef); //
var map = new Map(etc);
var qt = new QueryTask(etc);
map.on("click", function(evt){
// init query
map.infoWindow.clearFeatures(); // why not
qt.execute();
map.infoWindow.show(evt.mapPoint);
});
qt.on("complete", function(results){ // <-------------------------- the important part
// Build a collection of features with template assigned
var features = array.map(featureSet.features, function(f){
var infoTpl = new InfoTemplate("Results", "Results not available");
if (s.value==="male" && a.value==="allage" && r.value==="white" && p.value==="bpov"){ // <-- updated
var maxval=1236;
var field="WBPME_Tota";
infoTpl.setTitle("<b>White Male Below Poverty</b>");
infoTpl.setContent("<b>Count: </b>${WBPME_Tota}");
} else if (s.value==="mandf" && a.value==="allage" && r.value==="allrace" && p.value==="bpov"){
var maxval=100;
var field="Mpoverty";
infoTpl.setTitle("<b>Total Poverty (all ages) )</b>");
infoTpl.setContent("<b>Count: </b>${MFpoverty}");
}
// The default template is handling this now
if(f.attributes[field] === null){
// Results not available
} else if(f.attributes[field] == 0){
// Results not available?
// They are, they're just 0, but that's your business
infoTpl.setContent("Count: 0");
}
f.setTemplate(infoTpl);
return f;
});
map.infoWindow.setFeatures(features);
});
});
... View more
08-22-2014
08:32 AM
|
0
|
1
|
779
|
POST
|
For clarity, your process is something like: - user picks a database field of interest - census stuff from the sournds of it, one of avg age, %male, population, etc - user clicks map to query census track Code then looks more like:
require([ "dijit/form/select" /* , other requires... */],
function( Select /*, other requires... */){
// roughing in some structure
var fieldList = new Select(params,srcNodeRef); // Our list of fields
var map = new Map(etc);
var qt = new QueryTask(etc);
map.on("click", function(evt){
// init query
// ...
map.infoWindow.clearFeatures(); // why not
qt.execute();
map.infoWindow.show(evt.mapPoint);
});
qt.on("complete", function(results){ // <-------------------------- the important part
// Set default template
var template = "Results not available";
// Assign different template based on what field is selected in list
switch(fieldList.value){ // or if statements
case "POP" : template = "POP: ${POP}"; break;
case "SEX" : template = "SEX: ${SEX}"; break;
case "AGE" : template = "AGE: ${AGE}"; break;
default:
// already defined, but you could do more
}
// Build a collection of features with template assigned
// Probably only one response but handling more
var features = array.map(featureSet.features, function(f){
f.setTemplate(template);
return f;
});
map.infoWindow.setFeatures(features);
});
});
... View more
08-22-2014
08:00 AM
|
0
|
3
|
779
|
POST
|
If you look at this ESRI demo you'll see something similar (assuming I understand the question). ArcGIS API for JavaScript Sandbox The key part is this:
//display the query results
var content = "";
if(results.length > 0){
content = "Population = " + results[0].value.features[0].attributes.SUM;
}else{
content = "No Results Found"
}
window.map.infoWindow.setContent(content);
... View more
08-22-2014
04:34 AM
|
0
|
5
|
779
|
POST
|
See the wfs spec: Web Feature Service | OGC WFS returns XML. WFS can return data in a number of formats using the output_type parameter, at least in geoserver. I see another post on the forum today about json output. There's a flavour of WFS called WFS-Transational (WFS-T) that allows CrUD operations. Boundless : Developing OGC Compliant Web Applications with GeoExt : 3.3. Committing Feature Modifications Over WFS-T
... View more
08-21-2014
08:27 AM
|
0
|
0
|
249
|
POST
|
This has kind of worked for me (taken from an older forum post by Joanne McGraw that I can't find):
var geocoders = [{
url: "some/geocoder",
name: "EC Geocoder",
singleLineFieldName: "SingleLine",
suffix: ", CA" // Canada <-------------------------
}];
var geocoder = new Geocoder({
map: map,
geocoders: geocoders,
arcgisGeocoder: false,
autoComplete: true
}, dojo.create('div'));
I've also have tried keeping a polygon of the country of origin handy, and filtering the Geocoder results using Polygon.contains(point) for a client-side check.
... View more
08-21-2014
08:23 AM
|
0
|
0
|
184
|
POST
|
Which is completely valid. If round trips are our metric then for Christians problem, given N polygons, both solutions run in O(1) time. But, using the geometry service means 125 lines of code that don't need to be maintained. Using the API where the functionality exists is what I would try first, knowing that I could push that work to the client if that union call looked to be a hang-up in my process.
... View more
08-19-2014
11:46 AM
|
0
|
2
|
1264
|
POST
|
It's a good idea, but there's a pre-made union provided by the GeometryService: geometryservice-amd | API Reference | ArcGIS API for JavaScript My first thought was a loop to add the rings to one polygon as well.
... View more
08-19-2014
11:03 AM
|
0
|
4
|
1264
|
POST
|
Do you need a service to test on? If you have arcgis server then you can simple 'turn on' wms/wfs when you publish a service. If you have a WMS in mind and just want to make use of it then you can look at wmslayer-amd | API Reference | ArcGIS API for JavaScript for the details.
... View more
08-14-2014
07:19 AM
|
0
|
0
|
529
|
POST
|
You'll need the geometryService: geometryservice-amd | API Reference | ArcGIS API for JavaScript This will get you geometries and you can update/create your features for saving as required. Here's how I've done this. Split: - Start with a selected polygon (know what you're splitting) - Use the draw toolbar to get a line (onDrawEnd Event) - I use the GeometryService->trimExtend to make sure the line will cut completely - Use geometryService->cut([selectedPoly], newLine, ...) to get two new polys - save the new polys (add two new and delete old, or whatever works for your data) Merge - Select multiple polygons - geometryService->union([selectedPolys]) to get one poly - save the new poly (delete the old, add new, etc). I haven't touched on managing the attributes, but that shouldn't be bad once you have the geometries:
... View more
08-13-2014
10:49 AM
|
3
|
0
|
2169
|
POST
|
It looks like you're on the right track. I moved where you return your promise:
function GetDatabaseValue(_newcity) {
var def = new Deferred();
var c = _newcity;
var qTask = new QueryTask("http://localhost:6080/arcgis/rest/services/ggov_DatabaseValues/MapServer/2");
var QT = new Query();
QT.returnGeometry = false;
QT.outFields = [
"CityName", "Html", "Picture", "Link", "Extent"
];
QT.where = "CityName = '" + c + "'";
qTask.execute(QT, function (results) {
//console.log(results);
var CityExtent;
var resultItems = [];
var resultCount = results.features.length;
for (var i = 0; i < resultCount; i++) {
var featureAttributes = results.features.attributes;
for (var attr in featureAttributes) {
if (attr == "Extent") {
CityExtent = featureAttributes[attr];
//console.info(CityExtent + " GetDatabaseValue");
}
}
}
def.resolve(CityExtent);
// REMOVE --> return def.promise;
}); //End of function results
return def.promise; // <------ ADD
} // End Function GetDatabaseValue()
... View more
08-08-2014
07:31 AM
|
0
|
1
|
292
|
POST
|
If you're using someone elses basemaps then I think you're stuck to their zoom levels (no fractional zoom supported). If you don't define a basemap, or you roll your own basemap, then I think you can choose your own Levels of Detail (see map.LOD in API doc).
... View more
08-07-2014
11:50 AM
|
1
|
3
|
822
|
POST
|
You can run each Identify individually and append their results to your infoWindow, so no need to synchronize. I haven't tested as a whole, key part on line 12:
function handleIdentify(/*IdentifyResult*/ results){
var features = [];
// deal with results, set up templates, etc.
// . . .
// populate features as required
// Get the features currently in your infoWindow
var existingFeatures = map.infoWindow.features || [];
// Append the latest result set
map.infoWindow.setFeatures(existingFeatures.concat(features)); // <-- key part
}
function handleErrror(err){
// . . .
}
// Your many service URLs
var serviceUrls = [
"http://service1/",
"http://service2/",
"http://service3/",
];
// for each URL
for(n in services){
// create a new task
var identify = new IdentifyTask(serviceUrls );
// set the params as needed
var identifyParams = new IdentifyParameters();
// Execute the task
identify.execute(identifyParams, handleIdentify, handleError);
}
map.infoWindow.show(somePoint);
... View more
08-07-2014
11:45 AM
|
1
|
0
|
590
|
POST
|
The usual workflow is to print what you see but this can be done. The print task accepts a map object. Set the scale on that map object (I'd set your dropdown list to the zoom levels that your map supports) and then call your print task. You could try a workflow like this: - click print button - show print dialog, print button disabled - Set scale ---> map updates ---> enable print button The map on you screen is your 'print preview' more or less.
... View more
08-07-2014
11:28 AM
|
1
|
5
|
822
|
Title | Kudos | Posted |
---|---|---|
1 | 02-02-2015 11:33 AM | |
1 | 07-07-2015 05:08 AM | |
1 | 12-29-2014 04:59 AM | |
1 | 02-02-2015 11:22 AM | |
1 | 07-09-2015 04:44 AM |
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|