Select to view content in your preferred language

Equivalent native python for Arcpy

05-26-2022 11:51 AM
New Contributor II

Hello everyone,


I have a script tool (A map-matching tool) in Arcmap prepared by a peer. I want to replace it with native python code since it does not work with the huge data set that I have (more than 6000 sets of trip trajectories), and I believe it's because of the low capacity of Arcmap. I would like to know what would be the native python equivalent for these lines:

file = arcpy.GetParameterAsText(0)


for row in arcpy.da.SearchCursor(infc, ["OID@", "SHAPE@"])


with arcpy.da.InsertCursor(fc, ['SHAPE@']) as cursor



Thank you very much!





0 Kudos
5 Replies
by Anonymous User
Not applicable

This is kind of an apples and oranges comparison...

This might be a command line input method you're looking for.

file = input('Some text prompt')


But the rest of the code is arcpy. There is no native Python comparison. Are you looking for an open source solution? It's hard to know what to recommend without more info.

New Contributor II

To be honest, I am not an expert in Python, my peer who provided the code suggested that I need to rewrite every line that uses "arcpy" in a way that we can run the entire code in Python without the need for ArcMap. And that is because apparently ArcMap cannot deal with the big number of data. I would say it means that I have to write an open-source solution maybe? I'm totally confused

Let me know what more info is needed, so I can provide it. I really appreciate your help!

0 Kudos
by Anonymous User
Not applicable

It sounds like you're trying to convert an arcpy tool to a tool that relies only on open source libraries. It depends on the task - but this is likely much more effort than a community forum can support (e.g. answering single questions). If you could post the entire tool or a complete code block, that would give others a better chance to help.


I realize this isn't a response to your original question, but there are likely better options here since you mentioned Python programming might be difficult. If the tool is slow, you could try to process your data in smaller chunks instead of all at once. There is no guarantee that swapping to open source will be faster. If we had the original code, users might be able to point out where it is running inefficiently.


0 Kudos
MVP Esteemed Contributor


that is because apparently ArcMap cannot deal with the big number of data.

The original question mentions "6000 sets of trip trajectories," which could only qualify as "big number of data" if each trip trajectory had many many millions of vertices.  Even then, one could argue that still isn't "big" data.

ArcGIS Desktop/ArcMap is a 32-bit application, which comes with the typical limitations of 32-bit applications in terms of addressable memory space.  To augment the base application for larger data sets, Esri has the Background Geoprocessing (64-bit)—ArcMap | Documentation (

ArcGIS Pro is native 64-bit and can process as much data as your machine can handle.  Since ArcGIS Desktop/ArcMap will be retired in a couple years, I strongly suggest you start using ArcGIS Pro.

Since you seem quite new to Python, I don't believe trying to convert ArcPy code to open-source equivalent is a good use of your time unless your career goal is to get into geoprocessing scripting and development. 

MVP Regular Contributor

Pandas might be an option if you want to work with tabular data without arcpy. Could you tell us all the arcpy functions that are used and maybe we could suggest some alternatives.

0 Kudos