|
POST
|
OK, this is what worked for me: <input id="taAddress" dojo-data-type="dijit/form/TextBox" placeHolder='Enter an Address, Place or ZIP' ></input>
... View more
10-08-2013
12:26 PM
|
0
|
0
|
3219
|
|
POST
|
I changed it back to value=. At least it shows the text I expect to see. I still can't come up with a way to clear it out. I'm getting confused about where I should define 'onClick' Something I read said I shouldn't put any of any event code in the definition, it should all go outside in the form of registry.byId('mydijit').on('click', function);
<input id="taAddress" dojo-data-type="dijit/form/TextBox" value='Enter an Address, Place or ZIP' ></input>
... View more
10-08-2013
12:06 PM
|
0
|
0
|
3219
|
|
POST
|
The string from the placeholder doesn't show up.
<input id="taAddress" dojo-data-type="dijit/form/TextBox" dojo-data-props="placeholder: 'Enter an Address, Place or ZIP.'"></input>
... View more
10-08-2013
08:00 AM
|
0
|
0
|
3219
|
|
POST
|
That sounded so promising, but no go. I'm getting a type error on my registry.byId('taAddress'), saying it's undefined. I have included "dijit/registry" and have another 'click' for a button right below this line that works just fine with registry.byId, so 'make sure you defined in' is not the issue. Shouldn't registry.byId work for all digits and if it's an html element like 'div', that's when you'd use dom.byId instead?
... View more
10-08-2013
07:30 AM
|
0
|
0
|
3219
|
|
POST
|
I have a textarea that starts out as <textarea data-dojo-type="dijit/form/Textarea" id="taAddress"/>Enter an Address, Place or ZIP.</textarea> I'd like for the user to be able to click on the phrase "Enter an Address, Place or ZIP", and have that automatically empty the textarea so the user can just start typing without having to delete the phrase already in there. I have a line which I've placed below my last function, but before the ending }); registry.byId("taAddress").on("click", clearTextInput('taAddress')); and here's my function: function clearTextInput (textFieldName) { var txtarea = registry.byId(textFieldName); txtarea.set("value", ""); } My problem is that this fires as the page is loading, not on the map click. I can see it starts out with my initial phrase, but then it clears itself, even before I have a chance to actually click in the textarea.
... View more
10-08-2013
06:53 AM
|
0
|
8
|
4434
|
|
POST
|
You mention both 'offline' and 'local shape files', both of which are basically deal breakers for using the web based APIs. Perhaps you would have more luck with something like ArcExplorer.
... View more
10-08-2013
06:12 AM
|
0
|
0
|
2002
|
|
POST
|
To begin with, I don't think there's supposed to be a backslash after 'MapServer' in my IdentifyTask definition.
... View more
10-08-2013
06:02 AM
|
0
|
0
|
1694
|
|
POST
|
That was it! I didn't think too much about that. It was right under my basemapGallery definition, so I just figured scaleBar needed startup as well.
... View more
10-08-2013
05:57 AM
|
0
|
0
|
611
|
|
POST
|
As mysteriously as it started, it stopped doing this. THEN when I made a copy of this project for another one and replaced mostly just my layers to be added and TOC layer, it's happening again. I'm noticing that not only is the basemap not loading, but the keyboard/mouse navigation I typically use (hold down the shift, draw a box to zoom in) isn't working either. Somewhere there's an issue with the map load event. Once I zoom around using the slider or the mouse wheel, I have a basemap from then on. I have noticed that with just panning, it still doesn't draw, I must zoom either in or out. I've tried firefox, ie and chrome. Same behavior and no errors in any of them! I haven't been using the basemap property too long for the map constructor and I only have a couple AMD style under my belt. I used to manually create a layer for the basemap and add it the same way I load all my local layers. It seems so handy to define it as part of the map definition, but if I'm going to have this strange behavior, maybe I shouldn't use it.
... View more
10-07-2013
01:04 PM
|
0
|
0
|
2014
|
|
POST
|
Personally I would like to at least see all the basemaps match to have the same thresholds. For whatever reason, the gray canvas background ends at 16, which is much farther out than the others!
... View more
10-07-2013
12:15 PM
|
0
|
0
|
866
|
|
POST
|
I have been using the TOC dijit for several projects now and it's really great! This is the first project I have with a layer that only displays once the user zooms closers. In my service, layer[0] are points drawn with a small gray dot. As the user zooms to a closer scale, these simple dots turn off and layer[1] takes over, drawing a more complex symbol, classifying these by type instead. I should mention that Layer [0] and Layer [1] reference the same data, the difference is in how they are symbolized and their scale thresholds. My issue is in how the TOC dijit behaves. The symbols for layer[1] never get loaded, I assume because this layer isn't visible at startup. However, it's recognizing it's there, because the check box does get created. I'm able to switch layer[1] on/off, but without the symbology to guide the user of what each symbol means on the map, it's not much good. I downloaded the most recent files back in August, so I think I'm working with the latest and greatest. Has this always been the behavior of this TOC? Is it a problem because layer[0] and layer [1] are referencing the same data? I'm tempted to try out the new scale dependent renderer that was released at 3.7, but I'm afraid that wouldn't play well with this dijit either.
... View more
10-07-2013
12:09 PM
|
0
|
0
|
853
|
|
POST
|
OK, I think this works:
function showIdentifyResults(idResults){
var results = [];
idResults = arrayUtil.filter(idResults, function (result) {//filter out any failed tasks
return idResults[0];
});
for (i=0;i<idResults.length;i++) { //combines identifyResults
var lyrResultLen = idResults.length;
var lyrResult = idResults;
for (j = 0; j < lyrResultLen; j++) {
var featRes = lyrResult ;
results.push(featRes);
}
}
formatResults = arrayUtil.map(results, function(result){
var feature = result.feature;
var layerName = result.layerName;
feature.attributes.layerName = result.layerName;
feature.setInfoTemplate(generateInfoTemplate);
generateInfoTemplate.setTitle("Layer Information");
return feature;
});
if (formatResults.length > 0) {
app.map.infoWindow.setFeatures(formatResults);
app.map.infoWindow.show(idPoint);
}
}
... View more
10-07-2013
07:51 AM
|
0
|
0
|
1925
|
|
POST
|
I discovered my showResults function doesn't work the way I intended. The first time I tried it, it was OK because each of my dynamicmapservicelayers only had one layer each in it. When I began adding additional dynamiclayers that had more than that, I realized I wasn't processing all the layers, only the first one. I need to loop through this differently not just use r[0], which obviously only grabs the first layer from each returned!:( I'm sure I need to check the length of r and loop do something with that, but I'm not sure if that goes within my arrayUtil. map or outside of it. It seems like results needs to be an array of all features from all layers of all processes, but I'm not sure how to get there. The only thing I know for certain is that I am seeing all the features I expect, I'm just not getting them in the format needed for defining my infoWindow.
function showIdentifyResults(idResults){
var results = [];
results = arrayUtil.map(idResults, function(r){
//loop here, something like for (i=0;i<rlength;i++??
var result = r[0]; // r might have one layer turned on, might have had several
var feature = result.feature;
var layerName = result.layerName;
generateInfoTemplate.setTitle("Layer Information");
feature.attributes.layerName = result.layerName;
feature.setInfoTemplate(generateInfoTemplate);
return feature;
if (results.length === 0) {
app.map.infoWindow.clearFeatures();
}
else {
app.map.infoWindow.setFeatures(results);
}
app.map.infoWindow.show(idPoint);
});
}
... View more
10-07-2013
05:39 AM
|
0
|
0
|
1925
|
|
POST
|
To me, the whole point of the example is that the infowindow contains a very complex graphic and you have to wait for it to generate before you can use it. In your example it looks like you're just executing a simple queryTask. I think you should be working from a queryTask example instead.
... View more
10-04-2013
08:07 AM
|
0
|
0
|
2753
|
|
POST
|
I needed to have an identify function that served double duty, running from either a map click or a geocoded point. I have a Boolean variable set 'idClick'. I needed this because a click event you need event.mapPoint to determine the geometry for the identifyParameters and geocoding returns geometry already. Then these lines in my initiating function
identifyTask = new esri.tasks.IdentifyTask(http://yourserver/ArcGIS/rest/services/serviceName/MapServer");
identifyParams = new esri.tasks.IdentifyParameters();
identifyParams.tolerance = 1; //
identifyParams.returnGeometry = false;
identifyParams.layerIds = [0,1,2];
identifyParams.layerOption = esri.tasks.IdentifyParameters.LAYER_OPTION_VISIBLE;
identifyParams.spatialReference = spatialReference;
identifyParams.extent = map.extent;
identifyParams.width = map.width;
identifyParams.height = map.height;
dojo.connect(map, "onClick", function () {idFromClick = true;});
dojo.connect(map, "onClick", executeIdentifyTask);
Here is the execute function
//identify either from map click or geocoded location
function executeIdentifyTask(evt) {
identifyParams.mapExtent = map.extent.expand(0.1);
identifyParams.geometry = evt; //input from address, evt is already a map point
var inputPt = evt;
if (idFromClick) { // input from map click
identifyParams.geometry = evt.mapPoint;
inputPt = evt.mapPoint;
}
var deferred = identifyTask.execute(identifyParams);
deferred.addCallback(function(response) {
return dojo.map(response, function(result) {
var feature = result.feature;
var layerName = result.layerName;
feature.attributes.layerName = result.layerName;
feature.setInfoTemplate(plainTemplate);
return feature;
});
});
map.infoWindow.setFeatures([ deferred ]);
map.infoWindow.show(inputPt); //point type is the same coming from either method
}
Last you need to call this function at the end of your geocoding results function
function showResults(candidates) {
var candidate;
var symbol = new esri.symbol.SimpleMarkerSymbol();
var addressTemplate = new esri.InfoTemplate("Location", "Address: ${address}<br />");
symbol.setStyle(esri.symbol.SimpleMarkerSymbol.STYLE_SQUARE);
symbol.setColor(new dojo.Color([255,0,0,0.75]));
dojo.every(candidates,function(candidate){
console.log(candidate.score);
if (candidate.score > 80) {
console.log(candidate.location);
var attributes = { address: candidate.address, score:candidate.score, pt:candidate.location };
geometryPt = candidate.location;
var graphic = new esri.Graphic(geometryPt, symbol, attributes, addressTemplate);
map.graphics.add(graphic);
var displayText = candidate.address;
map.infoWindow.show(geometryPt);
map.infoWindow.setTitle("Address");
return false; //break out of loop after one candidate with score greater than 80 is found.
}
});
map.centerAndZoom(geometryPt,12);
executeIdentifyTask(geometryPt);
}
}
... View more
10-04-2013
05:22 AM
|
0
|
0
|
522
|
| 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
|