POST
|
I wrote a script to determine how long it takes to set arcpy.env.workspace to a series of feature datasets within an enterprise geodatabase(SDE 10.2.2 on SQL Server 2012), and these are my results. You can see that some of the assignments take longer than 3 minutes, and it's just assigning a workspace! 7.3149998188seconds to set EONGIS.SDE.faa as workspace 1.0720000267seconds to set EONGIS.SDE.mlquery as workspace 222.508000135seconds to set EONGIS.SDE.naturalhazards as workspace 79.6970000267seconds to set EONGIS.SDE.partnerfeeds as workspace 0.561000108719seconds to set EONGIS.SDE.space as workspace 2.94499993324seconds to set EONGIS.SDE.Boundaries as workspace 221.398999929seconds to set EONGIS.SDE.naturalhazards2 as workspace For reference, here is the script: import arcpy, time
uri = r"C:\EsriEON\eon\publishing\connections\eon_connection.sde"
arcpy.env.workspace = uri
dsets = arcpy.ListDatasets()
for dset in dsets:
start = time.time()
arcpy.env.workspace = uri + "\\" + dset
end = time.time()
print str(end-start) + "seconds to set " + dset + " as workspace"
So obviously the naturalhazards feature dataset is the most problematic. But so is partnerfeeds. Naturalhazards2 is an exact copy of the original naturalhazards. I created naturalhazards2 to see if there was some corruption in naturalhazards. Here's some contextual information... My geodatabase is mostly feature datasets with feature classes inside, but also has some locators, and a toolbox. There is nothing unique about any of the feature datasets except the data within them. Each contains between 2 and 6 feature classes and that's it, and each is used as the source for some server map services. Does anyone have any suggestions on why these times may vary so much? How to troubleshoot why some may be taking longer than others? Thanks!
... View more
12-02-2014
12:39 PM
|
0
|
1
|
3571
|
POST
|
I'm trying to create a layer "widget" that essentially specifies a feature layer, renderer, and infoWindow and can be reused across multiple applications. This would provide consistency across our maps, and dictate one location if we wanted to change icons, rendering, or info window contents (which could also also be overwritten for specific applications). Anyway, I'm having trouble with some JS heavy stuff that I don't understand. I want to create some scale dependent rendering based on an attribute field that shows more feature types (greater detailed feature types) as you zoom in. In a standard application, I achieved this by:
map.on('zoom-end', function(result){
var query = "ZoomLevel <= " + result.level.toString();
layer.setDefinitionExpression(query)});
However, when I did this in my reusable widget, it didn't work, because my layer object wasn't accessible within the scope of the 'zoom-end' callback. I know through research that I need to use Dojo's lang.hitch function, but am unclear how to implement it. The below code works when I instantiate the object in my app, but when I zoom in, it throws and error saying this.airportsLayer is undefined (the zoom-end callback doesn't have access to the scope). Can anyone advise me how to use lang.hitch appropriately to create the desired effect (which is once instantiated, it automatically sets the zoom-end handler on the map). Thanks!
define([
"dojo/_base/declare",
"esri/layers/FeatureLayer",
"esri/InfoTemplate",
"esri/symbols/PictureMarkerSymbol",
"esri/renderers/UniqueValueRenderer",
"esri/symbols/SimpleFillSymbol",
"esri/Color",
"dojo/_base/lang",
"dojo/domReady!"
],
function(
declare,
FeatureLayer,
InfoTemplate,
PictureMarkerSymbol,
UniqueValueRenderer,
SimpleFillSymbol,
Color,
lang
) {
return declare(null, {
constructor: function(map) { //constructor requires your desired name
this.map = map;
this.infoTemplate = new InfoTemplate("Airport Code: ${LocationID}", "<ul><li><b>Name: </b>${FacilityName}</li><li><b>Address: </b>${OwnerAddress}, ${OwnerCSZ}</li><li><b>Flights Daily: </b>${FlDaily}</li><li>${UseType} ${Type}</li></ul>");
this.airportsLayer = new FeatureLayer("http://myserver:6080/arcgis/rest/services/EON/FAA/MapServer/0", {
mode: FeatureLayer.MODE_ONDEMAND,
outFields: ["ZoomLevel", "Type", "OEP35", "Image", "LocationID", "FacilityName", "OwnerAddress", "OwnerCSZ", "Part139", "OEP35", "UseType", "Type", "FlDaily", "Image", "URL", "URL2"],
infoTemplate: this.infoTemplate,
visible: true
});
this.defaultSymbol = new SimpleFillSymbol().setColor(new Color([255, 255, 255, 0.75]));
this.renderer = new UniqueValueRenderer(this.defaultSymbol, "Image");
this.renderer.addValue("military-airport-part139.png", new PictureMarkerSymbol("../../icons/airports/military-airport-part139.png", 24, 24));
this.renderer.addValue("military-airport.png", new PictureMarkerSymbol("../../icons/airports/military-airport.png", 16, 16));
this.renderer.addValue("military-heliport.png", new PictureMarkerSymbol("../../icons/airports/military-heliport.png", 16, 16));
this.renderer.addValue("private-airport.png", new PictureMarkerSymbol("../../icons/airports/private-airport.png", 16, 16));
this.renderer.addValue("private-airport-part139.png", new PictureMarkerSymbol("../../icons/airports/private-airport-part139.png", 24, 24));
this.renderer.addValue("private-balloonport.png", new PictureMarkerSymbol("../../icons/airports/private-balloonport.png", 16, 16));
this.renderer.addValue("private-gliderport.png", new PictureMarkerSymbol("../../icons/airports/private-gliderport.png", 16, 16));
this.renderer.addValue("private-heliport.png", new PictureMarkerSymbol("../../icons/airports/private-heliport.png", 16, 16));
this.renderer.addValue("private-seaplane base.png", new PictureMarkerSymbol("../../icons/airports/private-seaplane.png", 16, 16));
this.renderer.addValue("private-ultralight.png", new PictureMarkerSymbol("../../icons/airports/private-ultralight.png", 16, 16));
this.renderer.addValue("public-airport.png", new PictureMarkerSymbol("../../icons/airports/public-airport.png", 16, 16));
this.renderer.addValue("public-airport-oep35.png", new PictureMarkerSymbol("../../icons/airports/public-airport-oep35.png", 32, 32));
this.renderer.addValue("public-airport-part139.png", new PictureMarkerSymbol("../../icons/airports/public-airport-part139.png", 24, 24));
this.renderer.addValue("public-balloonport.png", new PictureMarkerSymbol("../../icons/airports/public-balloonport.png", 16, 16));
this.renderer.addValue("public-gliderport.png", new PictureMarkerSymbol("../../icons/airports/public-gliderport.png", 16, 16));
this.renderer.addValue("public-heliport.png", new PictureMarkerSymbol("../../icons/airports/public-heliport.png", 16, 16));
this.renderer.addValue("public-seaplane base.png", new PictureMarkerSymbol("../../icons/airports/public-seaplane.png", 16, 16));
this.renderer.addValue("public-ultralight.png", new PictureMarkerSymbol("../../icons/airports/public-ultralight.png", 16, 16));
this.airportsLayer.setRenderer(this.renderer);
this.airportsLayer.setDefinitionExpression("OEP35 = 1");
this.setZoomDependentRendering = lang.hitch(this, this.setZoomDependentRendering)
this.setZoomDependentRendering();
},
setZoomDependentRendering: function() {
this, this.map.on('zoom-end', function(a) {
var query = "ZoomLevel <= " + a.level.toString();
console.log(a);
console.log(this.airportsLayer);
this.airportsLayer.setDefinitionExpression(query);
});
}
});
});
... View more
07-21-2014
01:33 PM
|
0
|
0
|
511
|
POST
|
I have a point feature layer, and want to determine which areas have 5 or more points within 100 miles (not necessarily which points have 4 or more points within 100 miles from it). I'm unclear on how to do this, and am open to suggestions. Would hexagonal binning work for this, or should I create a raster? What about as new points get added (as they do about one every 10 minutes or so). Would I have to redo the entire analysis, or is there a way to fold the new point into the previous analysis, to see if the addition now satisfies the condition. Thanks!
... View more
07-09-2014
09:46 AM
|
0
|
1
|
3254
|
POST
|
Hi, I've been tasked with automating the daily publishing of an Oracle table to an ArcGIS for Server instance. There is no SDE installed on Oracle, and I have little control over the database instance itself. My solution to this is the following: 1. Install ArcMap on a server machine. 2. Have a recurring Python script that updates a local geodatabase with a fresh copy of the table from the Oracle instance. 3. Automate republishing of the data to an ArcGIS for server instance using ArcGIS for Server admin utilities and arcpy.mapping. Is there a simpler way to do this? If not, does anyone have any tips on how to get started on accessing Oracle database through Python using OBDC connections? Thanks!
... View more
03-14-2014
09:35 AM
|
0
|
2
|
1325
|
POST
|
I copied the cluster layer implementation from https://developers.arcgis.com/javascript/jssamples/layers_point_clustering.html. I looked at the ClusterLayer.js file, and saw a comment that the labelOffset doesn't work in IE. So as I expected, when I loaded my map in IE, the clusters didn't show with their corresponding cluster size, as they do in Chrome and Firefox. However, when I checked the live sample of the demo in IE (http://developers.arcgis.com/javascript/samples/layers_point_clustering/), the cluster numbers do appear. So does anyone know why they won't show up in my map (using IE) if they show up in the sample. I'm using the same copy of ClusterLayer.js that the demo is using. Thanks!
... View more
03-12-2014
09:43 AM
|
0
|
0
|
526
|
POST
|
hmmm, I don't see the behavior anymore. It must have been fixed in a recent Chrome update.
... View more
03-12-2014
08:50 AM
|
0
|
0
|
804
|
POST
|
I am running into a problem with the JS API v3.8 in which the maps 'extent-change' event is fired with a single mouse click (not double or shift+click, just a simple click on the map), even though a single mouse click does not cause the map's extent to actually change. Normally this isn't a problem unless you have a need to run some real code when the extent actually changes. This behavior is unfortunately preventing my popup window from appearing, because I have a function attached to the 'extent-change' event which actually clears the feature layer. But one click should just show the popup, and not fire the 'extent-change'. UPDATE: this only seems to be affecting Chrome Regardless, see the following code to reproduce in the simplest manner possible: <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no"/> <title>Simple Map</title> <link rel="stylesheet" href="http://js.arcgis.com/3.8/js/esri/css/esri.css"> <style> html, body, #map { height: 100%; width: 100%; margin: 0; padding: 0; } body { background-color: #FFF; overflow: hidden; font-family: "Trebuchet MS"; } </style> <script src="http://js.arcgis.com/3.8/"></script> <script> var map; require(["esri/map", "dojo/domReady!"], function( Map) { map = new Map("map", { basemap: "gray", center: [-97, 38], zoom: 5, sliderStyle: "small" }); map.on('extent-change', function(){console.log('extent changed');}); }); </script> </head> <body> <div id="map"></div> </body> </html>
... View more
02-27-2014
09:12 AM
|
0
|
7
|
3311
|
POST
|
Thanks Derek - I was able to get it to work by copying the format of your example. There were a couple differences with my code (but not much). Following the example's layout solved the problem for me. The next challenge is to get paging to work with the popups....
... View more
01-09-2014
07:50 AM
|
0
|
0
|
310
|
POST
|
I have created a custom GraphicsLayer (based on a query to an external web service that isn't ArcGIS based). I would like to implement paging for popups for the GraphicsLayer. When using map-service based FeatureLayers, I would generally add the feature layer in SELECTIONMODE and also add a DynamicMapServiceLayer from the map service URL. A spatial query based on mouse clicks can return the features, which I load into the popup for paging. However, I don't know how to perform this same type spatial query on the GraphicsLayer. Can anyone provide any assistance?
... View more
01-08-2014
08:27 AM
|
0
|
0
|
245
|
POST
|
I have created a FeatureLayer based on a featureCollectionObject (i.e. not from a service URL), and I would like to perform a spatial query on it. The documentation claims that it "does not support queries that need to be performed on the server, e.g. queries with a where clause or non-extent based spatial queries." So according to this, it should support an extent based spatial query. However, when I construct my query: var query = new Query(); query.geometry = pointToExtent(map, evt.mapPoint, 20); and try to execute, I get the following error message: "FeatureLayer::selectFeatures - query contains one or more unsupported parameters." I have tried changing the query.spatialRelationship attribute (from the default INTERECTS to CONTAINS or WITHIN) but that doesn't help. There are no other aspects to the query - no where clause or time clause or anything other than the geometry (which I've set to an extent). Can someone help me execute this query correctly?
... View more
01-08-2014
08:23 AM
|
0
|
2
|
653
|
POST
|
I have also created a FeatureLayer from a featureCollectionObject. I am trying to perform an extent-based spatial query (which according to the documentation is supported), but I keep getting the "FeatureLayer::selectFeatures - query contains one or more unsupported parameters" error. My question is: what do I need to do to create an "extent-based" spatial query? Do I have to change the spatialRelationship attribute of the query to a specific string? the geometry attribute is already set to an extent. Thanks! Rahul, if you're creating the FeatureLayer not from a url as you mention but from a featureCollectionObject, then you should look at the restrictions associated with this FeatureLayer constructor (link) * Does not support queries that need to be performed on the server, e.g. queries with a where clause or non-extent based spatial queries.
... View more
01-08-2014
08:00 AM
|
0
|
0
|
900
|
POST
|
Hi, I published a map service with feature access to our internet ArcGIS for Server 10.1. So in my services directory, there are two services, the "FeatureServer", and the "MapServer", but in my server manager, there is just one service, the "Map Service." I would like to know if it is possible, and how would I do the following: 1. Secure the feature service to only allow specified users to update, edit, delete features. Do this by attaching a role to the service, since I have connected my ArcGIS server instance to our Windows Domain. This way if a user tries to access an application using the feature service, the IdentityManager dijit can handle the token and authentication. 2. Leave the map service unsecured, so any user can query or view the features associated with the data. Through ArcGIS manager, I can only secure the single Map Service, which would affect the FeatureServer and MapServer, so am wondering if there is another way to do this. Thanks!
... View more
11-21-2013
06:01 AM
|
0
|
0
|
319
|
POST
|
Basically I'm trying to populate some info window content with the attributes from another feature service. I wasn't able to get it working use either of those suggestions. Any others I might try? Tracy: This code doesn't seem to work as intended either: function getContent(graphic) {
var facID = graphic.attributes.FacilityID;
console.log(facID);
var queryTask = new esri.tasks.QueryTask("http://myserver:6080/arcgis/rest/services/EON/Assets/MapServer/0");
var query = new esri.tasks.Query();
query.where = "LocationID = '" + facID + "'"
query.outFields = ['*'];
queryTask.execute(query,success,failure);
}
function success(data){
var attributes = data.features[0].attributes;
var name = attributes.FullName;
var flDaily = attributes.FlDaily;
var artcc = attributes.BoundaryATRCCComputerID;
var url = attributes.URL2;
var type = attributes.UseType;
var content = name + "<ul><li><b>Daily Flight: </b>" + flDaily.toString() + "</li><li><b>ARTCC: </b>" + artcc + "</li><li><b>Type: </b>" + type + "</li></ul><a href = '" + url + "'>More Info </a>"
template.setContent(content);
}
function failure(error){
console.log(error);
}
} The first info window doesn't display anything, and each subsequent info window displays what the first info window should have. I'm calling it like this: template = new esri.InfoTemplate();
template.setTitle("Code: ${FacilityID}");
template.setContent(getContent); Rene, unfortunately your suggestion didn't seem to fix the problem. function getContent(graphic) {
facID = graphic.attributes.FacilityID;console.log(facID);
var deferred = esri.request({
url: "http://myserver:6080/arcgis/rest/services/EON/Assets/MapServer/0/query",
content:{
where: "LocationID = '" + facID + "'",
outFields: "*",
f: "json"
},
callbackParamName: "callback",
handleAs: "json"});
deferred.then(
function(response) {
console.log("Success: ", response);
deferred.callback("testing");
}, function(error) {
console.log("Error: ", error);
});
return deferred.promise;
} The deferred.then section works, but trying to return deferred.promise still generates an error. Any other thoughts?
... View more
10-04-2013
09:42 AM
|
0
|
0
|
933
|
POST
|
I am following the instructions here: My function: function getContent(graphic) {
var deferred = new dojo.Deferred();
facID = graphic.attributes.FacilityID;
console.log(facID);
deferred = esri.request({
url: "http://myserver.com/arcgis/rest/services/EON/Assets/MapServer/0/query",
content:{
where: "LocationID = '" + facID + "'",
outFields: "*",
f: "json"
},
callbackParamName: "callback",
load: function(fset) {
console.log(fset);
deferred.callback("blahhh");
},
error: function(error) {
deferred.errback("Error occurred while generating profile");
}
});
return deferred;
} generates an error at the "return deferred" line. The error is "Uncaught NotFoundError: An attempt was made to reference a Node in a context where it does not exist." What do I need to do to make this work?
... View more
10-04-2013
07:29 AM
|
0
|
8
|
6214
|
POST
|
Shucks - I really like that idea. Unfortunately I'm running 10.1 not 10.2. Any other suggestions? Jay
... View more
09-16-2013
10:05 AM
|
0
|
0
|
238
|
Title | Kudos | Posted |
---|---|---|
1 | 07-10-2024 06:03 AM | |
1 | 02-28-2024 07:43 AM | |
1 | 09-14-2022 06:39 AM | |
2 | 07-21-2023 07:11 AM | |
1 | 06-23-2022 07:46 AM |
Online Status |
Offline
|
Date Last Visited |
Tuesday
|