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

learn more… | top users | synonyms

0
votes
0answers
2 views

Transform pixel coordinates

I have a raster image of 406 lines and 270 samples with 5km pixel size. The center coordinates (lats and lons in degrees) of upper left pixel, and the center coordinates of the lower right coordinates ...
1
vote
0answers
22 views

Iterating between two layers using QGIS python

I will try and explain my situation as clearly as possible. I just created my first plugin that is being used to analyze between various layers and give back quantities to the user. Most of it is ...
3
votes
2answers
27 views

How to get arcpy to work with Anaconda?

I am trying to follow the step-by-step directions in the answer to "how to separate Python installation with ArcGIS" but cannot find the path file, DTBGGP64.pth, in ...
2
votes
1answer
18 views

How to find length of a discontinued line feature

I wanted to find the length of features in a road layer. So I go through each feature in the layer and used, line = feature.geometry().asPolyline() to find the points which particular feature is ...
1
vote
0answers
17 views

Error Loading Layer/Shapefile in a Standalone Python QGis Application

I tried loading a shapefile on Python using PyQgis API but to no avail. I double-checked the path to shapefile and found it to be correct. QGIS module also seems to be imported just fine. When I ...
1
vote
1answer
15 views

Use subprocess module to run GDAL processes

I am attempting to write a python script that will reproject & merge a series of .tif files then clip them to the boundaries of a .shp file. I have successfully used the subprocess module to do ...
0
votes
2answers
24 views

Count the number of points in a (multi)polygon in shapely?

I'm using Python, Shapely and Fiona to process some shapefiles. Is there an easy way to count the number of points in a polygon/multipolygon in Shapely and Fiona?
1
vote
1answer
27 views

PyQGIS reload a QGIS plguin

I have a plugin that has a psycopg2 connection to a PostGIS database. When i close GUI with the X-Button and open it again, all the widgets are filled with the data from before. It looks like the X is ...
2
votes
2answers
38 views

I've downloaded the GDAL-1.11.1 package but why can't I call on it in python?

I have a Mac and am very new to this coding stuff.. I'm using a code that includes import osgeo as gdal and so I've downloaded GDAL from https://pypi.python.org/pypi/GDAL/ which has a folder ...
1
vote
0answers
15 views

Identify, Get, recover ArcGIS for Server (AGS) user?

have some one try or succed in recover the ArcGIS for Server (AGS) User name used in the connection, i need this cause i'm doing some edits to a Enterprise GDB, SQL Server with the same user and ...
2
votes
2answers
45 views

Intersect Shapefiles using Shapely

What I'd like to try and do is intersect some point buffers with census tracts, maintain their ID's and the tracts attributes. I found a sample from ...
1
vote
3answers
34 views

Subsetting a x,y,z text file with a polygon shapefile

I have a txt file with x,y,z format. The file size is almost 8 GB. So I don’t want to process in ArcMAP. What I wanted to do is, I have a polygon shapefile and I wanted to Clip all the points within ...
0
votes
1answer
11 views

Issue using Osmconvert with Python

I want to use osmconvert to parse down the size of my diff files for just the area I'm interested in because osmconvert is way faster than osm2pgsql, which loads the data. When I call the command ...
0
votes
0answers
18 views

Custom ArcGIS Server Backup Python Script

I am running into issues using the ArcGIS REST API import site operation because the server is federated with Portal and only has a domain certificate (i.e. not CA-signed). So I am looking for a ...
1
vote
1answer
70 views

How to work with accentuated strings in Python scripts in ArcGIS Desktop Field Calculator?

` pre-logic: def myCalc(name,nameVal): if (name == nameVal): return 1 else: return 0 var_name= myCalc(!Epulettipus!,"Lakóépület") ` This doesn't work with accentuated strings. (But ...
0
votes
2answers
46 views

Writing Python script in Field Calculator in ArcGIS Desktop?

I'm a programmer, I have programmed in C#, Java, but not with Python. And I'm not a geographic worker. How can I write a python script into Field Calculator to be able to check the other column value. ...
0
votes
1answer
27 views

Copying XY to clipboard using Python Add-In (ArcMap)

I am trying to create a simple tool to copy XY from where i click the mouse button. What i have done already is: create add-in files using Python Add-In Wizard create toolbar and tool inside it in ...
1
vote
0answers
15 views

