Having issues running Connect Public Transit Data Model To Streets (Public Transit) with arcpy

214
0
09-23-2022 08:19 AM
MatthewLehane
New Contributor

Having some issues running the Connect Public Transit Data Model To Streets (Public Transit) tool with arcpy. Getting an error code when completing a script provided by Esri - located here. I modeled my code after the script found in the previous link. 

Getting "ERROR 000358: Invalid expression." I have reviewed the inputs, and I do not believe it to be invalid. This seems like a simple fix with the where clause; perhaps I am missing something, but I have written that differently without any luck. 

Here is the code - 

import arcpy
import os
arcpy.CheckOutExtension("network")
arcpy.env.overwriteOutput = True


fd_path = r"D:\Python\PlanningTools\TransitAccessibility\Tools\GTFStoNetworkAnalysisModel\Inputs\TransitAnalysis\TransitNetwork.gdb\TransitNetwork"
streets = os.path.join(fd_path, "Streets")
where = "RestrictPe = 1"
arcpy.transit.ConnectPublicTransitDataModelToStreets(fd_path, streets, "100 meters", where)

 

And here is the error: 

ERROR 000358: Invalid expression
ERROR: Failed to execute (MakeFeatureLayer).
Traceback (most recent call last):
File "C:\Users\Owner\PycharmProjects\PlanningTools\testing.py", line 11, in <module>
arcpy.transit.ConnectPublicTransitDataModelToStreets(fd_path, streets, "100 meters", where)
File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\transit.py", line 330, in ConnectPublicTransitDataModelToStreets
raise e
File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\transit.py", line 327, in ConnectPublicTransitDataModelToStreets
retval = convertArcObjectToPythonObject(gp.ConnectPublicTransitDataModelToStreets_transit(*gp_fixargs((target_feature_dataset, in_streets_features, search_distance, expression), True)))
File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\geoprocessing\_base.py", line 512, in <lambda>
return lambda *args: val(*gp_fixargs(args, True))
arcgisscripting.ExecuteError: ERROR 000358: Invalid expression
Failed to execute (MakeFeatureLayer).
Failed to execute (ConnectPublicTransitDataModelToStreets).

 

0 Kudos
0 Replies