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

learn more… | top users | synonyms

1
vote
2answers
116 views

How to populate attribute table with sequential numbers?

Using Python, how can we populate a field in a feature class automatically in increasing order? The user must be able to provide the start number. For example, say he wants to populate values from 51 ...
0
votes
0answers
24 views

Help how to return values from multiple columns to dictionary [migrated]

can anyone help with how to call additional columns to my dict below please? The example works fine for the return of one set of values (column) but I need to return values for 2 columns that are not ...
0
votes
1answer
252 views

Spatial ETL Tools won't run “AttributeError: 'module' object has no attribute, etc.”

I have a python script that runs 5 Spatial ETL tools that I wish to run as a scheduled task. Each of the tools will run successfully from ArcCatalog and also from the ArcCatalog Command line. If I ...
11
votes
10answers
25k views

Full list of ISO ALPHA-2 and ISO ALPHA-3 country codes

I'm searching for a full list of countries with their country codes. Like on this page (need full and valid): http://www.nationsonline.org/oneworld/country_code_list.htm Thanks.
0
votes
0answers
64 views

Interpolation using GDAL

I am looking for some hints here. There is a shape file with point data of rainfall sampled at a regular grid, and there is a shape file with point data of soil attributes sampled at a regular grip ...
0
votes
0answers
30 views

How to skip non-empty fields in a model?

I have a model which iterates through a GDB, populating the same attribute field in every feature class with a parameter value. In this way I can mark all FC's in the geodatabase as to what project ...
0
votes
1answer
42 views

Iterate through all fields in attribute table and multiply by field

I have a table with a whole bunch of census variables (race, age, education, etc). I want to multiply all of these fields by a factor that I calculated. For example: Field1 has values of 10,20,30,40 ...
1
vote
2answers
170 views

How to plot Storm Prediction Center (SPC) Shapefile using python

I am trying to make a plot of the SPC's thunderstorm outlook using Python. I have downloaded the shapefile from this website http://www.spc.noaa.gov/products/outlook/day1otlk.html. Then I use this ...
1
vote
0answers
45 views

QGIS 2.6 - installing exifread for photo2shape plugin

I've already seen Error loading plugin photo2shape even after installing exifread module and Error installing Photo2Shape QGIS 2.6 for Mac, and other forums, but can´t make it work. First I installed ...
3
votes
2answers
81 views

Using folder wildcards to copy files with Python

I would like to copy the data of one specific shapefile from a specific folder ("Grid") to a number of folders containing the name "Country". The country shapefiles would keep their original name. ...
1
vote
1answer
32 views

pyProj Coordinate Transformation Incorrect

I'm using pyProj to transform extents between two different geographical systems. In a case when both my systems are the same I expect to get back the same extents as inputted but this isn't happening ...
1
vote
1answer
236 views

How to export a set of layers into multiple PDF(orAI)files, one layer at a time?

