|
POST
|
I have 2 feature datasets in a .gdb (CNMS_Inventory and CNMS_Inventory_Albers). I set the dataset for CNMS_Inventory to 4269(NAD83) when I created it and it contains a feature class called S_Studies_County_Intersect_Merged . My goal is to basically change the projection of S_Studies_County_Intersect_Merged to North America Albers Equal Area Conic and write the output to the dataset (in the same gdb) called CNMS_Inventory_Albers (which was set to North America Albers Equal Area Conic ). I first tried just using CopyFeatures but it threw an error: cnms_inventory = os.path.join(all_regions_gdb, "CNMS_Inventory")
new_studs = os.path.join(cnms_inventory,"S_Studies_County_Intersect_Merged")
albers_ds = os.path.join(all_regions_gdb, "CNMS_Inventory_Albers")
albers_studs = os.path.join(albers_ds, "S_Studies_Ln_Merge_Albers")
albers_unmapped = os.path.join(albers_ds, "S_Unmapped_Ln_Merge_Albers")
arcpy.CopyFeatures_management(new_studs, albers_studs) Error Traceback: ExecuteErrorTraceback (most recent call last) in () 2 albers_studs = os.path.join(albers_ds, "S_Studies_Ln_Merge_Albers") 3 albers_unmapped = os.path.join(albers_ds, "S_Unmapped_Ln_Merge_Albers") ----> 4 arcpy.CopyFeatures_management(new_studs, albers_studs) C:\Program Files (x86)\ArcGIS\Desktop10.5\arcpy\arcpy\management.py in CopyFeatures(in_features, out_feature_class, config_keyword, spatial_grid_1, spatial_grid_2, spatial_grid_3) 2584 return retval 2585 except Exception as e: -> 2586 raise e 2587 2588 @gptooldoc('DeleteFeatures_management', None) ExecuteError: ERROR 000224: Cannot insert features Failed to execute (CopyFeatures). I figured that this maybe due to the fact that the output feature, new_studs ( S_Studies_Ln_Merge_Albers ) needs to be projected into Albers first (I was thinking I maybe cannot just write a NAD83 projected feature to an Albers projected dataset). So I tried the following which gives be another error: sr = arcpy.SpatialReference(4269)
projection = arcpy.SpatialReference('North America Albers Equal Area Conic')
arcpy.Project_management(new_studs, albers_studs, out_coor_system=projection, in_coor_system=coord_sys) ExecuteError: ERROR 000210: Cannot create output T:\CCSI\TECH\FEMA\Datasets\CNMS\FY18Q3\CNMS_AllRegions_FY18Q3.gdb\S_Studies_Ln_Merge_Albers Failed to execute (Project). Looking at this error, it seems like Project is trying to write my output to "T:\CCSI\TECH\FEMA\Datasets\CNMS\FY18Q3\CNMS_AllRegions_FY18Q3.gdb\S_Studies_Ln_Merge_Albers" instead of "T:\\CCSI\\TECH\\FEMA\\Datasets\\CNMS\\FY18Q3\\CNMS_AllRegions_FY18Q3.gdb\\CNMS_Inventory_Albers\\S_Studies_Ln_Merge_Albers" , which basically leaves out the feature dataset CNMS_Inventory_Albers . Can anyone see where I am going wrong here or how I can fix this?
... View more
11-03-2019
05:17 PM
|
0
|
0
|
1080
|
|
POST
|
OK, lets say you want to make sure that the char length of all string fields called 'REGION' are 4 characters using field mapping? This needs to be done during the merge.
... View more
10-30-2019
11:21 AM
|
0
|
1
|
2379
|
|
POST
|
I am using arcpy to merge multiple feature classes from a list of feature classes. They all have the same fields. Let's say they all have the fields = ['CO_FIPS', 'MILES', 'FLOOD_ZONE', 'VALID', 'REGION'] . However, I only want to include 'CO_FIPS', 'MILES', and 'FLOOD_ZONE' in the output merged feature class. It seems I need to use field mapping to limit the fields in my output, but I am not 100% how to do that: working_dir = r"C:\Projects\MyProj\stream_lines.gdb"
arcpy.env.workspace = working_dir
s_studies_for_merge = ['stream1', 'stream2', 'stream3']
fieldMappings = arcpy.FieldMappings()
merged_output = os.path.join(working_dir, "AllStreams")
fieldMappings.addTable('stream1')
for field in fieldMappings.fields:
if field.name not in ['CO_FIPS', 'MILES', 'FLOOD_ZONE']:
fieldMappings.removeFieldMap(fieldMappings.findFieldMapIndex(field.name))
arcpy.Merge_management(s_studies_for_merge, merged_output, fieldMappings) My confusion is mainly that most examples show only 2 features being merged and that the mapping involves settings that I don't need for certain fields. I only want to exclude the fields I don't want and keep the fields I do. What do I need to do here?
... View more
10-30-2019
05:42 AM
|
0
|
5
|
2652
|
|
POST
|
I am "dijit/TooltipDialog" and "dijit/popup" in my web mapping app on a few geojson layers. dialog = new TooltipDialog({
id: "tooltipDialog",
style: "position: above; width: 175px; font: normal normal normal 10pt Helvetica;z-index:100"
});
dialog.startup();
....
_getGeoJson: function (geojson) {
// Check data
if (geojson.type !== "FeatureCollection" || !geojson.features) {
console.error("GeoJsonLayer Error: Invalid GeoJSON FeatureCollection. Check url or data structure.");
return;
}
// Convert GeoJSON to ArcGIS JSON
var arcgisJson = this._terraformerConverter(geojson);
// Add graphics to layer
this._addGraphics(arcgisJson);
//Add tooltip on mouse-over
this.on("mouse-over", function (evt) {
var content = esriLang.substitute(evt.graphic.attributes);
dialog.setContent(content);
domStyle.set(dialog.domNode, "opacity", 0.9);
dijitPopup.open({
popup: dialog,
x: evt.pageX,
y: evt.pageY
});
});
//Remove tooltip on mouse-out
this.on("mouse-out", function (evt) {
//map.graphics.clear();
dijitPopup.close(dialog);
});
} All of this works fine...if the browser console (the developer's console) is open. No problems, tooltips display and disappear as you mouse over or mouse out of the respective layers. However, if the console is not open, there is a 10-30 second delay before the tooltips will appear and if the extent is changed, or you pan, or you zoom in/out, the delay also occurs. No bugs are being thrown and, like I said, it doesn't occur when the browser console is open, so its kinda hard to debug. Note: I am running this in an ASP.Net app from my local (its not on a server yet) using arcGIS Javascript API 3.29 and related dependencies. Why would this occur and how might I resolve it?
... View more
10-01-2019
08:39 AM
|
0
|
0
|
937
|
|
POST
|
OK, it seems like its been marked as correct. Thanks again.
... View more
09-29-2019
04:13 PM
|
0
|
0
|
1418
|
|
POST
|
Doh! You're right Robert. I just added this after my "mouse-over" listener and it worked. Thanks! this.on("mouse-out", function (evt) { dijitPopup.close(dialog); });
... View more
09-25-2019
08:17 AM
|
0
|
2
|
1418
|
|
POST
|
I have an application that needs a popup on a layer during mouse-over . I am trying to use the Dijit Popup define(["dojo/_base/declare","esri/graphic","esri/layers/GraphicsLayer","esri/InfoTemplate",.."esri/lang","dojo/_base/url","dojo/_base/lang","dijit/TooltipDialog","dijit/popup","dojo/dom-style","dojo/domReady!" ], function (declare, Graphic, GraphicsLayer, InfoTemplate, esriLang, Url, lang, TooltipDialog, dijitPopup, domStyle) {return declare([GraphicsLayer], { .... The popup does display during the listening event, but it never goes away when the user mouses over a new feature. I am trying to use the example from this demo, but something is not quite right. First here is the error I get: Error: Tried to register widget with id==tooltipDialog but that id is already registered And here is the code I am trying to apply in my app. Any suggestions on how to get this to work? ***Note: 'this.' is a GraphicLayer . Also, I am using api 3.29 (not the latest version - I am refactoring an old app). .... dialog = new TooltipDialog({ id: "tooltipDialog", style: "position: absolute; width: 250px; font: normal normal normal 10pt Helvetica;z-index:100" }); dialog.startup(); this.on("mouse-over", function (evt) { var content = esriLang.substitute(evt.graphic.attributes); dialog.setContent(content); domStyle.set(dialog.domNode, "opacity", 0.85); dijitPopup.open({ popup: dialog, x: evt.pageX, y: evt.pageY }); //this.setInfoTemplate(options.infoTemplate || new InfoTemplate("GeoJSON Data", "${*}")); function closeDialog() { map.graphics.clear(); dijitPopup.close(dialog); } });
... View more
09-25-2019
07:04 AM
|
0
|
4
|
1494
|
|
POST
|
Side note: I set up a proxy prior to placing everything in ASP.Net. That did not work either. -JB
... View more
08-26-2019
06:34 AM
|
0
|
0
|
6220
|
|
POST
|
I was not able to get the API to return solely with a client-side solution, nor using IIS alone. After speaking directly with the API creator, I determined that the only way to resolve the issue on our side was by adding server-side code. Once I placed the application within an Asp.Net/C# framework and created an .asmx file to serve WebServices/WebMethods, I was able to authenticate and get the API to return correctly. I passed the user/password credentials in the Web.Config file first. I still have a javascript file that uses esriRequest, but it calls the WebService and WebMethod in my .asmx file and everything works. -JB
... View more
08-26-2019
06:32 AM
|
0
|
1
|
6220
|
|
POST
|
I have an API that uses Basic Authentication (Username, Password). I am trying to use this in an esriRequest to pull back the JSON data object from the GET request. To test this (and potentially avoid CORS issues), I am running this on my localhost (IIS). I have already set my IIS Default WebSite HTTP Response Headers to Access-Control-Allow-Origin: '*' . However, I am still getting the following error in my esriRequest : Access to XMLHttpRequest at 'https://ria.azurewebsites.net/api/ria/event?Username=myUsername&Password=myPassword' from origin 'http://localhost' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. This error gets thrown in both Chrome and Firefox.I even tried adding withCredentials: true to my request, but it then throws an additional error: Cross-Origin Read Blocking (CORB) blocked cross-origin response with MIME type application/json. At the top of my code, I have also added: esriConfig.defaults.io.corsEnabledServers.push("ria.azurewebsites.net"); , which has resolved this CORS issue for other APIs in my application, but not this one. I have tried several configurations, but my current code uses a precallback function and .setRequestPreCallback() method. As you can see in the commented out attributes, I've also tried to pass 'Username' and 'Password' as content too. I have tested the general GET Request in Swagger UI and it comes back just fine. Is there something I am missing here; something else I need to do in order for this to work?: function floodCallbackFunction(ioArgs){
if (ioArgs.url.indexOf("https://ria.azurewebsites.net") > -1) {
ioArgs.headers.Username = "myUsername";
ioArgs.headers.Password = "myPassword"; // add custom headers
}
return ioArgs;
}
....
esriRequest.setRequestPreCallback(floodCallbackFunction);
var evnts;
var eventRequest = esriRequest({
withCredentials: true,
url: "https://ria.azurewebsites.net/api/ria/event",
content: {
// "Username": "myUsername",
// "Password": "myPassword"
},
dataType:"jsonp",
handleAs: "json"});
eventRequest.then(function(resp) {
evnts = resp;
console.log(evnts);
console.log("Success: ", evnts);
}, function(error) {
console.log("Error: ", error.message);
});
... View more
07-28-2019
01:12 PM
|
0
|
7
|
10264
|
|
POST
|
I'm going to try that (queryTask) and then repost if I have similar questions.
... View more
07-26-2019
06:33 AM
|
0
|
0
|
1104
|
|
POST
|
Question: since I am basically just trying to get the value of a single field from a single feature on my map service, would it be easier to use `Query` and `QueryTask`? Also, what you're saying is that I can't simply plug in an x, y coordinate into .geometry? I need to initialize it as an ESRI point first? So, something like this: var spatRef = new esri.SpatialReference({wkid:4326});
var point = new Point(additionalInfo["pointGeomOfInterest"].x, additionalInfo["pointGeomOfInterest"].y, spatRef); I assume SR = spatial reference.
... View more
07-26-2019
06:09 AM
|
0
|
2
|
1104
|
|
POST
|
I have a simple map service API that serves a grid feature and I want to grab an attribute ("Grid_Cell2") that has the grid cell name when the user clicks a button. The grid feature has start and end points (x, y) for each cell and a field called "Grid_Cell2" which is basically the grid cell name (ex: "Grid_Cell49_19"). I am already capturing my x, y for the mouse click on the map in my application. The examples I have seen for IdentifyTask and IdentifyParameters generally show the .executefor the IdentifyTask method being launched when the user clicks on the map (ex:map.on("click", executeIdentifyTask);`) and then populating a popup. I only want to grab the desired feature based on the users x, y (which I have already captured in a variable) when the user clicks the button. Assume I have already added the required module and function and initialized the function at the top: document.getElementById("btnGetInterval").onclick = function () {
var point = additionalInfo["pointGeomOfInterest"]; //this is an x, y coordinate captured earlier in my code from the user's mouse click on the map
identifyTask = new IdentifyTask(grid_url);
identifyParams = new IdentifyParameters();
identifyParams.geometry = point;
identifyParams.returnGeometry = false; //I don't want to return any geometry
identifyParams.layerOption = IdentifyParameters.LAYER_OPTION_ALL; //Not sure about this. I just want to return the one feature for the grid cell whose boundaries my user's mouse click (x, y) falls within.... From here, I'm honestly not sure where to go; I assume I want to use a .execute statement but I am not sure how the `IdentifyParameters come into play. I also may need an empty var/array/list to hold the returned value (["Grid_Cell2"]). Any suggestions here?
... View more
07-26-2019
05:09 AM
|
0
|
4
|
1158
|
|
POST
|
That looks great Jack; thanks! BTW,for Grid Cell 22, -74.5055 should be between the start lon: -74.505495and end lon: -74.505793.
... View more
07-11-2019
09:40 AM
|
0
|
1
|
1238
|
|
POST
|
Suppose I have an application that will utilize a grid with 1 x 1 mile cells (approx. 4 sq miles). This application already uses the ArcGIS API for JS. The grid's geoJson data essentially looks like this: [ { "Grid Cell Number": 21, "Grid Cell State": "NJ", "Grid Cell Name": "Grid26_2", "Grid Cell Area SqMi": 2.39808504259641, "Grid Cell Centroid Longitude": -74.5457211209226, "Grid Cell Centroid Latitude": 41.2799557125122, "Grid Cell Start Point Longitude": -74.523164, "Grid Cell Start Point Latitude": 41.278898, "Grid Cell End Point Longitude": -74.525255, "Grid Cell End Point Latitude": 41.279889, "Event Name": "Superstorm Sandy NY", "NOAA Tidal Gage Station ID": "8518750", "Max_NOAA_Tidal_Gage_Water_Level_ft_MSL": "11.49", "Oldest Tidal Gage Data": "2010-01-01", "Return Period": "6315.03" }, { "Grid Cell Number": 22, "Grid Cell State": "NJ", "Grid Cell Name": "Grid27_2", "Grid Cell Area SqMi": 0.26600197470632, "Grid Cell Centroid Longitude": -74.5172506948515, "Grid Cell Centroid Latitude": 41.2733184226687, "Grid Cell Start Point Longitude": -74.505495, "Grid Cell Start Point Latitude": 41.270536, "Grid Cell End Point Longitude": -74.505793, "Grid Cell End Point Latitude": 41.270684, "Event Name": "Superstorm Sandy NY", "NOAA Tidal Gage Station ID": "8518750", "Max_NOAA_Tidal_Gage_Water_Level_ft_MSL": "11.49", "Oldest Tidal Gage Data": "2010-01-01", "Return Period": "6315.03" },... My question then is, using the Grid Cell Start/End Point Lat/Long and the x, y coordinates I am capturing in my mouse click, what method would allow me to find the Grid Cell Number 22 if my mouse click lat = 41.27061 and long = -74.5055?
... View more
07-10-2019
11:17 AM
|
0
|
3
|
1312
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 03-19-2021 01:41 PM | |
| 1 | 11-05-2019 07:44 AM | |
| 1 | 11-05-2019 09:58 AM | |
| 1 | 01-06-2021 05:41 AM | |
| 1 | 12-24-2020 06:48 AM |
| Online Status |
Offline
|
| Date Last Visited |
03-19-2022
10:13 PM
|