POST
|
For what it's worth, the API's positioning logic for the Popup dijit is still not working satisfactorily for us in version 3.8. After some code digging, we determined that the issue for us is when the popup's content is large enough that there's no selection of anchor point for the popup that avoids the popup overflowing outside the map's boundaries. In this case, instead of making a best effort choice of anchor point, minimizing overflow, the API simply keeps the existing anchor point for the popup. It should be noted that the content's size is calculated from the dimensions of the Popup._positioner dom element, which appears to be the size of the largest content ever displayed in the popup. So if you're not currently displaying a large popup, you may still have the issue because you previously showed content that caused the _positioner to expand in size. Our solution was to override the Popup._setPosition function and add logic for the case when no anchor point avoids overflow. Here's what our added logic looks like (in the final else): if (roomToTheRight && roomAbove) {
horAnchor = "Left"; verAnchor = "bottom";
}
else if (roomToTheRight && roomBelow) {
horAnchor = "Left"; verAnchor = "top";
}
else if (roomToTheLeft && roomBelow) {
horAnchor = "Right"; verAnchor = "top";
}
else if (roomToTheLeft && roomAbove) {
horAnchor = "Right"; verAnchor = "bottom";
}
else {
// No room in any direcion, choose anchor that gives most room
var horCoverages = [];
horCoverages.push({ "anchor": "", "overflow": Math.max(0, (contentBox.w / 2) - (absoluteX - left)) + Math.max(0, (contentBox.w / 2) - (right - absoluteX + 1)) });
horCoverages.push({ "anchor": "Right", "overflow": Math.max(0, contentBox.w - (absoluteX - left)) });
horCoverages.push({ "anchor": "Left", "overflow": Math.max(0, contentBox.w - (right - absoluteX + 1)) });
var verCoverages = [];
verCoverages.push({ "anchor": "", "overflow": Math.max(0, (heightNeeded / 2) - (absoluteY - top)) + Math.max(0, (heightNeeded / 2) - (bottom - absoluteY + 1)) });
verCoverages.push({ "anchor": "bottom", "overflow": Math.max(0, heightNeeded - (absoluteY - top)) });
verCoverages.push({ "anchor": "top", "overflow": Math.max(0, heightNeeded - (bottom - absoluteY + 1)) });
var sortFunction = function (a, b) { return a.overflow > b.overflow; };
horCoverages.sort(sortFunction);
verCoverages.sort(sortFunction);
horAnchor = horCoverages[0].anchor;
verAnchor = verCoverages[0].anchor;
console.log("There's no room for the popup, chose most optimal anchoring " + verAnchor + horAnchor + "...");
}
... View more
06-22-2014
11:01 PM
|
0
|
1
|
561
|
POST
|
My apologies, I need to retract the above. I can't reproduce my problem today using that procedure.
... View more
05-30-2014
04:20 AM
|
0
|
0
|
259
|
POST
|
When not connected to the internet, ESRI Maps for Office will periodically (but deterministically) crash Microsoft Excel. How to reproduce: 1. Open Excel 2. Disconnect from the internet 3. Wait.
... View more
05-30-2014
02:08 AM
|
0
|
1
|
2720
|
POST
|
I have a simple custom project extension and want to trigger the activity animation (the spinning colored circles) programmatically. Is that possible? Thanks, Ottar
... View more
05-30-2014
01:19 AM
|
0
|
0
|
1701
|
POST
|
From the REST API documentation: Note: In the case of dynamic layers the layer list is ignored, it instead uses top or all (default) to identify the layers defined in dynamicLayers parameter.
... View more
02-23-2014
11:36 PM
|
0
|
0
|
387
|
POST
|
I've also found that the Locate Button does not work with non-mercator projections. The fairly obvious requirement of projecting the lat/long coordinate to the map's spatial reference doesn't seem to be implemented. I added the functionality to the LocateButton by overriding the private _setPosition method using version 3.8 of the API. Since it's a private method the fix could break with updates of the API though. Hopefully ESRI can incorporate this functionality in future versions of the API, it's literally 3 extra lines of code. require([
"dojo/_base/lang",
"esri/dijit/LocateButton",
"dojo/Deferred",
"esri/config",
"esri/geometry/Point",
"esri/SpatialReference"
], function (
lang,
LocateButton,
Deferred,
esriConfig,
Point,
SpatialReference
) {
lang.extend(LocateButton, {
_setPosition: function (location) {
var deferred = new Deferred;
if (location && location.coords) {
var point = null;
var scale = this.get("scale") || location.coords.accuracy || 5E4;
if (point = new Point([location.coords.longitude, location.coords.latitude], new SpatialReference({ wkid: 4326 }))) {
esriConfig.defaults.geometryService.project([point], this.map.spatialReference).then(lang.hitch(this, function (projectedPoints) {
point = projectedPoints[0];
var event = this._createEvent(point, scale, location);
if (this.get("setScale")) this.get("map").setScale(scale);
if (this.get("centerAt")) {
this.get("map").centerAt(point).then(lang.hitch(this, function () {
deferred.resolve(event);
}), lang.hitch(this, function (err) {
if (!err) err = Error("LocateButton::Could not center map.");
deferred.reject(err);
}));
}
else {
deferred.resolve(event);
}
}), lang.hitch(this, function (err) {
if (!err) err = Error("LocateButton::Could not project point to map's spatial reference.");
deferred.reject(err);
}));
}
else {
var err = Error("LocateButton::Invalid point");
deferred.reject(err)
}
}
else {
var err = Error("LocateButton::Invalid position");
deferred.reject(err);
}
return deferred.promise;
}
});
});
... View more
01-09-2014
04:16 AM
|
0
|
0
|
480
|
POST
|
Actually, I found an easy workaround on the client, for those who have control over what it does. I add a timestamp to the url so that it's always unique. Now the browser won't used the cached file even though the filename is the same, since I added a unique query parameter. this.executePrint({ template: "MAP_ONLY", format: format, preserveScale: false, showAttribution: false, exportOptions: exportOptions }).then(lang.hitch(this, function (result) { var url = result.url + "?ts=" + new Date().getTime(); // Add timestamp to avoid browser caching window.open(url); })
... View more
09-27-2013
01:28 AM
|
0
|
0
|
919
|
POST
|
It would be nice to have a better workaround for this in 10.1. Increasing the cleanup time of the output directory won't really help. Is it possible to configure http headers returned by arcgis server to tell the browsers not to cache the output images?
... View more
09-27-2013
12:38 AM
|
0
|
0
|
919
|
POST
|
Well it seems this was caused by missing language files for network analyst directions. Apprarently, if you're running a non-english locale you need to add a language file for your own locale even if you just want english directions? I didn't bother researching the full issue here since I did have language files that I wanted to install anyway, but this really should have been working out of the box even on a non-english locale. (I added language files to C:\Program Files\ArcGIS\Server\NetworkAnalyst\Directions to fix my issue.)
... View more
05-06-2013
11:36 PM
|
0
|
0
|
215
|
POST
|
I'm getting this error in my ArcGIS Server log when calling the REST endpoint of a Network Analysis service, requesting a route description. Example request: /arcgis/rest/services/vn_route/NAServer/Route/solve?stops=265000%2C6650000%3B260000%2C6653000&outSR=25833&impedanceAttributeName=Minutes&restrictionAttributeNames=Oneway&returnDirections=true&f=json
Response: {"error":{"code":500,"message":"Error executing solve route","details":[]}} Error message in the ArcGIS Server log: SEVERE 2. mai 2013 14:45:54 NALayer [Route]: Could not allocate enough contiguous memory. vn_route.MapServer Doing a solve without requesting directions works: /arcgis/rest/services/vn_route/NAServer/Route/solve?stops=265000%2C6650000%3B260000%2C6653000&outSR=25833&impedanceAttributeName=Minutes&restrictionAttributeNames=Oneway&returnDirections=false&f=pjson
Response: {
"messages": [
],
"routes": {
"hasM": true,
"fieldAliases": {
"ObjectID": "ObjectID",
"Name": "Name",
"FirstStopID": "FirstStopID",
"LastStopID": "LastStopID",
"StopCount": "StopCount",
"Total_Minutes": "Total_Minutes",
"Shape_Length": "Shape_Length"
},
"geometryType": "esriGeometryPolyline",
"spatialReference": {
"wkid": 25833,
"latestWkid": 25833
},
"features": [
{
"attributes": {
"ObjectID": 1,
"Name": "Location 1 - Location 2",
"FirstStopID": 1,
"LastStopID": 2,
"StopCount": 2,
"Total_Minutes": 13.279979646627661,
"Shape_Length": 10122.851526668173
},
"geometry": {
"hasM": true,
"paths": [
[
[
265001.46760000009,
6649998.1897999998,
0
],
...
I'm using ArcGIS for Server 10.1 SP1 on Windows Server 2012. Does anybody know what might cause this issue? See also http://forums.arcgis.com/threads/82633-quot-Error-executing-solve-route-quot-When-returnDirections-true-on-Network-Analyst?p=294636&viewfull=1#post294636
... View more
05-02-2013
05:02 AM
|
0
|
1
|
618
|
POST
|
My apologies, I posted that being logged in as the wrong user, the above was actually posted by me. I'm going to repost this issue in the ArcGIS Server forum though.
... View more
05-02-2013
04:52 AM
|
0
|
0
|
306
|
POST
|
In case it wasn't clear, the reason you returnStateAverage function doesn't return anything is that the return statement marked in red doesn't return from that function - it returns from the function marked in blue. function returnStateAverage(geography, indicator){
var stateVal;
var myURL = "stateURL";
queryTask = new esri.tasks.QueryTask(myURL);
query = new esri.tasks.Query();
query.returnGeometry = false;
query.outFields = ["*"];
query.where = "State_name='" + geography + "'";
queryTask.execute(query, function(fSet) {
var features = fSet.features;
dojo.forEach(features, function(feature) {
stateVal = feature.attributes[indicator];
return stateVal;
});
});
} When I say "cleanest" I mean that it's the recommended practice when dealing with asynchronous methods. Recommended reading: http://dojotoolkit.org/documentation/tutorials/1.6/deferreds/
... View more
04-05-2013
08:48 AM
|
0
|
0
|
467
|
POST
|
That's because your returnStateAverage function doesn't actually return any value. You only have a return statement in your anonymous function passed to the forEach() method. Furthermore, all the logic following your returnStateAverage call needs to be moved to the result handler of your queryTask.execute call in the returnStateAverage function, since the queryTask.execute method works asynchronously (more formally, it returnes a dojo.Deferred object). The cleanest implementation would probably be to let your returnStateAverage function return a Deferred object.
... View more
04-05-2013
05:45 AM
|
0
|
0
|
467
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|