POST
|
This is good advice. Instead of working from VS Code, I opened up the Pro Project's Python IDE. I then renamed the other nonactive maps to something else, so that I can access the true "Mines" map from the Project.
... View more
12-23-2021
08:54 AM
|
1
|
0
|
5441
|
POST
|
No other maps exist in catalog pane. I think the issue is somehow connected to the fact that this Pro project was created from a map package file. Somehow that created duplicate maps that I can't see listed in the tabs or catalog pane.
... View more
12-23-2021
08:51 AM
|
0
|
0
|
5441
|
POST
|
You're absolutely right. A million things that could go wrong, and I don't want to mess up my original Project file.
... View more
12-23-2021
07:24 AM
|
0
|
0
|
4006
|
POST
|
I'm using ArcPy to iterate through maps in a Pro project. I have only one map in the Project called "Mines". However, when I use listMaps to iterate through the maps in the aprx, it returns two values called "Mines". Any ideas why this is? Furthermore, if I list all the layers in each "Mines" map, the layers are slightly different. The first Mines map in the list contains layers that I actually deleted from the Pro Project, but the second one doesn't have this problem. And yes, I saved the Pro Project. Here's the code: aprx = arcpy.mp.ArcGISProject(path_to_project)
for mp in aprx.listMaps("Mines"):
print(mp.name) Really strange. Someone tell me I'm not in the Twilight Zone.
... View more
12-22-2021
03:14 PM
|
0
|
6
|
5547
|
POST
|
I used save() instead of saveACopy() so that I can work with the same aprx file. Seems to work fine with save() after some troubleshooting now. If any issues, pop back up, I'll have to try the saveACopy() method instead, which I believe is what you're suggesting. Thanks!
... View more
12-22-2021
12:04 PM
|
0
|
2
|
4025
|
POST
|
I had a break statement in the look to stop the loop after the first layer, and had already removed the base layers... I think the issue was that the data source on Pro's layers weren't getting updated in the Pro instance I had open. Once I closed it, ran the script, opened it back up again, it works as it should. Must have been just a lock issue.
... View more
12-22-2021
11:30 AM
|
1
|
0
|
4030
|
POST
|
I'm saving the Pro Project, but not using saveACopy(), but updateConnectionProperties doesn't seem to work. I'm updating the connectionProperties dict and replacing the original with the new dict. Any ideas on how or what to fix? aprx = arcpy.mp.ArcGISProject(project_path)
for mp in aprx.listMaps("Map Name 1"):
for lyr in mp.listLayers():
# export out to file geodatabase with new name
cp = lyr.connectionProperties
cp['connection_info']['database'] = output_db #output db path+name
cp['dataset'] = lyr_longName
lyr.updateConnectionProperties(lyr.connectionProperties, cp)
aprx.save()
... View more
12-22-2021
09:40 AM
|
0
|
4
|
4033
|
POST
|
I have an ArcGIS Pro Project containing layers that have shapefiles as sources. I wrote a script using ArcPy to convert this data to File Geodatabases. Everything works fine here without any issues. The next step I want to take is replace the data sources of the same layers that I exported, so that they will be referencing the new file location in the File GDB. The best (and only?) way to replace the data source and dataset name is to use Layer.replaceDataSource . But when I use this Layer method, I get this error: AttributeError: 'Layer' object has no attribute 'replaceDataSource' This is because replaceDataSource is a method found only in arcpy.mapping's Layer class. In other words, I'd need to use an ArcMap map document to utilize this method, instead of Pro. Is there a way to do this using arcpy.mp library? Are there any other ways to achieve what I'm trying to do in ArcGIS Pro with ArcPy? Thank you for the help!
... View more
12-21-2021
02:54 PM
|
0
|
11
|
4817
|
POST
|
Thanks, @JamesBallard1 ! This worked perfectly. I swear I must've looked over the methods in GeometryEngine a few times, but still missed these!
... View more
07-06-2021
12:51 PM
|
0
|
0
|
1252
|
POST
|
I have an app in AppStudio that contains a map with several feature layers. The user for the application will be interacting with the layers and submitting data from app to elsewhere. I want the user to be able to click on the map (it will never be exact, therefore reasonably close) near a line feature and retrieve the coordinates for the nearest point on the line. For example, user clicks on or near the polyline feature. This creates a Graphic that is snapped to the nearest point on the polyline feature. This allows the app to retrieve coordinates where the user tapped on the feature. This is the workflow I would like to implement: 1) User clicks on or near polyline feature 2) Get the coordinates for the point that user tapped on and calculate distance x to polyline feature (using Geometry Engine's distance method). 3) Plot point on line that is x distance away from tapped point to line feature. 4) Place a Graphic on this final point on the line feature to indicate that the snapping has completed. How can I achieve step 3? I have a distance that I can calculate successfully. Is the best way to do this by calculating a buffer with x radius and then finding points of intersection with the line feature? Or is there a better way? All I want to do is just snap this point that is not on the line to the line. Thanks for the help!
... View more
07-02-2021
01:04 PM
|
0
|
2
|
1330
|
POST
|
Thanks @JamesBallard1! This looks promising. I didn't realize there was a geometry property in QueryParameters that I could set. And I could see how I'll be working with significantly less features to iterate through if I'm working with the intersected subset of features. I'll give this a go and post a reply on how it goes.
... View more
04-23-2021
01:55 PM
|
0
|
0
|
1482
|
POST
|
I'm working on an AppStudio app that works offline. The app's webmap is created from an MMPK and contains a point layer that the user can interact with. Here's what I want to do: I want to click on the map (outside the layer and its features) and find the geographically nearest point feature in the layer to the point that I clicked. This seems like a pretty reasonable thing to want to do, but the GeometryEngine doesn't perform well in this scenario due to the large number of point features in this layer. Here's what I've tried or thought about trying, but doesn't work. 1. Create a buffer polygon for a fixed distance around the point that I click. Find all features in the feature layer that intersects with buffer polygon. Find distances between original point and each of the intersected features. Sort these distances to find the feature that is closest to the point that I clicked on. This doesn't work because my feature layer has 120,000 point features. If I iterate through each of them to check if they intersect with my buffer polygon, it can take a LONG time. 2. I've thought about using ClosestFacilityTask, but this requires an online connection. So not an option for me. Ideally, I guess I would've liked a Runtime method I can call where I input in these parameters: 1) original point's geometry and 2) feature layer. This would return a single feature that is closest to my point. But this is not a Runtime feature AFAIK. Does anyone else have any ideas on how to proceed here? Any help appreciated.
... View more
04-22-2021
03:18 PM
|
0
|
3
|
1558
|
POST
|
Hi Erwin, this worked without issue. FileDialog opens to assets-library directory without crashing the app when building our custom Player app using Cloud Make 4.4, instead of Local Make. Thank you for your help!
... View more
04-08-2021
07:56 AM
|
0
|
0
|
1270
|
POST
|
Thank you for the response, Erwin. We've built a version using Cloud Make and are about to test this to see if issues persist. I will update the status here once it's ready.
... View more
03-26-2021
01:42 PM
|
0
|
0
|
1300
|
Title | Kudos | Posted |
---|---|---|
1 | 12-12-2024 08:04 AM | |
2 | 12-06-2024 05:09 PM | |
2 | 12-06-2024 03:17 PM | |
2 | 12-05-2024 09:57 AM | |
1 | 06-07-2023 10:06 AM |
Online Status |
Offline
|
Date Last Visited |
3 weeks ago
|