I am completely NEW to PYTHON(only took a 3-hr entry course in ESRI tutorial. I have a dataset contains files named as "1_A, 1_B, 1_C....12_A,12_B, 12_c,....200_A, 200_B, 200_C..etc." I need to export ...
2
votes
2answers
211 views

Issue while running grass from subprocess

I have a map based web application using geodjango. I needed to display the crime hotspots within a selected polygon area. I found that v.kernel is very good for generating heatmaps/hotspots. So in my ...
0
votes
2answers
36 views

How to use SQL within python in ArcGIS Labels

I'm trying to create labels across a one-to many relationship and have tried a simplified version of this method. My version looks like this: def FindLabel ( [NAME_V2] ): import arcpy ...
2
votes
4answers
149 views

Using Loop function with arcpy.Exists()?

I have a code snippet using elif that checks if a file exists and continues to check through the letters of the alphabet (for example _A, _B, _C etc). All works fine but I think there must a better ...
2
votes
2answers
172 views

How to calculate monthly maximum values from daily data in a 365 band grd?

I have a MINT2005.grd file which has 365 bands representing days of year from 2005. Each band is a 32x35 matrix representing the temperature at different latitude and longitude pair. How do I ...
1
vote
1answer
29 views

Rename output shapefiles in PyQGIS

I have a shapefile which resides in a folder, gets processed and the output is saved in another folder. Before the output, I would like to rename the shapefile slightly differently from the original: ...
0
votes
1answer
53 views

Using pandas in Python window of ArcGIS for Desktop?

How can I import pandas module in ArcGIS at figure. I want to calculate poisson and negative binomial, so I think I need import pandas or other modules. import pandas as pd Runtime error ...
1
vote
2answers
68 views

Using geodatabase for processing 7200 polylines?

I have 7200 lines and I want to divide each of them every 100 meters and take the coordinates of points from them. For that task should I create a geodatabase and put them in there? I am totally ...
4
votes
1answer
83 views

How to write to a single table via Python multiprocessing

A comment in the post Can multiprocessing with arcpy be run in a script tool? got me thinking, as I often need to do exactly this: Just beware of deadlocking situations (two Insert cursors in the ...
2
votes
1answer
57 views

Python code for decreasing polygon size based on percentage?

I would like to decrease the size of polygons by percentage and not by distance in order to implement this into ModelBuilder to loop over a number of polygons. To my knowledge this tool is available ...
3
votes
2answers
256 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 ...
5
votes
2answers
626 views

Load and display a layer from SQL Server using PyQGIS

I'm having a go at using pyqgis from within the QGIS python console to load a layer from SQL Server and display it. I feel like I'm part way there but I'm having a real issue getting the layer to ...
3
votes
1answer
378 views

Configuring spatialite database access for Python 2.6.6

I'm working on a GIS project, and I would like to implement and test some geo-spatial algorithms in Python. For this purpose, I will not only need sqlite, but also spatialite, in order to store and ...
0
votes
1answer
40 views

Script not processing shapefiles from one folder to another

I am working on a script which takes shapefiles from one folder called "Original files", process them and then output the results into another folder named "Processed files. I asked a question on how ...
0
votes
0answers
35 views

How to import osm.pbf file into database with Python Imposm

I want to import a .osm.pbf file with the Python library Imposm. Currently my work flow is the following: import requests import os city_name = 'santiago_chile.osm.pbf' url = ...
2
votes
1answer
41 views

Replicating result of gdalwarp using gdal Python bindings

I am trying to re-project/resample with the GDAL python bindings, but am getting slightly different results compared to those from the command line utility gdalwarp. See update below for shorter ...
3
votes
1answer
79 views

Copy protection via license file for ModelBuilder models?

I've build a large model in the ArcGIS ModelBuilder and I want to share this toolbox with some other people BUT I don´t want to lose control over it. The first step was to set a password to my script, ...
-3
votes
1answer
47 views

Creating a desktop GIS with arcpy analysis [closed]

What is the problem with this code? I want to make a desktop GIS with this code in ArcPy. Can anyone help me?
1
vote
2answers
46 views

Automation of changing symbology for a given layer

I have a shape file that is a 10-by-10 grid of squares. The shape file has 50 attribute columns (named p_1 through p_50) where each column has 100 entries (corresponding to the 100 grid squares) and ...
1
vote
1answer
50 views

When using Data Driven Pages is it possible to tell if a feature is contained within the layout?

I'm using polygons to drive my DataDriven Pages in ArcMap Standard 10.2. I have a point feature that shares a common attribute with the driver polygon, and using the Page Definition, I am showing ...
5
votes
1answer
346 views

data driven pages format

I have an issue, but I don't even know the terms needed to search for an answer. I'm exporting the pages to png files. The pages are divided by lots. Each page has a label with the lot number. In ...
0
votes
1answer
129 views

Loading graph (.grf fle) into MXD using ArcPy?

I have hundreds of pairs of FGDB and associated MXD files. I need to insert a graph in each mxd linked to its corresponding FGDB. No problem creating graph, but stuck on how to get graph into mxd ...
0
votes
1answer
271 views

Orthographic reprojection with mapnik

I am trying to create a google earth like wep application. My problem is that I can't get to render a full view of the earth. The zoom_all() function generates the following error : RuntimeError: ...
10
votes
2answers
5k views

Creating line of varying distance from origin point using Python in ArcGIS Desktop?

I'm trying to create a line feature from a single point, using a set distance and angle. Using ArcGIS and Python (I hope). I have a point at these coordinates: X = 400460.99, Y = 135836.76 From ...
0
votes
0answers
48 views

Calculating distance from PointGeometry object to polyline in arcpy

I created a PointGeometry object on ARCPY and I'm trying to measure the distance from that point to the closest point on a polyline table.. The PointGeometry object has an easy function for that ...
3
votes
0answers
37 views

Jenks Natural Breaks in Python: How to find the optimum number of breaks? [migrated]

I found this Python implementation of the Jenks Natural Breaks algorithm and I could make it run on my Windows 7 machine. It is pretty fast and it finds the breaks in few time, considering the size of ...
0
votes
1answer
77 views

Problem exporting ecw project- arcpy

I work with arcview 10.3. Every time i export maps with ecw raster format , python (version 2.7.8) get crashed and i see: I use this code: import arcpy,os,sys,string import arcpy.mapping from arcpy ...
0
votes
0answers
47 views

Spatial Interpolation/Resampling of Point Surface Data - Axes @ Different Resolutions

I have a simple set of data points in x,y,z format. This was data collected from a ground penetrating radar over a physical distance of: 45m x 25m With a resulting grid of: 90 x 100 (9000 points) ...
1
vote
1answer
70 views

Where is the python library of QGIS 2.8

where is the Python library for QGIS 2.8 on a mac (10.10)? I cannot find it... sys.path in the QGIS python console gave me some path, but where the interesting part is happening it replaces the ...
6
votes
1answer
887 views

How to automatically generate useful scales for data driven pages in ArcGIS desktop

I have been tasked with creating several hundred maps of properties that intersect a long pipeline. The maps will zoom to the part of the property which shows the intersection. The lengths of ...
0
votes
0answers
47 views

Speed up row-wise point in polygon with Geopandas

I have a geopandas GeoDataframe which contains some attributes and a geometry column which is filled with shapely Point(lon, lat) objects. Moreover, there is a GeoSeries which is equally indexed as ...
0
votes
3answers
61 views

SearchCursor Index Out of Range

I'm using ArcGIS 10.2 and trying to obtain values in a field using SearchCursor. Would someone help me with this? import arcpy oc = r"C:\Users\Scratch\oc.shp" catchments = ...
1
vote
1answer
51 views

In ArcPy, How to call specific columns of attribute table?

I'm trying to figure out how to spline specific columns of a shapefile attribute table, but my question is intermediate to this-- how do I select a range of columns, e.g. the 20th column to the ...
0
votes
0answers
29 views

Stopping a route using attributed length

I am working in a project where I need to run routes from several points on a route network and have them stop at a specific length. I have worked out their max distance want to use this attribute to ...
4
votes
2answers
1k views

Setting the extent for a QGIS map using python

I am writing a stand-alone application in Python/QGIS that simply creates maps. I want to load vector/raster layers, set symbology, set extent At the moment, that is all! Currently I am just using ...
1
vote
1answer
603 views

How to refresh a Combobox Add-in in ArcGIS 10.1

I need to refresh the value in the combobox after an event from other tool in the same add-in (ARCGIS 10.1. Python). I've changed the value of the combobox with the code: combobox.value = val and I ...
0
votes
1answer
52 views

How do you project a single pointGeometry object with arcpy?

In an attempt to create a python add-in for ArcMap that will pass x and y coordinates to another application via a mouse click on the map, I have written the following code. I need the output ...
0
votes
1answer
147 views

QGIS Python - Convert the CRS of an in memory vector layer

In a python script of qgis I load layers from different datasources using the QgsVectorLayer() and the QgsRasterLayer() commands. The coordinate reference systems of the data sources differs. Since I ...
2
votes
2answers
256 views

Writing shapefile with projection defined crashes fiona

I've just started trying to use Fiona to write out shapefiles. I found the example code below, which seems to work fine from shapely.geometry import mapping, Polygon import fiona # Here's an example ...