arcpy

RuntimeError: b'no arguments in initialization list'

雨燕双飞 提交于 2019-12-07 07:32:54
问题 I'm trying to solve my issue in my own but I couldn't, I'm trying to run this code in every format you can imagine and in ArcGIS pro software it's the same I can't find this error message in any other issue. From similar issues, it seems some data files could be missing? import geopandas as gpd import json import numpy as np from shapely.geometry import LineString, Point, box import ast from pyproj import Proj paths = road_features.SHAPE.map(lambda x: np.array(ast.literal_eval(x)["paths"][0])

Flask app with ArcGIS, Arcpy does not run

﹥>﹥吖頭↗ 提交于 2019-12-06 21:21:30
问题 I have a script that gets a table from MSSQL database and then registers it with ArcGIS. It uses several other arcpy methods as well. I tried to combine it with Flask and developed an HTML interface where you can specify tables. The script runs on console perfectly well, however, when running with Flask on http://127.0.0.1:5000/ , the arcpy functions do not run, then the app throws errors. I am using my local python directory, so I do not have any problem with importing arcpy on flask. So, I

Why does importing module in '__main__' not allow multiprocessig to use module?

帅比萌擦擦* 提交于 2019-12-05 19:45:55
I've already solved my problem by moving the import to the top declarations, but it left me wondering: Why cant I use a module that was imported in '__main__' in functions that are the targets of multiprocessing ? For example: import os import multiprocessing as mp def run(in_file, out_dir, out_q): arcpy.RaterToPolygon_conversion(in_file, out_dir, "NO_SIMPIFY", "Value") status = str("Done with "+os.path.basename(in_file)) out_q.put(status, block=False) if __name__ == '__main__': raw_input("Program may hang, press Enter to import ArcPy...") import arcpy q = mp.Queue() _file = path/to/file _dir

RuntimeError: b'no arguments in initialization list'

可紊 提交于 2019-12-05 11:48:36
I'm trying to solve my issue in my own but I couldn't, I'm trying to run this code in every format you can imagine and in ArcGIS pro software it's the same I can't find this error message in any other issue. From similar issues, it seems some data files could be missing? import geopandas as gpd import json import numpy as np from shapely.geometry import LineString, Point, box import ast from pyproj import Proj paths = road_features.SHAPE.map(lambda x: np.array(ast.literal_eval(x)["paths"][0])) pathLineStrings = paths.map(LineString) gdf = gpd.GeoDataFrame(road_features,geometry=pathLineStrings

Flask app with ArcGIS, Arcpy does not run

二次信任 提交于 2019-12-05 02:06:15
I have a script that gets a table from MSSQL database and then registers it with ArcGIS. It uses several other arcpy methods as well. I tried to combine it with Flask and developed an HTML interface where you can specify tables. The script runs on console perfectly well, however, when running with Flask on http://127.0.0.1:5000/ , the arcpy functions do not run, then the app throws errors. I am using my local python directory, so I do not have any problem with importing arcpy on flask. So, I am able to use pymssql functions and create a new table, however when it comes to arcpy function, It

How do I add a shapefile in ArcGIS via python scripting?

感情迁移 提交于 2019-12-05 01:00:47
问题 I am trying to automate various tasks in ArcGIS Desktop (using ArcMap generally) with Python, and I keep needing a way to add a shape file to the current map. (And then do stuff to it, but that's another story). The best I can do so far is to add a layer file to the current map, using the following ("addLayer" is a layer file object): def AddLayerFromLayerFile(addLayer): import arcpy mxd = arcpy.mapping.MapDocument("CURRENT") df = arcpy.mapping.ListDataFrames(mxd, "Layers")[0] arcpy.mapping

How do I add a shapefile in ArcGIS via python scripting?

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-03 09:20:09
I am trying to automate various tasks in ArcGIS Desktop (using ArcMap generally) with Python, and I keep needing a way to add a shape file to the current map. (And then do stuff to it, but that's another story). The best I can do so far is to add a layer file to the current map, using the following ("addLayer" is a layer file object): def AddLayerFromLayerFile(addLayer): import arcpy mxd = arcpy.mapping.MapDocument("CURRENT") df = arcpy.mapping.ListDataFrames(mxd, "Layers")[0] arcpy.mapping.AddLayer(df, addLayer, "AUTO_ARRANGE") arcpy.RefreshActiveView() arcpy.RefreshTOC() del mxd, df,

Unzip all zipped files in a folder to that same folder using Python 2.7.5

寵の児 提交于 2019-12-03 03:58:44
问题 I would like to write a simple script to iterate through all the files in a folder and unzip those that are zipped (.zip) to that same folder. For this project, I have a folder with nearly 100 zipped .las files and I'm hoping for an easy way to batch unzip them. I tried with following script import os, zipfile folder = 'D:/GISData/LiDAR/SomeFolder' extension = ".zip" for item in os.listdir(folder): if item.endswith(extension): zipfile.ZipFile.extract(item) However, when I run the script, I

Check if Sphinx doc called the script

纵然是瞬间 提交于 2019-12-01 19:32:22
I am currently trying to generate sphinx documentation for scripts which use the ArcGIS arcpy library. I am running into an issue when sphinx tries to run the scripts while generating the documentation, as arcpy scripts take input parameters from the arcgis gui. Since sphinx is calling the scripts without the gui, these parameters are empty and are causing Tracebacks such as: C:\VersionControl\PythonScripts\Source\src\_build\script_export_pdf.rst:4: WARNING: autodoc: failed to import module u'gis.scripts.script_export_pdf'; the following exception was raised: Traceback (most recent call last):

Check if Sphinx doc called the script

痴心易碎 提交于 2019-12-01 19:10:14
问题 I am currently trying to generate sphinx documentation for scripts which use the ArcGIS arcpy library. I am running into an issue when sphinx tries to run the scripts while generating the documentation, as arcpy scripts take input parameters from the arcgis gui. Since sphinx is calling the scripts without the gui, these parameters are empty and are causing Tracebacks such as: C:\VersionControl\PythonScripts\Source\src\_build\script_export_pdf.rst:4: WARNING: autodoc: failed to import module u