Python is an open source interpreted programming language used in many GIS programs.

learn more… | top users | synonyms

0
votes
1answer
79 views

How do I create a projection file using GDAL

I am trying to obtain a buffer from a polyline file using GDAL with the following function def createBuffer(inputfn, outputBufferfn, bufferDist): inputds = ogr.Open(inputfn) inputlyr = ...
0
votes
1answer
57 views

ArcPy Error - 'continue' not properly in loop [closed]

Is there a way to get the continue function to work? Here is my code:
0
votes
1answer
246 views

TypeError: 'NoneType' object is not iterable from Python Scripting for Geoprocessing Workflow exercise?

I am currently taking ESRI's Python Scripting for Geoprocessing Workflows. I have following their step by step however there seem to be a problem that I am getting an error. import arcpy #Set ...
1
vote
0answers
33 views

Why when I use the ReadAsArray() Shell restart in this code?

I want to read the .pix file in the 3 different Array in python and I use this program but when I run that nothing do And shell be restart and program closed . from scipy import ndimage import ...
2
votes
0answers
63 views

Via PyQgis how to refresh a modified CSV layer without having to reopen the file? [duplicate]

UPDATED: With an CSV layer Qgis workspace [loaded as a delimited text layer], an external algorithm is ran; outputting (writing) new values to certain rows in the layers source CSV file. The writing ...
-1
votes
1answer
85 views

ValueError: Layer: Unexpected error from replaceDataSource()?

I'm trying to write a script that allows me to look through map documents and replace each layer's data source in each map document. Everything is working logically I believe, and all my loops are ...
0
votes
1answer
34 views

Layer still in map after running arcpy.mapping.RemoveLayer?

I'm trying to run a script that removes a group layer from a set of map documents, the code runs and the correct zone to be deleted prints out, However, when I check my map documents, the layer is ...
0
votes
1answer
59 views

AssertionError: Invalid MXD filename from arcpy.mapping.MapDocument()?

I'm trying to write a script that allows me to list the layers of each map document in a folder. However I keep getting this error after it displays the layers in the first map document: Traceback ...
0
votes
3answers
52 views

AttributeError: 'unicode' object has no attribute '_arc_object' from arcpy.mapping.ListLayers?

I'm trying to write a script that allows me to list .mxd files in a folder and then list the layers in each map document, however, I keep getting this error: Traceback (most recent call last): ...
0
votes
1answer
54 views

ArcPy saveACopy method saving copy of MXD to wrong path?

I have a script that looks through datasets in a geodatabase and copies a mxd document to a folder. The programs works, however it is saving the map documents to my desktop and not the specified ...
0
votes
4answers
77 views

Python code executes but nothing happens [duplicate]

I'm trying to write a script that looks into a database and lists all the datasets that begin with zone. The script then enters into a for loop and copies a map into each on the datasets listed. The ...
1
vote
0answers
42 views

How to change values in a raster file at particular positions?

