POST
|
All, What is the syntax for quire in Solve Vehicle Routing Problem tool? I am trying to make several routs using the Solve Vehicle Routing Problem in ArcPro. I ran the analysis but, because of it scale it took 14 hours. That run did not produce a satisfactory result. To tweak the criteria, I was going to run the analysis on only one zone. (the zones are preexisting and they want the routs to fall with in the zones.) Instead of exporting destination points in each zone, I was going to use the query under the network location to limit destination points to one zone via an attribute in the destination point feature class for the zone it is in. I could not find any reference on the syntax used for the query so I tried zone=1 (Zone is the name of the field) . Overnight , the analysis was ran again. Instead of a route for zone one only. it the script failed. the error message was: ERROR 030213 parameter(s) are not valid ( Feature locator WHERE Clause"). I want to make sure the syntax in the quire is correct . please help. LCONNER_MACON
... View more
07-06-2020
10:00 AM
|
0
|
1
|
1455
|
POST
|
my code is: print "running..."
import arcpy
import arcpy, os
from arcpy import env
import os
import os.path
env.workspace =r"P:\\GIS Public\\Projects\\Meter Zones\\route_polygons\\route_polygons.mxd"
global shp
shp = ".shp"
global tif
shp = ".tif"
x=1
in_features= r'P:\\GIS Public\\Projects\\Meter Zones\\route_polygons\\meters.shp'
out_layer = 'meters_temp'
arcpy.MakeFeatureLayer_management (in_features, out_layer,)
in_features2= r'P:\\GIS Public\\Projects\\Meter Zones\\route_polygons\\parcels.shp'
parcles_temp = 'parcles_temp'
arcpy.MakeFeatureLayer_management (in_features2, parcles_temp,)
while x <= 2:
import arcpy
import arcpy, os
from arcpy import env
import os
import os.path
# slection fuction: select meters with x for cycle/ route
layer = out_layer
criteria = 'route_sequ =' + str(x)
arcpy.SelectLayerByAttribute_management (layer,'NEW_SELECTION',criteria)
#slect by location: select parcles by selected meters
in_layer = parcles_temp
selector = out_layer
distance = 60
arcpy.SelectLayerByLocation_management (in_layer,select_features = selector, search_distance=distance )
#copy features to shape file
in_features = parcles_temp
out_feature_class = r"P:\\GIS Public\\Projects\\Meter Zones\\route_polygons\\" + str(x) + shp
arcpy.CopyFeatures_management(in_features, out_feature_class)
#merge polpgons in to 1
in_features = r"P:\\GIS Public\\Projects\\Meter Zones\\route_polygons\\" + str(x) + shp
out_feature_class = r"P:\\GIS Public\\Projects\\Meter Zones\\route_polygons\\" + str(x)+'merge' + shp
arcpy.Dissolve_management (in_features, out_feature_class, multi_part='MULTI_PART')
# add feild
in_table = out_feature_class
field_name = "Route"
field_type = 'TEXT'
arcpy.AddField_management (in_table, field_name, field_type, field_length=10)
#populate feild
in_table =out_feature_class
field= "Route"
expression = x
arcpy.CalculateField_management (in_table, field, expression)
#add cycle feild
in_table = out_feature_class
field_name = "Cycle"
field_type = 'TEXT'
arcpy.AddField_management (in_table, field_name, field_type, field_length=10)
#apend in to database
inputs = out_feature_class
target = r"P:\\GIS Public\\Projects\\Meter Zones\\route_polygons\\route_polygons.shp"
arcpy.Append_management (inputs, target, schema_type='NO_TEST')
# expoert to raster
in_features =r"P:\\GIS Public\\Projects\\Meter Zones\\route_polygons\\" + str(x)+'merge' + shp
value_field = "Route"
out_rasterdataset = r"P:\\GIS Public\\Projects\\Meter Zones\\route_polygons\\TIFF" + str(x) + ".tif"
arcpy.PolygonToRaster_conversion (in_features, value_field, out_rasterdataset)
print x
x=x+1
print "done" everything works except for the last function PolygonToRaster. the error i get is: Traceback (most recent call last): File "P:\GIS Public\Projects\Meter Zones\route_polygons\make_route_pologons.py", line 53, in <module> arcpy.Dissolve_management (in_features, out_feature_class, multi_part='MULTI_PART') File "C:\Program Files (x86)\ArcGIS\Desktop10.2\arcpy\arcpy\management.py", line 4192, in Dissolve raise e ExecuteError: Failed to execute. Parameters are not valid. ERROR 000732: Input Features: Dataset P:\\GIS Public\\Projects\\Meter Zones\\route_polygons\\1.tif does not exist or is not supported Failed to execute (Dissolve). i need to export the files in to a TIFF file. i know something wrong with the line out_rasterdataset = r"P:\\GIS Public\\Projects\\Meter Zones\\route_polygons\\TIFF" + str(x) + ".tif". can you help with the syntax? thank you
... View more
07-07-2017
02:25 PM
|
0
|
5
|
1733
|
POST
|
in my python script I have a parcels polygon shp file generated by CopyFeatures_management. I then want to close the gaps, where the roads are between the individual polygons in the same shp file. From what I know the Integrate_management is what I need, however I can not get the tool to work. can Integrate_management work on shp files? If it can, could you provide an example. I have looked at the example on the integrate_management page and still can not get the tool to run. please be specific and tell me if something like '60 feet' vs '60 ft' will be the difference of it running or not. If not, what other tool should I run to accomplish this? there are over 60,000 parcels/ polygons so it is way to large to do by hand. Any help is appreciated, thank you.
... View more
07-07-2017
08:04 AM
|
0
|
1
|
1178
|
POST
|
my script is [noparse] print "running..." import arcpy import arcpy, os from arcpy import env import os import os.path env.workspace =r"P:\\GIS Public\\Projects\\Meter Zones\\route_polygons\\route_polygons.mxd" global shp shp = ".shp" x=1 in_features= r'P:\\GIS Public\\Projects\\Meter Zones\\route_polygons\\meters.shp' out_layer = 'meters_temp' arcpy.MakeFeatureLayer_management (in_features, out_layer,) in_features2= r'P:\\GIS Public\\Projects\\Meter Zones\\route_polygons\\parcels.shp' parcles_temp = 'parcles_temp' arcpy.MakeFeatureLayer_management (in_features2, parcles_temp,) while x <= 2: import arcpy import arcpy, os from arcpy import env import os import os.path # slection fuction: select meters with x for cycle/ route layer = out_layer criteria = 'route_sequ = x' arcpy.SelectLayerByAttribute_management (layer,'NEW_SELECTION',criteria) #slect by location: select parcles by selected meters in_layer = parcles_temp selector = out_layer arcpy.SelectLayerByLocation_management (in_layer,select_features = selector ) #copy features to shape file in_features = parcles_temp out_feature_class = r"P:\\GIS Public\\Projects\\Meter Zones\\route_polygons\\" + str(x) + shp arcpy.CopyFeatures_management(in_features, out_feature_class) #merge polpgons in to 1 in_features = r"P:\\GIS Public\\Projects\\Meter Zones\\route_polygons\\" + str(x) + shp out_feature_class = r"P:\\GIS Public\\Projects\\Meter Zones\\route_polygons\\" + str(x)+'merge' + shp arcpy.Dissolve_management (in_features, out_feature_class, multi_part='MULTI_PART') # add feild in_table = out_feature_class field_name = "Route" field_type = 'TEXT' arcpy.AddField_management (in_table, field_name, field_type, field_length=10) #populate feild in_table =out_feature_class field= "Route" expression = x arcpy.CalculateField_management (in_table, field, expression) #add cycle feild in_table = out_feature_class field_name = "Cycle" field_type = 'TEXT' arcpy.AddField_management (in_table, field_name, field_type, field_length=10) #apend in to database inputs = out_feature_class target = r"P:\\GIS Public\\Projects\\Meter Zones\\route_polygons\\route_polygons.shp" arcpy.Append_management (inputs, target, schema_type='NO_TEST') print x x=x+1 print "done" [\noparse] SelectLayerByLocation_management, CopyFeatures_managemen, Dissolve_management,AddField_management, Append_management work. the problem is with SelectLayerByAttribute_management. on the after the 1st iteration of the loop the where_clause/criteria dose not works as intend. it still interprets 'route_sequ = x' as route_sequ = 1 thus the same meters and ultimately the same parcels are selected. it needs to on the 2nd pass interpret 'route_sequ = x' as route_sequ = 2 , thus select thous meters and ultimately those parcels on the 3rd pass interpret 'route_sequ = x' as route_sequ = 3, thus select thous meters and ultimately those parcels on the 4th pass interpret 'route_sequ = x' as route_sequ = 4, thus select thous meters and ultimately those parcels ect... How Do I achieve this? any help would be appreciated.
... View more
07-06-2017
10:16 AM
|
0
|
2
|
2313
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:24 AM
|