POST
|
And because the more recent FC has lines near ACN_Select, even the distance limiter now works. Thanks so much, Dan.
... View more
07-21-2017
05:30 AM
|
0
|
0
|
274
|
POST
|
I found out about the differences in distances. I am working with a map document that is stored on a share. One of my colleagues has been working with it too and imported the old Derden FC in the gdb. The layer in the map, however, was the latest one. So everytime I used the layer, the distances were smaller, because this layer is more complete than the FC in the gdb and in this layer there are lines closer to ACN_Select. Sorry for wasting your time on this. I learned a lot, though. I guess we must conclude that the distance limiter in the Near_analysis does not work for me, but I can live with that. I can filter the ones within 150 meters afterwards. Thank you so much for your input. I would never have found all this without your help.
... View more
07-21-2017
05:12 AM
|
0
|
2
|
1387
|
POST
|
Hi Dan, I removed the "150 Meters" and ran it through the Python command line and... the fields were filled. However, the numbers within the NEAR_DIST make no sense. Like the first row in my example is 149 meters, in the new table this comes down to 3145. I tried to find which unit would translate from this figure to the other, but çan't find it. So it seems that in the map view the distance limiter works, because the distance unit of the map and the feature classes is meters, as it should be with RD New. But somehow, when the script is ran outside the map, it starts using different distance units (different projection ?). So perhaps I should look into setting the projection right in the script? Also the NEAR_FiD is different. Which is strange, because, no matter which coordinate system one would use, the line closest to my point should remain the same. Shouldn't it?
... View more
07-21-2017
12:18 AM
|
0
|
4
|
1387
|
POST
|
Hi Joshua, Thanks for responding. It took me a while to find Python command line and how to copy the text, but I did. It ran very quickly indeed, but with the same results. It does makes the fields NEAR_FID and NEAR_DIST, but fills them both with "-1".
... View more
07-20-2017
11:40 PM
|
0
|
0
|
274
|
POST
|
Hi Dan, I really appreciate your advice! The mdb is because, further on in the script, I export the tables from the altered ACN_Select to this mdb. I removed that from the script above, because it would make it confusing. But forgot to remove it as workspace. However, I changed it to gdb for the results of the near_analysis, but the problem with the NEAR_FID and NEAR_DIST remain the same... So strange: it works fine in the Python window in ArcMap. By the way, ACN_Select contains points and Derden contains lines. I try to get the distance from each point to the nearest line feature, being restricted to points within 150 meters froma line feature.
... View more
07-20-2017
03:23 AM
|
0
|
6
|
1387
|
POST
|
Hi Dan, thanks for your suggestion. I did and they are both RD New (Dutch system) in the gdb.
... View more
07-19-2017
10:34 PM
|
0
|
8
|
1387
|
POST
|
When I run >>>arcpy.Near_analysis("ACN_Select","Derden","150 Meters", "NO_LOCATION", "NO_ANGLE","PLANAR") in the python window in ArcMap 10.4, it returns the correct numbers in the field NEAR_DIST. However, if I run the same in PyScripter: import arcpy arcpy.env.workspace = "C:\\Geoplay\\GLO\\Output.mdb" arcpy.env.overwriteOutput = True if arcpy.CheckExtension("Spatial") == "Available": arcpy.AddMessage("Checking out Spatial") arcpy.CheckOutExtension("Spatial") else: arcpy.AddError("Unable to get spatial analyst extension") arcpy.AddMessage(arcpy.GetMessages(0)) sys.exit(0) ACN_Select = "C:\\Geoplay\\GLO\\GLO.gdb\\ACN_Select" Derden = "C:\\Geoplay\\GLO\\GLO.gdb\\Derden" #Near Analysis arcpy.Near_analysis(ACN_Select,Derden,"150 Meters","NO_LOCATION","NO_ANGLE","PLANAR") print "Ready!" All the NEAR_FID and NEAR_DIST are -1. I tried creating layers and using those, but it didn't work. Also I tried setting the spatial ref with spatRef = arcpy.Describe(ACN_in).spatialReference but it did not change anything. What am I missing?
... View more
07-19-2017
06:48 AM
|
0
|
12
|
2675
|
POST
|
The syntax I made has disappeared in my first answer, so here it is again: ------------------------------------------------------------------ import arcpy arcpy.env.overwriteOutput = True arcpy.env.workspace = r"c:/ArcGISdata" arcpy.ImportToolbox(r"c:/ArcGISdata/Workshop.tbx") arcpy.Workshopmodel_TestAlias print "Script finished" ---------------------------------------------------------------- In which Workshop.tbx is the real name of the toolbox, TestAlias is the alias of the toolbox and Workshopmodel is the name of the model I want to run.
... View more
04-14-2016
02:23 AM
|
0
|
0
|
950
|
POST
|
Hi Rebecca, Wow, that is quick! Thanks ever so much for responding so promptly. Your remark about creating Python scripts is correct, but in my case, I have to automate a big bunch of models, that I ‘inherited’ from a colleague that was very productive. Since he has left already, I struggle most with finding all the input data, for he has been very creative. So, in order to make some quick progress, it seemed a good idea to, for now, prepare python scripts to execute the models and schedule those. This would buy me time to fully work them out in ArcPy. Now, in my script I thought this would be the syntax:
... View more
04-14-2016
12:49 AM
|
0
|
1
|
950
|
POST
|
Recently I found some info about how one can access models in toolboxes using arcpy. The command for accessing the toolbox is arcpy.ImportToolbox. But it is not clear to me, how to run the model, which command to use. E.G. I have a toolbox called ‘UpdateModels.tbx’. In this toolbox I have created a model called ‘FirstStepUpdate’. The way to access the model would be arcpy.ImportToolbox('c:/ArcGIS/ UpdateModels.tbx; FirstStepUpdate') But how do I get arcpy to execute the model?
... View more
04-13-2016
11:51 PM
|
0
|
5
|
5277
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:24 AM
|