POST
|
I finally figured it out. I was using a bad Extent object as an initial extent for my map:
// This is entirely the WRONG way to declare an extent
var startExtent = new esri.geometry.Extent({
xmin: -107.62971356312966,
ymin: 25.850355124455604,
xmax: -92.35392362656452,
ymax: 36.59093275985384,
spatialReference: {
wkid: "4269"
}
});
myMap = new esri.Map("mapDiv", {
extent: startExtent,
logo: false,
slider: false
}); I don't know where I got that extent format from, but it's wrong and using that format will mess with your application, particularly IdentifyTask in my case. Use the following format instead, as per the JS API:
startExtent = new esri.geometry.Extent(-101.120185812004, 34.39538449192201, -100.983017186634, 34.49182927651549, new esri.SpatialReference({
wkid: 4269
})); Thanks for reading.
... View more
02-25-2011
09:46 AM
|
0
|
0
|
277
|
POST
|
Wow, hzhu, that really is wacky. I hoped that what you said was the problem with my code: task.execute(params);
dojo.connect(task, "onComplete", function(idResults) {
identifyInfoWin(idResults, evt);
// Hide the loading bar when a result is found
});
dojo.connect(task, "onError", function(err) {
console.log("doIdentify: (" + err.name + ") " + err.message);
}); Unfortunately, I still get the same error under the same circumstances.
... View more
02-25-2011
08:19 AM
|
0
|
0
|
277
|
POST
|
What you can do to further customize the map's InfoWindow is to tie the content of the InfoWindow to a DOM object (such as a <div> in your page) instead of using the InfoTemplate. So, for instance, you have this in your init():
myMap.infoWindow.resize(300, 200);
myMap.infoWindow.setContent(dijit.byId("infowinID").domNode);
dojo.connect(myMap.infoWindow, "onShow", function() {
dijit.byId("infowinID").resize();
}); And in your .html file, you have the following: <div id="infowinID" dojoType="dijit.layout.ContentPane" title="Something">
<img src="/your/path/toAnImage.png" alt="asdf" />
</div> To stop scrollbars from appearing, maybe you'd have something like the following in your CSS: #infowinID {
overflow: hidden;
} Personally, I find that the InfoTemplate is a quick and easy way to show content inside of an InfoWindow, but you lose a lot of customization as a tradeoff.
... View more
02-24-2011
01:19 PM
|
0
|
0
|
535
|
POST
|
When I try to identify a feature, the IdentifyTask's execute function is invoking an error that simply contains the message "Unable to complete operation." The strange thing is, this identify function works as it should when I use it at either the map's full extent or a specific extent of a feature (when I zoom to a feature via the results in a Datagrid), but once I pan the map even slightly out of that specific extent, the IdentifyTask throws that error. My code is listed in the following. It's a loose interpretation of the "Identify features on a map" sample provided by ArcGIS. doIdentify = function(evt) {
// Hide the previous results
myMap.infoWindow.hide();
var task = null;
var params = null;
task = new esri.tasks.IdentifyTask(url.baseMap);
params = new esri.tasks.IdentifyParameters();
params.tolerance = 4;
params.returnGeometry = true;
params.layerIds = [3, 4, 5, 6];
params.layerOption = esri.tasks.IdentifyParameters.LAYER_OPTION_ALL;
params.width = myMap.width;
params.height = myMap.height;
params.geometry = evt.mapPoint;
params.mapExtent = myMap.extent;
task.execute(params, function(idResults) {
identifyInfoWin(idResults, evt);
}, function(err) {
console.log("doIdentify: (" + err.name + ") " + err.message);
});
}; I consider myself well-acquainted with the ArcGIS JS API, but I have been staring at this problem for much too long without seeking help. Thanks in advance
... View more
02-24-2011
01:10 PM
|
0
|
4
|
920
|
POST
|
Thank you crombezk for pointing out the existence of a ToggleButton dijit! I have been using a very crude way of displaying the active tool on the toolbar before I saw your solution. It looks much more elegant now. By the way, as per the Dojo API for this dijit, you only need to import the dijit.form.Button class to get the ToggleButton. You do not have to import that class alone.
... View more
02-17-2011
12:41 PM
|
0
|
0
|
283
|
POST
|
Thank you for the suggestion, hzhu. My solution ended up being like this: var epoch = new Date(attr.Date); inputStr += (epoch.getMonth() + 1) + "/" + (epoch.getDate() + 1) + "/" + epoch.getFullYear(); It ended up being Unix Epoch time (seconds since January 1, 1970).
... View more
02-01-2011
01:23 PM
|
0
|
0
|
4202
|
POST
|
Make your own function that saves the map's current extent to a variable. myMap.extent.xmin
myMap.extent.ymin
myMap.extent.xmax
myMap.extent.ymax You can probably pass these through a query string. For example: http://yourdomain.com/maps/yourmap.htm?xmin=1234&xmax=1234&ymin=1234&ymax=1234
... View more
01-27-2011
11:52 AM
|
0
|
0
|
169
|
POST
|
For my web application, I have a FeatureSet that returns the attribute table of a feature layer, and in that table, there is a date field (esriFieldTypeDate) that I must print. However, when I try that, I get an 11- to 12-digit integer instead of the typical MM/DD/YYYY date string. The strange thing is, when I use the Query Related Records tool from the ArcGIS Services page, it actually parses the date field correctly... but the source of that page doesn't give any clues as to how it did. So, for instance, I get the following: 51494400000 instead of 1971/08/20 00:00:00 UTC 50889600000 instead of 1971/08/13 00:00:00 UTC 779328000000 instead of 1994/09/12 00:00:00 UTC Is there a pattern I'm not seeing? Is there a special way to parse these integer dates? Thanks
... View more
01-27-2011
11:47 AM
|
1
|
7
|
12591
|
POST
|
If you examine the event parameter returned on any plain-Jane Javascript event, you'll see that it has the properties screenX and screenY among many others. However, if you examine the event parameter returned by any of esri.Map's events, there are more properties available, namely screenPoint and mapPoint, which both seem to be esri.geometry.Point objects. Is there any way that one can convert a Javascript event to an ESRI event?
... View more
11-03-2010
02:34 PM
|
0
|
0
|
302
|
POST
|
I made a solution to those who will encounter a similar problem: Using my map, I zoomed out/in to the scale that I wanted to and made a dummy button that logged what's returned from esri.geometry.getScale(myMap) to get the current scale. Using that number, I used myMap.setExtent(esri.geometry.getExtentForScale(myMap, <scale number>)); to make the map zoom out or in to the scale that I want from the current view. My organization's maps take longer than usual for extent changes, so I made an event listener for the dynamic map service's onUpdateEnd to wait for the extent change to load and then center the map at the geometry that I needed. Here's my code for reference. For me, 44315.3858 is what was returned from esri.geometry.getScale(myMap). parcelMap is my ArcGISDynamicMapServiceLayer.
function reduceExtent(geom) {
// Adjust the current extent to the specified scale where we can see
// abstracts
myMap.setExtent(esri.geometry.getExtentForScale(myMap, 44315.3858));
// Wait until the extent change has completed
var tempHook = dojo.connect(parcelMap, "onUpdateEnd", function() {
// Pan to the selected abstract
myMap.centerAt(geom.getExtent().getCenter());
// Dispose of the temporary listener
dojo.disconnect(tempHook);
});
}
I hope this helps someone.
... View more
11-03-2010
01:44 PM
|
0
|
0
|
182
|
POST
|
You can try adding a transparent "dummy graphic" to your map's GraphicLayer with the graphic's geometry set to the extent you want. Then, extract a Point object from that graphic using getCenter(), and send that over to map.centerAt(thatPoint). I may be running around in circles, but it's a possible solution.
... View more
11-03-2010
10:54 AM
|
0
|
0
|
316
|
POST
|
http://help.arcgis.com/EN/webapi/javascript/arcgis/help/jsapi/arcgisdynamicmapservicelayer.htm If you're using a dynamic map service, then the property disableClientCaching of rcGISDynamicMapServiceLayer might be what you should look into. I'm new to ArcGIS and mapping in general, but I think if you want to edit a map through the API, you would want to disable local caching of data--you want your clients to always see recent versions.
... View more
11-03-2010
10:24 AM
|
0
|
0
|
182
|
POST
|
This functionality is similar to what I am looking for in the thread that I made not to long ago (here if you want to see it). Maybe together we can concoct a solution?
... View more
11-03-2010
10:19 AM
|
0
|
0
|
316
|
POST
|
I am using an ArcGISDynamicMapService, and given a point, I want the map to zoom out (or into) a specific scale and pan to a location. With dynamic maps, I can't find a way to set the scale manually, unlike what the level of detail (LOD) does for tiled maps. Is there something for dynamic maps where I can set a scale? I appreciate any input. Thanks.
... View more
11-02-2010
11:05 AM
|
0
|
1
|
726
|
POST
|
Thank you for all the responses. Instead of identifying by the geometry, I opted to just use a QueryTask on the object ID. Silly me...I didn't think of that earlier!
... View more
10-28-2010
10:47 AM
|
0
|
0
|
336
|
Title | Kudos | Posted |
---|---|---|
1 | 01-27-2011 11:47 AM |
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|