Python 2.6 Module for GDAL 1.9.2, ImportError

I work on an internal network(IE I cant get the latest 1.11 stuff) and have GDAL 1.9.2 setup on a Red Hat Linux Enterprise Server 6. My linux box has python 2.6.6 however the python binding I received ...
0
votes
2answers
42 views

How to extract portion of a string for a field value

This is simple but driving me mad. I am using Modelbuilder to iterate through a folder of feature classes, and need to add a field that extracts a portion of the filename. Example: CF0140r01.shp I ...
1
vote
1answer
25 views

Properly writing floats to feature properties of a new shapefile in Fiona

The following piece of code is successfully returning a shp following the driver and crs of a model shp. But I cannot make it to hold the float values I am writing to it: import numpy as np #just to ...
0
votes
1answer
31 views

Poly shapefile using pyshp

I have a script for creating points shapefiles, but I can not fix it for make a new polyline shp file. I have obtained the data from a excel file and extract data in three differents lists ...
0
votes
1answer
21 views

osm2pgsql doesn't run in a QGis plugin

I have a problem with osm2pgsql when it runs in a qgis plugin. The function i use looks like this: osm2pgsql = "osm2pgsql -s -d {databaseName} -U {databaseUser} -H {databaseHost} -E ...
3
votes
3answers
41 views

Calculate field using variables as fields

When I calculate a field like this: field_0="field_name0" arcpy.CalculateField_management("Layer", field_0, '!field_name1! / !field_name2!', "PYTHON_9.3") It works! The field "field_name0" in the ...
0
votes
0answers
17 views

Fitting Time-series Values with a Gaussian Function

I'm trying to fit a stack of NDVI values to a Gaussian model to allow for determining dates of certain NDVI values using Python and NumPy/SciPy. I've attempted to do this with ...
1
vote
0answers
23 views

Reprojecting and Clipping in one script using Python Subprocess module and GDAL

I am trying to reproject a .tif file then clip it to the boundaries of a shapefile using GDAL Warp. I want to do this in a single script, and have successfully used the Python subprocess module to ...
0
votes
0answers
23 views

Is it possible to read shapefile field aliases values using fiona?

I am using fiona to read a shapefile, but not sure about how to get field aliases. Is this possible using this great library?
1
vote
1answer
38 views

How to add IDs of the links composing a polygon?

I built up a polygon layer from a road network for finding roundabouts using the compactness factor of a polygon. Then I have to intersect the extracted roundabout polygons with the road network so ...
2
votes
1answer
72 views

calling gdal_merge.py into another python script running GDAL processes

Good Afternoon All, I am wanting to use gdal_merge.py to merge a series of .tif files prior to clipping the merged file to a shapefile boundary, but want to do so as part of another larger script ...
4
votes
1answer
32 views

GP service (from Python script tool) time-out: how to execute finally: statement

I am trying to build more fail-management logic into some of the GP services I develop. As a part of the business logic within the script tool I build, I write some data into the tables and thus lock ...
-1
votes
0answers
22 views

My own base map in Python MatPlotLib

Is it possible to load my own base map for plotting data with matplotlib ? I have some problems trying to freeze a script with matplotlib Base map included. Then I think that I can use my own base ...
2
votes
1answer
82 views

ArcGIS 10.0, Field Calculator Nested “if” statement with strings

I need to assign a value depending on other two columns "FNP" and "Teilort". I wrote this script in phyton for field calculator. It actually works (no error messages) but the results in every cell is ...
2
votes
0answers
46 views

Correcting addresses with Python or Model Builder

