POST
|
Thanks, Dan I will consider using other IDE, test the code properly and see what happens. Thanks again, appreciate your help (y)
... View more
07-16-2017
04:19 AM
|
0
|
0
|
107
|
POST
|
mmm.. actually, I am working with Nottbad ++ , but I just took the snapshot from the python window. I don't think I have indentation problem, I double checked. I tried your code but I it kept giving me a syntax error! I attached the code maybe this helps
... View more
07-16-2017
02:50 AM
|
0
|
0
|
734
|
POST
|
Thanks, Dan. I tried your code but It is giving me a syntax error. However, I found some logical errors & update it in the code above.
... View more
07-13-2017
07:14 AM
|
0
|
2
|
734
|
POST
|
Thanks, Ian & sorry for the late response That was really helpful. Right now I am facing this issue: >>> nearlist = ["C:\Adminstrative\CODES\WAREHOUSE_For_Testing\Matching_Model.gdb\\NEAR_1",\
... "C:\Adminstrative\CODES\WAREHOUSE_For_Testing\Matching_Model.gdb\\NEAR_2"]
...
... censuslist = ["C:\Adminstrative\CODES\WAREHOUSE_For_Testing\Matching_Model.gdb\\C2015_J1",\
... "C:\Adminstrative\CODES\WAREHOUSE_For_Testing\Matching_Model.gdb\\C2015_J2"]
... jcount=0
... kcount=0
... jnearcount=1
... knearcount=1
... lastjoindtable="C:\Adminstrative\CODES\WAREHOUSE_For_Testing\Matching_Model.gdb\\UNMATCHED" #assign the unmatched FC to lastjoindtable variable as start
... for j in nearlist:
... try:
... arcpy.env.qualifiedFieldNames = False
... j_inFeatures = lastjoindtable
... j_layerName = "J_tembjoin_" + str(jcount)
... j_joinTable = j
... j_joinField = "OBJECTID"
... j_joinField2= "NEAR_" + str(jnearcount) + ".IN_FID"
... outFeature = "Matching_Model.gdb"
... tempjoin= "Matching_Model.gdb" + "\\" + str(j_layerName)
... arcpy.MakeFeatureLayer_management (j_inFeatures, j_layerName)
... arcpy.AddJoin_management(j_layerName, j_joinField, J_joinTable, j_joinField2)
... arcpy.CopyFeatures_management(j_layerName, outFeature)
... jcount+=1
... jnearcount+=1
... for k in censuslist:
... k_inFeatures = tempjoin
... k_layerName = "k_tembjoin_" + str(kcount)
... k_joinTable = k
... k_joinField = "OBJECTID"
... k_joinField2= "C2015_J" + str(knearcount)+ ".NEAR_FID"
... outFeature = "Matching_Model.gdb"
... arcpy.MakeFeatureLayer_management (k_inFeatures, k_layerName)
... arcpy.AddJoin_management(k_layerName, k_joinField, k_joinTable, k_joinField2)
... arcpy.CopyFeatures_management(k_layerName, outFeature)
... lastjoindtable= "Matching_Model.gdb"+ "\\" + str(k_layerName)
... kcount+=1
... knearcount+=1
... except Exception as err:
... print(err.args[0])
...
Failed to execute. Parameters are not valid.
ERROR 000725: Output Layer: Dataset J_tembjoin_0 already exists.
Failed to execute (MakeFeatureLayer).
Failed to execute. Parameters are not valid.
ERROR 000725: Output Layer: Dataset J_tembjoin_0 already exists.
Failed to execute (MakeFeatureLayer).
>>> Appreciate if you could help me with that. Thanks,
... View more
07-13-2017
04:59 AM
|
0
|
4
|
734
|
POST
|
Thank you, Rachel ! I gave a shot on every possible option on the VRP layer & network analysis but nfortunately, This is not giving me the needed final result. I Think the model is the best solution tell now. Appreciate your support & inputs (Y)
... View more
07-13-2017
02:46 AM
|
0
|
0
|
657
|
POST
|
OK, I couldn't do it till now. But what we can do is to create a VRP Model to iterate on a DB, each FC is a group of points resamples route. The model will create the route & sequence with all the other VRP attributes for each FC. Then using some simple Python code yo can rename\ group all the routes & orders in 2 FC. Not the best way in the world but it can get the job - somehow to be - done. If anyone got updates on this question, or have a better solution we will appreciate his contribution. Thanks,
... View more
06-13-2017
05:56 AM
|
0
|
0
|
657
|
POST
|
Hi All, I hope someone could help me with such a simple question What I have: 1- A point FC each point represents a store the FC has a text column with the route it should be assigned to 2- list of routes with the same names in the VRP network layer 3- Depot location & name 4- Streets network What I don't have: 1- sequence of the orders within each route What I want: I want to create a route based on the attribute value inside the FC What I tried: 1- Preserve route using the name 2- creating a model to iterate & export that's the only way tell now to guarantee that each route will be created only for the needed orders. the output I have: The output I want: How to achieve such a simple thing from Esri network? I am sure somehow there is a way to achieve such a simple approach! Thanks,
... View more
06-11-2017
03:32 AM
|
0
|
3
|
1212
|
POST
|
let me describe it like this each 50 location will be photographed by a drone, each drone could only take 50 photos, no matter what is the distance to be crossed. this is not the real case but it's something similar to this. Thank you all for your answers and comments.
... View more
05-18-2017
06:59 AM
|
0
|
2
|
2597
|
POST
|
Thank you, Dan The points indeed are events collected along street network. 50 point is a must as this is the main purpose or request.
... View more
05-18-2017
06:17 AM
|
0
|
3
|
2597
|
POST
|
I am thinking maybe if I can do some equation on the variance of the coordinates. EX: I sort the longitude column and add other column "RANK_X" holding sequence from 1 to the last row then I did the same for the Latitude adding "RANK_Y" column, and by summing those two rank columns "SUM_COORD" I have a number that indicates the variance in coordinates if I sorted this column the first 50 suppose to be near to each other based on the variance of the coordinates. However, it's not the best approach and not giving the needed result in all the cases. see example below: Case1: Case2: do you think I might get something from this approach maybe enhance the result by adding something to the equation?
... View more
05-16-2017
03:28 AM
|
0
|
8
|
2597
|
POST
|
Hi All, I have a point FC I want to group every near 50 points together. I tried: 1-Near tool or generate near table tool but the overlap is a big problem. 2-Grouping analysis tool with K-means but the number of points within each group is varying depending on the spatial location. what I want is every near 50 point together in one group and only one group might be less than 50 points. I understand it might look something like this (restrict 50 point group) Thanks,
... View more
05-16-2017
01:44 AM
|
2
|
10
|
7488
|
POST
|
Thanks, Ian for your help, but I still don't get what you are saying in some points. let me give you the full picture or try to describe it in a better way: Second, you have several variables that you are using that have never been defined(layerName for example). Yes, as this only part of the code I declared them before. Third, you haven't set an environment variable so it won't recognize some of your variables unless you set an environment for it to look for them or use a fully qualified file path(outFeature for example). Although all the model working in the same workspace so as far as I understand I don't have to us the fully qualified file path. Fourth, for your j_joinTable and k_joinTable variables, you are redundant using an index to get the file name from the list. The placeholder variable you are using to iterator is the value of that filename and use can just use the placeholder as the input for j_joinTable and K_joinTable. If you follow my suggestion from above it would look like the following. j_joinTable = n_list k_joinTable = c_list This is also a little redundant but fits your convention for assigning variables. I didn't get this point. so what is the difference between the two I will be only adding a variable instead of using the index, could you please explain to me how this make a difference or send me any link that describes such a case. Fifth be consistent in your variable naming, you have J_joinField when you declare a variable, with the rest using a lowercase j, but then when you call it later, it uses the lower case j like I think you meant to. Ditto with the uppercase k at the end of your script, it's not a variable that's been declared before. Thank you, I fixed those issues. I am although attaching the full code to make it clear. Thank you.
... View more
05-03-2017
01:33 AM
|
0
|
6
|
734
|
POST
|
I am using Generate near tool to find the closest 25 match between unmatched FC & Census FC the output of the near tool is split into 25 tables with the rank value. I have: 1- 25 tables (NEAR_1, NEAR_2, NEAR_3...etc) each one have the same columns(IN_FID,NEAR_FID,TOP_RANK) 2- 25 FC Census data (C2015_J1, C2015_J2, C2015_J3...etc)is copies of Census FC 3- the original layers I ran the Near tools on (census FC, unmatched FC) What I need to do: 1- I want to create a table with all the data from the 25 near tables and the 25 census table to do that I have to: a)join the unmatched FC with the NEAR1 table b)join the result FC of step a) with the census FC c)repeat the same step for all the near tables and join the census on each one 2- using model builder I used something like the snapshot below Notice that the output of every line is the input for the next one 3- I am trying to write a python code to do the same but I am really struggling with it, I think it might be something like this: nearlist = ["C:\Adminstrative\CODES\WAREHOUSE_For_Testing\Matching_Model.gdb\\NEAR_1",\ "C:\Adminstrative\CODES\WAREHOUSE_For_Testing\Matching_Model.gdb\\NEAR_2"] censuslist = ["C:\Adminstrative\CODES\WAREHOUSE_For_Testing\Matching_Model.gdb\\C2015_J1",\ "C:\Adminstrative\CODES\WAREHOUSE_For_Testing\Matching_Model.gdb\\C2015_J2"] j=0 k=0 lastjoindtable="C:\Adminstrative\CODES\WAREHOUSE_For_Testing\Matching_Model.gdb\\UNMATCHED" #assign the unmatched FC to lastjoindtable variable for j in nearlist: try: arcpy.env.qualifiedFieldNames = False # Set local variables j_inFeatures = lastjoindtable j_layerName = "J_tembjoin_" + str(j) j_joinTable = nearlist j_joinField = "OBJECTID" j_joinField2= "NEAR_" + str(j+1) + ".IN_FID" outFeature = "Matching_Model.gdb" tempjoin= "Matching_Model.gdb" + "\\" + str(layerName) # Create a feature layer from the lastjoindtable featureclass arcpy.MakeFeatureLayer_management (j_inFeatures, j_layerName) # Join the feature layer to a table arcpy.AddJoin_management(j_layerName, j_joinField, J_joinTable, j_joinField2) # Copy the layer to a new permanent feature class arcpy.CopyFeatures_management(j_layerName, outFeature) j+=1 except Exception as err: print(err.args[0]) for k in censuslist: try: #"the output of the join in the small for will be assigned to last joind table variable which will be used as inbut in the big for" # Set local variables k_inFeatures = tempjoin k_layerName = "k_tembjoin_" + str(k) k_joinTable = censuslist k_joinField = "OBJECTID" k_joinField2= "C2015_J" + str(k+1)+ ".NEAR_FID" outFeature = "Matching_Model.gdb" # Create a feature layer from the lastjoindtable featureclass arcpy.MakeFeatureLayer_management (k_inFeatures, k_layerName) # Join the feature layer to a table arcpy.AddJoin_management(k_layerName, k_joinField, k_joinTable, k_joinField2) # Copy the layer to a new permanent feature class arcpy.CopyFeatures_management(k_layerName, outFeature) lastjoindtable= "Matching_Model.gdb"+ "\\" + str(layerName) k+=1 except Exception as err: print(err.args[0])
... View more
05-02-2017
08:50 AM
|
0
|
10
|
1272
|
POST
|
It's the same even if I copied the model to new tool box and tray to open it from arc catalog
... View more
04-06-2017
01:13 AM
|
0
|
0
|
665
|
POST
|
Thanks, Dan I had read the article before posting the question, but unfortunately, it is not covering the issue I faced. I created the model from scratch again but I will just leave this question here in case someone found a solution.
... View more
04-06-2017
01:11 AM
|
0
|
1
|
665
|
Title | Kudos | Posted |
---|---|---|
1 | 03-25-2017 12:53 PM | |
2 | 05-16-2017 01:44 AM |
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:24 AM
|