POST
|
Hi Cindy, You can get this directly from a map service REST endpoint, for example: http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Census_USA/MapServer/layers?f=json To access this JSON data in your JS code, use an esri.Request: [HTML]<!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>Map Layers - JSON</title> <script src="http://js.arcgis.com/3.9/"></script> <script> require([ "esri/request" ], function(esriRequest) { var layerUrl = "http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Census_USA/MapServer/layers"; var layersRequest = esriRequest({ url: layerUrl, content: { f: "json" }, handleAs: "json", callbackParamName: "callback" }); layersRequest.then( function(response) { console.log("Success: ", response.layers); // process map service layers }, function(error) { console.log("Error: ", error.message); }); }); </script> </head> <body> <p>See the console output for map service layers</p> </body> </html>[/HTML] Hope this helps. Owen www.spatialxp.com.au
... View more
06-16-2014
02:02 PM
|
0
|
0
|
583
|
POST
|
This is possible - just use multiple datagrids with unique ids and assign data to them from the results of your find tasks. I created a quick example based on some other ESRI samples here: http://jsbin.com/bacuwova If you are hitting multiple map services then you will need to modify this pattern to use a more than one find task. Owen www.spatialxp.com.au
... View more
06-12-2014
07:53 PM
|
0
|
0
|
621
|
POST
|
sys.argv[] is the list of variables being passed to the python script - with sys.argv[0] being the first argument. The arcpy library has alternate ways of accessing these same variables such as arcpy.GetParameter(0) and arcpy.GetParameterAsText(0). These variables can be different to the command line arguments that you are passing to the exe. It appears that you are basically building up a command string including the arguments that your exe requires. If the only thing that changes is the feature class parameter you could build the command line with arguments using the string format function. # define you exe path
exe_path = r"C:\temp\YourApp.exe"
# start iteration within folder on featureclasses
for fc in folder:
cmd = '"{0}" "{1}" "arg2" "arg3" "arg4" "arg5" "arg6" "arg7"'.format(exe_path, fc)
# run your cmd Just change the arguments 2-7 with your constant values. Hope this helps. Owen www.spatialxp.com.au
... View more
06-11-2014
07:02 PM
|
0
|
0
|
357
|
POST
|
You could either place the command arguments in your script as constants or pass them in via tool parameters. # Option 1 - Get feature class from tool parameter arg1 = arcpy.GetParameterAsText(0) # Define static parameters ARG2 = "ABC" ARG3 = "123" ARG4 = "456" ARG5 = "#" ARG6 = "XYZ" ARG7 = "#" # Process parameters into command line if ARG2 != "#": command.append("-o") command.append('"'+ARG2+'"') Note - there is no particular language construct to declare a constant in python, it is just a variable. They are typically declared as variables with uppercase names. # Option 2 - Get all variables from tool parameters arg1 = arcpy.GetParameterAsText(0) arg2 = arcpy.GetParameterAsText(1) arg3 = arcpy.GetParameterAsText(2) arg4 = arcpy.GetParameterAsText(3) arg5 = arcpy.GetParameterAsText(4) arg6 = arcpy.GetParameterAsText(5) arg7 = arcpy.GetParameterAsText(6) # Process parameters into command line if arg2 != "#": command.append("-o") command.append('"'+arg2+'"') The second option allows you to change the parameters without editing the script. However, you will need to create all of the parameters in the tool properties and give them default values. If they are constant values then I would probably go with option 1. Owen www.spatialxp.com.au
... View more
06-11-2014
03:07 PM
|
0
|
0
|
357
|
POST
|
If you have access to the ArcGIS Server I would suggest placing all 3 layers into a single map service and then configure the IdentifyParameters to use the layers that you are interested in. identifyTask = new IdentifyTask("http://server/ArcGIS/rest/services/YourNewCombinedLayers/MapServer");
identifyParams = new IdentifyParameters();
...
identifyParams.layerIds = [0, 1, 2]; //Layer ids in the new map service
...
If you don't have access to create new map services then you may need to look into Dojo deferred lists: http://dojotoolkit.org/reference-guide/1.9/dojo/DeferredList.html Owen www.spatialxp.com.au
... View more
06-10-2014
01:56 AM
|
0
|
0
|
2127
|
POST
|
The ESRI web map control has navigation UI controls but they are a bit different to the Google panning control - see this example: http://jsbin.com/voxosido You can enable these pan controls using the 'nav: true' option when creating your map, for example: <script src="http://js.arcgis.com/3.9/"></script>
<script>
var map;
require(["esri/map", "dojo/domReady!"], function(Map) {
map = new Map("mapDiv", {
center: [-56.049, 38.485],
zoom: 3,
basemap: "streets",
nav: true
});
});
</script> If you really need the control to look like the Google one then you may need to create a custom widget - for more information on custom widgets see: https://developers.arcgis.com/javascript/jstutorials/intro_custom_dijit.html Owen www.spatialxp.com.au
... View more
06-10-2014
01:25 AM
|
0
|
0
|
344
|
POST
|
I haven't tried using this yet but there is an event called update-end which may be what you are after. The documentation states that this is 'Fired when the layer has finished updating its content'. https://developers.arcgis.com/javascript/jsapi/featurelayer.html#event-update-end Owen www.spatialxp.com.au
... View more
06-10-2014
12:18 AM
|
0
|
0
|
660
|
POST
|
Good to hear it is working. Debugging JS can be a pain. Chrome developer tools can be really helpful for these type of issues: https://developer.chrome.com/devtools/index Also - make sure to remove all of the console.log() lines from your final code as they can cause issues in old versions of IE. Owen www.spatialxp.com.au
... View more
06-09-2014
04:14 PM
|
0
|
0
|
609
|
POST
|
This issue appears to be related to your loading images. <script type="text/javascript"> ... // Keep a reference to the loading icon DOM node. var loading = dom.byId("loading"); var loading1 = dom.byId("loading1"); var loading2 = dom.byId("loading2"); In your HTML there is an image element with id="loading2": <img id="loading2" src="images/loading2.gif"></img> However, there are no elements with ids of "loading" or "loading1" in the page. Your extractByCounty function attempts to show the element with id "loading": domStyle.set(loading, "display", "inline-block"); Your extractByUnit function attempts to show the element with id "loading1": domStyle.set(loading1, "display", "inline-block"); In both cases these elements do not exist in the HTML so you are getting the 'e is null' error when the Javascript code attempts to set the style of the element. You could either change the Javascript to use the same loading image element ("loading2") or create the other two HTML image elements to fix the issue. Owen www.spatialxp.com.au
... View more
06-09-2014
03:08 PM
|
0
|
0
|
609
|
POST
|
See this example: http://jsbin.com/hehihima The key is to add the basemap layer the old way as an ArcGISTiledMapServiceLayer: var map, baseLyr;
require(["esri/map", "esri/layers/ArcGISTiledMapServiceLayer", "dojo/domReady!"], function(Map,ArcGISTiledMapServiceLayer) {
// create map
map = new Map("mapDiv", {
center: [-117.719, 34.100],
zoom: 14
});
// add basemap with 50% opacity
baseLyr = new ArcGISTiledMapServiceLayer("http://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer", {opacity:0.5});
map.addLayer(baseLyr);
}); Hope this helps. Owen www.spatialxp.com.au
... View more
06-04-2014
06:25 PM
|
0
|
0
|
850
|
POST
|
I created a cut-down version of your code here: http://jsbin.com/dimifaju Try running this in Chrome with the developer tools open - showing the console output. From what I can see the toolbar events are all working and your extractMethod variable is being updated. Also, clicking on the Extract Data button calls myFunction and the extractMethod variable is available. In switch statements I put the default as the last option. For these type of switching functions I also normally place the actual code for a task in their own functions. This makes it easier to read and simplifies testing as you can pass test values directly into the functions. function myFunction() { console.log("Extract using method:", extractMethod); switch (extractMethod) { case "extractByCounty": console.log("Switch result is: extractByCounty"); var county = document.getElementById("sel_county").value; extractByCounty(county); break; case "extractByUnit": console.log("Switch result is: extractByUnit"); var unit = document.getElementById("sel_unit").value; extractByUnit(unit); break; default: console.log("Switch result (default) is: ", extractMethod); extractByPolygon(); break; } } function extractByPolygon(){ console.log("Run extractByPolygon code"); // code to extract by polygon } function extractByUnit(unit){ console.log("Run extractByUnit code:", unit); // code to extract by unit } function extractByCounty(county){ console.log("Run extractByCounty code:", county); // code to extract by county } Now It still does not transmit the value to the query in the switch statement. Not sure why this is - try a console.log (see code above) as the first line to see if it is being called. The jsbin version (http://jsbin.com/dimifaju) is working as expected in this regard. Owen www.spatialxp.com.au
... View more
06-02-2014
04:24 PM
|
0
|
0
|
2280
|
POST
|
I am hoping to use ArcGis Online to show how the area has changed over time In this case then it is probably a good idea to use a basemap with the same projection as ArcGIS Online - such as the World Street Map. That way no other re-projections are required. Owen www.spatialxp.com.au
... View more
06-01-2014
09:46 PM
|
0
|
0
|
1172
|
POST
|
This really depends on your accuracy requirements and the intended purpose of the georeferenced map. You can georeference any map image to a basemap. The result will end up with the spatial reference of the World Street Map basemap. Which may or may not be appropriate for your intended purpose. If you are after accuracy then you will get better results using other basemap data such as a road centers or a land parcels. It depends on what features are in your overlay map that you can use as georeferencing control points. Ideally, your overlay map and the basemap have shared features that can be used for control points. Owen www.spatialxp.com.au
... View more
06-01-2014
07:43 PM
|
0
|
0
|
1172
|
POST
|
In your code it appears that the only places that could cause the following error message:
TypeError: Unable to get property 'geometry' of undefined or null reference
Is when you attempt to read the geometry property of the first feature in a query task result set:
var AOI = featureSet.features[0].geometry; // Possible problem here if there are no features
Try checking that you have a result before attempting to access the geometry:
queryTask.execute(query, function (featureSet) {
if (featureSet.features.length === 0) {
alert("Query task did not return any features");
return;
} else {
var AOI = featureSet.features[0].geometry;
var graphic = new Graphic(AOI);
etc�?�
}
});
Without being able to test the code I am guessing that the two style property errors may be related to the first issue - as the API may be attempting to render a null geometry. Also, you are declaring the extractMethod variable 3 times. This is effectively overwriting the same variable each time.
var extractMethod = "extractByPoly";
var extractMethod = "extractByCounty";
var extractMethod = "extractByUnit";
Declare this variable once and then change the value via UI events. Owen www.spatialxp.com.au
... View more
05-27-2014
10:53 PM
|
0
|
0
|
1383
|
POST
|
I don't think the issue is with the locator, it looks like the schema lock is happening when the second process attempts to copy rows to the DBF file: CRWInspectionLogCopyRows = os.path.join(scratch,CRWInspectionLogCopyRows.dbf) ... if result == 0: arcpy.AddWarning("Process terminated."); sys.exit() else: # The next line is probably the cause of the schema lock: arcpy.CopyRows_management(CRWInspectionLog, CRWInspectionLogCopyRows, "") The DBF file will be locked by the first process and the second process will not be able to write to the same file while it is open. In your script this file would be the same for all users: E:\geoprocessing\Building\Outputworkspace\CRWInspectionLogCopyRows.dbf To avoid this on the server you should remove the line that specifically sets the scratchWorkspace: # 2. Set geoprocessing environment scratch = arcpy.env.scratchWorkspace arcpy.env.scratchWorkspace = r"E:\geoprocessing\Building\Outputworkspace" # - REMOVE this line arcpy.env.overwriteOutput = True Change to: # 2. Set geoprocessing environment scratch = arcpy.env.scratchFolder arcpy.env.overwriteOutput = True Then when simultaneous users run the script they each get a system generated job/scratch directory and the DBF files can be created without any locking issues. Alternatively, you could use some random temp file name for each DBF if you want to keep your specific scratchWorkspace. This way each process is writing to a different DBF file. Hope this helps. Owen www.spatialxp.com.au
... View more
05-26-2014
03:28 PM
|
0
|
0
|
725
|
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
|