|
POST
|
I have found that this issue can be caused by a configuration setting in the add-in file. Check the config.xml for the add-in for the following section: <Targets> <Target name="Desktop" version="10.2" /> </Targets> As long as your add-in code is compatible with 10.1 functionality, then changing this setting to 10.1 should make the add-in available to the user.
... View more
01-26-2015
05:54 PM
|
3
|
1
|
3961
|
|
POST
|
I have done this in the past for python scripts using a combination of function decorators and a timing function. Basically, the timer is placed in a function wrapper that captures information about the script name, function name and execution time. This information is stored in an array until the writePerformance function is called to write the data out to a file. #xyzGlobals.py
import time
import inspect
#Performance Information
timings = []
def recordPerformance(func):
def wrapper(*arg):
t1 = time.clock()
res = func(*arg)
t2 = time.clock()
timings.append('%s, %s, %0.2f' % (getFilename(func) , func.func_name, (t2-t1)))
return res
return wrapper
def getFilename(func):
try:
return inspect.getfile(func)
except Exception, e:
return ''
def writePerformance(path):
f = open(path, 'w')
f.write('Filename, Function, Seconds\n')
for t in timings:
f.write('{0}\n'.format(t))
f.close() Then you can use python function decorators to call the timer: @xyzGlobals.recordPerformance
def makeBasinTable(self):
"""Make the basin tables
"""
src = self.__getDataSource('Basins')
if src != None:
task = BasinCalc(self.log, self.cleanup)
task.setDataSource(src)
task.calcStatistics(self.aoi_obj) When your script has completed call the xyzGlobals.writePerformance function to write the performance data to a file. Please note that this code was used for a project undertaken several years ago and hasn't been used recently. However, you should be able to update parts of it as required. You would also need to modify the writePerformance function to print information to ArcMap output instead of a file.
... View more
01-11-2015
01:56 PM
|
1
|
0
|
2344
|
|
POST
|
Sorry for the delay - summer holidays here in Australia What is the final outcome that you are after from this process? If you can outline this using some diagrams it may be easier to figure out how to get the final result.
... View more
01-07-2015
02:21 PM
|
0
|
2
|
3328
|
|
POST
|
Was just thinking you could do this using: REST query to get your results (make sure that you request the geometries in the results). REST call to the Union method on a Geometry service (passing in your geometries from the previous step). This results in two calls to ArcGIS Server but should be simpler to maintain.
... View more
12-17-2014
01:18 PM
|
0
|
1
|
3633
|
|
POST
|
You certainly could write your own logic to calculate the combined extent but it may be simpler to use a function from an existing library. If you are accessing REST via server-side Java code it may be worth looking into some of the Java Spatial libraries such as the ESRI Java ArcObjects SDK (requires ArcGIS license), GeoTools or Spatial4j. Please note I have not tried the Java GeoTools or Spatial4j as I mostly use JavaScript, python and C#.
... View more
12-17-2014
01:12 PM
|
0
|
1
|
3633
|
|
POST
|
In regards to the custom polygon id value - you have full control over the name of the property and its value. To do an intersect query on the polygon you would need to use a GeometryService. Then you can use the intersect() method to test if the polygons overlap. If you just want the combined area of all polygons then you could use the union() method. You would need to pass in each serviceArea.geometry to the intersect or union methods.
... View more
12-17-2014
01:00 PM
|
0
|
6
|
3328
|
|
POST
|
You would need to convert your raster Blob data to base64 before you apply it to the image src as Rene suggests. One way I have seen to do this on the client side is using the HTML5 canvas object. For example: javascript - How to get the right image data in base64 format using HTML5 canvas - Stack Overflow Another option may be using the Dojo toolkit: dojox.encoding.base64 — The Dojo Toolkit - Reference Guide (info from this post: How to read FieldTypeBlob from graphic.attributes). Using the HTML5 canvas object will have compatibility issues with older browsers. Encoding the Blob to base64 server-side is relatively simple but it looks like you need to do this on the client.
... View more
12-16-2014
11:48 PM
|
0
|
3
|
2947
|
|
POST
|
Check this reference - Working with Objects In Javascript you can just add your ID property to each graphic as you are adding them to your map: var id = 0;
dojo.forEach(solveResult.serviceAreaPolygons, function(serviceArea){
// Add a custom id property and value:
serviceArea.customId = id;
id += 1; // increment the ID value
serviceArea.setSymbol(polygonSymbol);
map.graphics.add(serviceArea);
}); If you log the results to the console you can see your new property values: Just make sure not use existing object property names for your new property.
... View more
12-16-2014
12:21 PM
|
0
|
8
|
3328
|
|
POST
|
Hi Eduardo, Have a look at this example I created - States - Find Task There are a number of options for zooming the map to the State - the best one is option 3 as it will fit the extent to the map: function showResults(results) {
var polygonSymbol = new esri.symbol.SimpleFillSymbol(esri.symbol.SimpleFillSymbol.STYLE_NONE,
new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_DASHDOT,
new dojo.Color([255, 0, 0]), 2), new dojo.Color([255, 255, 0, 0.25]));
//find results return an array of findResult.
map.graphics.clear();
var dataForGrid = [];
dojo.forEach(results, function(result) {
var graphic = result.feature;
dataForGrid.push([result.layerName, result.foundFieldName, result.value]);
graphic.setSymbol(polygonSymbol);
map.graphics.add(graphic);
var zoomToPt = graphic.geometry.getCentroid();
// Option 1: This zooms to a fixed zoom level that may not be appropriate for some states
//map.centerAndZoom(zoomToPt, 12);
// Option 2: This keeps the zoom level and pans to the zoom point
//map.centerAt(zoomToPt);
// Option 3: This sets the map extent to the feature extent
map.setExtent(graphic.geometry.getExtent(),true);
});
}
... View more
12-15-2014
06:07 PM
|
0
|
2
|
2701
|
|
POST
|
As you know that the result of the find task is a polygon (State boundary) then you can use the getCentroid() method to get your target point. Alternatively, you may want to look at polygon.getExtent() to get the feature extent and then use getCentroid() on the extent. This will work better for multipart features - such as Hawaii.
... View more
12-14-2014
09:05 PM
|
0
|
4
|
2702
|
|
POST
|
To get started with the ESRI JS API have a look at this page Build your first application | Guide | ArcGIS API for JavaScript. Read the Work with the API section in the help as this steps through the core functionality available. Learn how to work with Dojo - the ESRI JS API uses Dojo extensively: Working with Dojo | Guide | ArcGIS API for JavaScript One you have a map loading you can add your own layers. The general pattern is the same but there are a few options depending on the layer type: Feature Layers: On demand mode | ArcGIS API for JavaScript var featureLayer = new FeatureLayer("http://sampleserver6.arcgisonline.com/arcgis/rest/services/USA/MapServer/2",{
mode: FeatureLayer.MODE_ONDEMAND,
outFields: ["*"],
infoTemplate: infoTemplate
});
// Add the layer to the map
map.addLayer(featureLayer); Dynamic Map Service Layers: Add two dynamic maps | ArcGIS API for JavaScript var oilAndGasLayer = new ArcGISDynamicMapServiceLayer("http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Petroleum/KGS_OilGasFields_Kansas/MapServer", {
"id": "oilAndGasLayer",
"opacity": 0.75
});
//Add the layer to the map
map.addLayer(oilAndGasLayer); There are a heap of resources online for JavaScript including reference material, samples and online editors. Some good ones are: Setting up a Development Environment | Guide | ArcGIS API for JavaScript JS Bin - Collaborative JavaScript Debugging JavaScript reference - JavaScript | MDN Unbeatable JavaScript Tools - The Dojo Toolkit - ESRI uses this framework. Also keep using the GeoNet forums for specific questions and issues - JavaScript questions generally get answered quickly on here.
... View more
12-12-2014
04:44 PM
|
2
|
0
|
1357
|
|
POST
|
Hi Jay, Steve and Robert have been pointing you in the right direction. You need to create your GraphicsLayer once and then add user polygon graphics to it. Then before you run the spatial query, use a geometry service to union the geometries for all of the graphics in the GraphicsLayer. A working example is available here - User Input Graphics Layer The key parts of the code are: // Create your custom graphics layer and add it to the map
drawnGL = new GraphicsLayer({id:'user-input'});
map.addLayer(drawnGL);
function addGraphic(evt) {
...
// Add your user created graphic to your graphics layer:
drawnGL.add(new Graphic(evt.geometry, fillSymbol));
...
}
function unionGraphics(){
...
// get geometries from your graphics layer
var geoms = [];
for (var i=0; i<drawnGL.graphics.length;i++){
geoms.push(drawnGL.graphics.geometry)
}
// union geometries
geomSvc.union(geoms, function(result){
runAnalysis(new Graphic(result));
}, function(){
alert("Geometry service error");
});
...
} There are also a few console.log statements in the sample so you can open developer tools and see the results.
... View more
12-11-2014
01:52 PM
|
0
|
6
|
4568
|
|
POST
|
I would like to rewrite a script that is executed in ArcMap as a standalone script. I was told it cannot be done as some of the commands are only available in ArcMap. Do you intend on running the script as a standalone script on a machine that has ArcGIS installed? - if so this is possible as you can access ArcGIS functions via the arcpy package. If you want to run the script outside of ArcGIS then there are likely issues - most notably ESRI licensing restrictions.
... View more
12-10-2014
08:53 PM
|
0
|
0
|
2128
|
|
POST
|
As to why this is happening - see here: Creates a JavaScript Date instance that represents a single moment in time. Date objects are based on a time value that is the number of milliseconds since 1 January, 1970 UTC. The date constructor assumes the input to be UTC. There is nowhere in your code that is telling Dojo that your incoming dates are in MST. Dojo appears to be applying an offset to get from UTC to MST based on your browser settings. However, you may be able to simplify your formatDate and formatTime functions by removing the dojo.date.locale.format() and replacing it with a simple moment.js date formatting function. This way the code just assumes input/output values are UTC even though they are actually MST and the results should be displayed as they are in the attribute fields.
... View more
12-09-2014
05:20 PM
|
0
|
0
|
1796
|
|
POST
|
I have been using moment.js for date/time formatting in web applications and it is great. You should be able to wrap moment.js formatting functions inside the formatDate() and formatTime() functions.
... View more
12-09-2014
04:37 PM
|
0
|
0
|
1796
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 10-07-2014 06:13 PM | |
| 1 | 08-25-2015 02:04 AM | |
| 1 | 10-07-2014 03:54 PM | |
| 1 | 08-07-2014 09:19 PM | |
| 1 | 03-04-2015 02:02 PM |
| Online Status |
Offline
|
| Date Last Visited |
07-21-2021
06:32 PM
|