I have a collection of coordinates which comes from a QGSGeometry object. The shape is a polygon. example: qgsGeometry [[(75.2172,17.6566), (75.8499,17.9613), (75.5218,17.2113), (75.2172,17.4574), ...
1
vote
1answer
49 views

Use r.mapcalculator in Python console

I'm trying to use the r.mapcalculator algorithim in a python script, but I'm having problems in using the r.mapcalculator to tranform a raster layer with float values into integers. Using the ...
1
vote
1answer
49 views

Use field calculator to reclassify values from three different fields to populate a new field AND determine overlap with different raster

I want to reclassify values of 3 different fields AND determine if one of those fields is located inside a different polygon to populate the values of my new field. Everything is raster. I created a ...
0
votes
0answers
58 views

Copy features to dataset in a loop

I'm trying to write script, that looks at the feature classes in a geodatabase and depending on what the feature class ends with, it creates a new dataset in the geodatabase and copies the file into ...
2
votes
2answers
96 views

Assign field values (double) based on values of other field (string) using field calculator

I want to assign numbers to a field, WScore (double), based on field values of Soils (string). They are in the same table of a raster. I'm not trying to add text to a double. What I want to do is ...
2
votes
1answer
97 views

How to read X,Y from mouse click in Python

I am looking for some advice… I am trying to build a tool that will precisely (10digit, eg: AA1234512345) identify British National Grid (BNG) by clicking on a map. The ArcGis default tool can only ...
1
vote
0answers
19 views

how to export multiple layers in single click to other folder

i have more then 100 layers which need to exported to another folder for further analysis is there any way i can do that in a single click. I tried to use package map but it says georeferencing ...
1
vote
1answer
48 views

Extent to xy coordinate- arcpy

I work with arcview 10.3, and i try to extent to xy coordinate with arcpy? I am using this code: import arcpy, os, sys from arcpy import env env.workspace = r"C:\Project" pnt = '178434 ,662446' ...
2
votes
1answer
57 views

FieldMap in Arcpy Merge for Selected Fields Only

I am trying to use FieldMap in arcpy to merge only a few of the same fields from 8 feature classes. There are many different fields in all of the different feature classes, but I have identified the 9 ...
4
votes
1answer
114 views

Guidelines for using ArcObjects from Python

By far, How do I access ArcObjects from Python? is my most read and referenced Q&A on GIS Stack Exchange. In spite of that success, it's probably one of my weakest areas when it comes to actual ...
1
vote
1answer
42 views

How to Compact geodatabases in multiple directories using ArcPy?

I am trying to write a script to walk through all folders in my workspace and find and compact all geodatabases in my workspace. I feel like I'm on the right track but I am stuck. import acrpy, os ...
1
vote
0answers
60 views

Geoprocessing Service on ArcGIS Server to Export File

ArcGIS Server / Geoprocessing Question I have a geoprocessing service that will perform a selection on a layer based on a provided expression. I would like to output the result as a csv file (or ...
0
votes
1answer
62 views

Basic Python Reclass question in Field Calculator

I'm trying to reclass values in field calculator using Python. I want any value >= '5' to remain the same (return same value). Anything else to be = '0'. Yes, DIST_EDGE are numbers. I'm getting an ...
2
votes
0answers
60 views

Working with rasters in file geodatabase (.gdb) with GDAL

I'm working on a tool that converts raster layers to arrays for processing with NumPy, and ideally I would like to be able to work with rasters that come packaged in a .gdb without exporting them all ...
0
votes
3answers
108 views

Only read specific attribute columns of a shapefile with Geopandas / Fiona

Having geopandas installed in my Python environment, I can read a shapefile into a geodataframe with In: import geopandas as gpd myShapefile = gpd.read_file(path_to_my_shapefile) print(myShapefile) ...
3
votes
1answer
118 views

ArcGis Python Security Concerns

I’m working for a large organization which are using ArcGis Desktop on some (windows) clients. The security requirements for the system is very strict, and a part of that is prohibiting the users the ...
3
votes
0answers
44 views

point feature to raster with count of unique points

I am using ArcGIS 10.1 with Python 2.7 I have a point layer with thousands of points that each hold an id value of its owner. One owner can have multiple points, meaning that points can have the same ...
1
vote
2answers
77 views

Call output files in temporary directory through Processing Toolbox (python)

I need to create temporary files as intermediate output to be used with processing algorithms. So, I implemented this: Processing.runalgorithm("grass:v.to.rast.attribute", ........, None) This line ...
2
votes
2answers
72 views

Select Layer By Attribute to be used in for loop

I'm trying to iterate through a feature class and select each feature one by one by using the OBJECTID field. When I use a single value, the SelectLayerByAttribute works, but how do I compare the ...
2
votes
1answer
80 views

Arcmap Maplex labeling engine bug workaround - labeling expressions won't recognize multiple spaces

I am labeling points in ArcMap using the Maplex labeling engine using a short Python script. The labels are rotated depending on an 'angle' field. def FindLabel ( [name], [city], [num] ): Buffer = ...
2
votes
1answer
34 views

QGIS Python SQLite using variable

I have been looking for answers and working on this for many hours. In the spatialite database table nodes, id is an integer. idValToNode = 854 sql = 'UPDATE nodes SET obsolete = 0 WHERE id ...
2
votes
1answer
45 views

Command line error and missing dependency in QGIS

I have two problems with QGIS 2.6.1 1) When i am trying to open command line i get error: An error occurred during the execution of Python code: Traceback (most recent call last): File ...
0
votes
2answers
48 views

Construct sql expression with python tool and pass it as argument to Select tool

I am trying to construct an sql expression using python and afterwards pass it as an input to the arc catalogue select tool. As shown in the following image I am passing a station_ID as a string to my ...
1
vote
2answers
63 views

handling QgsVectorLayer (pyQGis begginer question)

I have a simple question. I am trying to start with pyQgis, but I have found it really hard to get a GOOD api Documentation, simple but yet useful. The one of you who did programming in the old ...
2
votes
2answers
43 views

Error 000358 or Error 999999 invalid SQL

i've been searching arround all the answers in the questions of Error 358 and beyond, but i doesn't fix my problems, i tried every post and so on the problems stills there. I make two options in my ...
4
votes
2answers
108 views

How to convert float raster to vector with python GDAL

I have float raster and now I want to convert it to vector. How is it possible with python gdal library? I have tried with gdal_polygonize.py of gdal utilities in command line and it worked excellent. ...
0
votes
1answer
30 views

combine two FOR LOOPS (MakeFeatureLayer_management)

I want to combine two FOR LOOPS but I have no idea how. It should give me in each TYPE Layer "under" Layers, where are new Layers for each MONTH (see picture) The two loops in itself works. # ...
1
vote
1answer
109 views

Updating row in list of feature classes using dictionary in Python?

I have a list of feature classes (fcList) that I would like to do the following. - add a field (fire_dis) - update row from a single value from a dictionary(fcnaDict) - more specifically I am ...
0
votes
0answers
25 views

increase gdal_polygonize's capacity

I have a very big PNG (82500x40900) with more than 5000 polygons. I want to use gdal_polygonize but the geojson output shows that gdal_polygonizer stopped after 4770 polygons and the geojson isn't ...
1
vote
0answers
52 views

Python script split up

I have a python script which works with Grass 6.4. At some point during the project I decided to split this big python script into several scripts. I have made all necessary variables global, created ...
4
votes
1answer
125 views

Line vs. Polygon Intersection Coordinates

I am working with Python, Shapely and Fiona... Is there any way where I can give in an input of a line shapefile and a polygon shapefile, and get a result of the intersection points and their ...
2
votes
3answers
75 views

Using GDAL translate in Pythonwin

I want GDAL translate in Pythonwin to process some GeoPDFs to GeoTiffs. I can't call up GDAL module in Pywin. I used the OSGeo4 installer for original GDAL install and can leverage GDAL properly from ...
1
vote
2answers
69 views

Changing variable name in for loop

I am trying to run a simple python script that changes a feature to a polygon. However, I want the outputted polygon to have the same name an the inputted feature. The code that I ran, outputs the ...
0
votes
1answer
69 views

Use arcpy to query by date field in ArcGIS for Desktop?

I have an ArcGIS table in a file geodatabase that contains a date field. I would like to write a python (arcpy) function that creates and returns a table view for a date-range given a starting and/or ...
0
votes
0answers
11 views

Divided road segments and number subdivided of them [duplicate]

I use software ArcGIS 10.2.2. let me try to explain with an example: I divided the road segment called A that is 60 km long as each of them is 1 km by XToolPro. totally I have 60 subdivided. But ...
0
votes
2answers
104 views

How to concatenate row values with Python?

I want to concatenate a row who have the same src_Refname value ! like in the picture and get like this : is there any easy way to do it ? on using the tool described in the link, i try to ...
2
votes
0answers
63 views

Error when running Python script to replaceDataSource of multiple layers in multiple mxd's

I looked on all of your sites and did not find a solution to my problem. Almost all of our data has been copied to an SDE and now most of the layers in all of the mxd's need to be redirected to the ...
1
vote
1answer
73 views

How to change the values of the push buttons in QT designer [closed]

I am using the standard dialog box with ok and cancel options.i Have also added one more button exit. self.dlg.show() result=self.dlg.exec_() print 'The result is',result it is ...
2
votes
1answer
71 views

Area in KM from Polygon of coordinates

I have polygons from coordinates in (python shapely) that looks like this POLYGON ((24.8085317 46.8512821, 24.7986952 46.8574619, 24.8088238 46.8664741, 24.8155239 46.8576335, 24.8085317 46.8512821)) ...