I am trying to make a script in Python (or Model Builder in ArcGIS) for correcting addresses. I have a point shapefile with the addresses (it has X and Y, and fields for "number", "street name", and ...
4
votes
1answer
68 views

Why are my calls to SAGA routines in QGIS not working cross platform?

The ability to write and run cross platform scripts for QGIS using python is OUTSTANDING! However, when I try to run the SAGA:MERGESHAPESLAYERS algorithm from a python script it works fine in windows ...
1
vote
2answers
16 views

Converting a large set of GRIB2 files to a spreadsheet format

I have a large set of .pgrbf.grb2 files downloaded from the Climate Prediction Center, and I need to run statistical analyses comparing them to data that was produced locally in .csv format. I'm not ...
2
votes
1answer
48 views

problem transforming CRS coordinates EPSG:4269 to EPSG:3857 in python

source_srs = get_srs(shp_abs_path) source_epsg = source_srs.GetAttrValue("PROJCS|GEOGCS|AUTHORITY", 1) print source_epsg #prints 4269 target_epsg = 3857 # because these are headed to leafletjs ...
1
vote
1answer
36 views

Flip multiple vectors

I have thousands of vectors (out of several million) which I need to flip, for directionally purposes (Network Analyst). The vectors in question are annotated that their directionality has been ...
3
votes
1answer
98 views

How to convert polygon singleparts to multipart?

I am interested in converting a polygon featureclass created via Create Fishnet (Data Management) from singleparts to multipart. QGIS has a very handy tool called singleparts to multipart that does ...
1
vote
1answer
40 views

Open Source solution to batch process shortest distance between points along road networks?

I have the locations geocoded (a fairly small dataset, ~200), but I haven't found a straightforward way to load these data into QGIS and perform network analysis between nodes. Any suggestions? ...
0
votes
1answer
56 views

Creating Map from database

I'd like some general advice on creating dynamic maps. I have a bunch of geospatial points saved on SQL Server and PostgreSQL. People will enter new data into the databases from time to time. I want ...
2
votes
0answers
34 views

Nested conditional statement in ArcGIS on multiple rasters

I have a list of rasters in ArcGIS and I want to create a conditional (Con) nested statement based on all the rasters of the list. I want this to be reiterate through many lists (the number of rasters ...
6
votes
2answers
115 views

How to delete last part of a string starting from the 1st non numeric character? [closed]

I'm looking for a Python or VB statement to remove the last part of a string, starting where the 1st non Numeric character appears, using the Field Calculator in ArcMap 10. Here's an example of what ...
2
votes
0answers
42 views

Developing workaround to arcpy.asShape truncating all values to 3 decimal points?

I've read a few questions\answers about converting a GeoJSON Shape into an ESRI Object. Unfortunately most of the answers pointed to decoding the dictionary's manually. Im a bit more lazy ^_^ The ...
4
votes
0answers
47 views

Focal Statistics for Special Neighborhood

I'm looking to calculate focal statistics for each cell of a raster, within a neighborhood of a specified criteria. Background - I have three binary rasters, each representing a single vegetation ...
0
votes
1answer
41 views

Arcpy MakeFeatureLayer won't loop

The arcpy snippet below is intended to generate a list of technicians scheduled to work, and then generates a unique feature layer for each one's stops. fcStops = "TaskRoute1016" with ...
1
vote
1answer
48 views

Fiona + Shapely: Loading a set of LineStrings and writing their centroids to a shapefile, including original properties

I am using Fiona to load a set of links. Then I put every record in the rows of a pandas.DataFrame. Then I get the centroid of each LineString using Shapely. Afterwards I copy the schema of the ...
1
vote
1answer
22 views

To count the number of grid cells in a polygon

Is there a way ArcGIS could count the number of 15 seconds interval grid cells within a polygon after digitizing that polygon. This should appear in a field in the attribute table.
3
votes
1answer
46 views

Track progress of running GP tools (in arcpy script) programmatically?

I am looking for a way to access a GP tool running in a Python script to be able to see how much of the job has already been done. I have found SetProgressor function, but this one is available only ...
1
vote
2answers
22 views

Store result from gdallocationinfo as variable in python?

I'm trying to find the cell value at various locations in a set of rasters so I can count the number of real values (aka not 'NoData') that occur at all the locations within each raster. The various ...
1
vote
1answer
28 views

arcpy geometry difference method fails randomly, not reproducible

Has anyone used the arcpy geometry difference operator and seen unexplained errors like what I describe below? This is a weird one. I have a script that calculates wave fetch distance in the ocean ...
2
votes
1answer
55 views

Changes not persisting in ArcGIS server from ArcPy script

I have a ArcPy script (10.2) which connects to an ArcGIS server (10.0) versioned geodatabase, via an .sde connection file in the Database connections directory through direct connect on a Microsoft ...