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

learn more… | top users | synonyms

1
vote
1answer
117 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
1answer
147 views

Is it possible to run a search cursor on a multipart feature class?

I have a multipart feature class of cities. I want to run a search cursor on a cities feature class where: one city is selected and a select layer by location is run to select all parcels that are ...
-1
votes
0answers
19 views

Converting NumPy array into polygon shapefile? [on hold]

I have a polygon numpy array, for example: array([[[103, 120]], [[104, 121]]]), array([[[102, 117]], [[103, 118]]]), array([[[102, 112]], [[103, 113]]]), array([[[131, 109]], [[132, 113] I would ...
2
votes
1answer
646 views

How do I change a raster's geotransform with GDAL?

I'm trying to use GDAL to set the geotransform of a new raster that I've created by following the steps outlined in the GDAL API Tutorial. # create the new dataset driver = ...
1
vote
2answers
447 views

How to translate (reposition) a raster in Python?

I tried to use QGIS GeoReferencer to translate a raster layer, but somehow failed. It just goes to somewhere unexpected. Now I decide to do it myself, with python. I think some libraries like GDAL ...
0
votes
1answer
364 views

Error when using .isalnum in ArcGIS fieldcalculator

ArcGIS keeps throwing an error when I use the following script in the field calculator, using Python: pre-logic script code: y= () if !fieldx!.isalnum(): y= 1 else: y= 0 Fieldy= y The ...
0
votes
0answers
21 views

Importing segmentation results from Python to eCognition?

I used OpenCV watershed segmentation to create segmented objects. However, I don't know how to import the polygon objects created (objects inside the blue circle) into eCognition.
0
votes
1answer
70 views

Loop does not move on to the next row?

As you can see in the First picture, I have parcel 220, and i want to determinate the position of each of his neighbor ! So the idea was to calculate the bearing between the centroinde of 220, and the ...
12
votes
11answers
8k views

Python GDAL package missing header file when installing via pip

I asked this question on Stack Overflow before I realised this site existed. As this site it more appropriate, I'll ask it here too. I'm trying to install gdal from pip pip install gdal inside a ...
2
votes
1answer
59 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 ...
0
votes
2answers
42 views

Optimizing script with in_memory selection

I had a problem solved here. I had 2 features: polygons and points, both containing similar attributes(example: street name, number). Each polygon must have equivalent point added(same street name, ...
6
votes
2answers
505 views

How to write scripts that can call on both Arcpy and PyQGIS?

I have spent quite a bit of time looking for a clear answer this topic and have still been unable to really accomplish my goal of accessing PyQGIS in a stand alone script. Parts of answers have been ...
2
votes
1answer
365 views

How to refresh Catalog window from ArcMap using Python?

I am running my script from ArcMap and I have the Catalog window open on the side. I delete some extra files in the end of my script but I have to refresh the Catalog window to see them go. So I ...
1
vote
0answers
29 views

How to create a boundary vector of objects after using watershed_segmentation python

I used watershed segmentation in opencv-python to separate object. However, after segmentation I don't know how to create boundary polygons of objects (red rounded in the image attached). Thanks ...
0
votes
1answer
224 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: ...
0
votes
1answer
254 views

visualize bounding box to a polygon

I try to make plugin in QGIS that compare 2 bounding box data, ex: (-32.61442167739459, -32.017601026186576, 13.015663782506067, 13.428145228091406) and (-38.6102467739459, -38.017601026186576, ...
1
vote
0answers
39 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)) ...
0
votes
2answers
254 views

Python Geoserver gsconfig create resource from Postgis store table

I've working Workspace and PostGIS store in GeoServer. I would like to use python and gsconfig to create new resource/new layer from existing PostGIS table, with: computing bbox, adding abstract, ...
2
votes
1answer
300 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 ...
-1
votes
1answer
35 views

Search layer in MXDs

I work on arcview 10.3 and i try to find layer called "ways" in several mxds. i try this code but it does not work. anyone know how to do it?: import arcpy,os,sys,string import arcpy.mapping from ...
2
votes
0answers
19 views

Help getting a Mathematical Representation within a Layer's Attribute Table

I'v been playing around with Vector Coding and was wondering if there was any Plugins out there that might let me represent Vectors within a layer as it's Mathematic attributes in the Layer's ...
16
votes
2answers
5k views

How to divide a polygon into specific sizes using ArcGIS?

I have several thousand irregularly shaped polygons in a shapefile. I want to be able to split each polygon into three areas, and to specify what the size of those areas (they sum to the previous ...
2
votes
1answer
167 views

QGIS Python Labelling [on hold]

i want to label a point layer with those values exceeding a set of variables attribute table as follows 'loc field'(text),'a'(float),'b'(float),'c'(float) variables as follows vara = 5, varb = 3, ...
0
votes
1answer
530 views

OSRM API - nearest point fed into routing

I am using the OSRM API to (1) determine the nearest point on a road segment from a give random point with http://server:5000/nearest?loc=_lat_,_lon_ The returned coordinates are used then as an ...
3
votes
1answer
77 views

Access ESRI .GDB in PyQGIS

I can access ESRI .GDB data using OSGeo's OGR. The following code gives feature class names embedded in .GDB... from osgeo import ogr driver = ogr.GetDriverByName("FileGDB") data = ...
4
votes
2answers
451 views

Load and display a layer 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 ...
4
votes
2answers
62 views

Performing a 'far analysis' using ArcGIS for Desktop?

I would like to perform an analysis that is the inverse of Near_analysis for ArcGIS. Instead of my result being NEAR_DIST and NEAR_FID, I'd like each feature to have a FAR_DIST and FAR_FID populated ...
3
votes
3answers
280 views

How to calculate peaks in a DEM

How could I extract all peaks from a DEM (large mountainous area)? Peak means something like: a pixel which is sourrounded by other pixels with smaler elevation numbers in a area arround the ...
1
vote
1answer
444 views

Converting Tab to Shp Using OGR2OGR with Python on linux

First i downloaded http://svn.osgeo.org/gdal/trunk/gdal/swig/python/samples/ogr2ogr.py and i am importing this. How can i get ogr2ogr to run in my script? nothing seems to be working and i not sure ...
-1
votes
0answers
29 views

Split polygon based on line qgis [on hold]

I would like to split polygons based on intersection of a polyline. How can i do this with python in QGIS? Thanks
1
vote
1answer
257 views

arcpy symbology colors changing on RefreshActiveView()

I have a problem that I'm not sure is functionality not built into arcpy or I'm just doing something wrong. I'm using arcpy.mapping.UpdateLayer() to apply symbology to a layer, but afterwards some ...
0
votes
1answer
530 views

ArcPy SelectLayerByAttribute Error and how to control GP output layer name

I have a rather long script that first references an SDE feature class (non-versioned) to perform an attribute selection based on a SQL selection. I've been unable to figure out why the script will ...
1
vote
2answers
21 views

QComboBox nested within a Qmenu?

Is it possible to nest a QComboBox inside of a Qmenu within QGIS? Below is my current code and an associated screenshot with the unexpected results. (orange = current incorrect placement, green = ...
1
vote
1answer
80 views

Calculate Date field in ArcPy

I'm trying to use arcpy.ExtractValuesToPoints() to get raster values to a points feature class for several raster files (8760). The goal is to get a time-slice view of how the values at certain ...
4
votes
1answer
56 views

Get value from Metadata in Python Script for attribute

I am working on a python script to create some feature classes from dbf tables. As part of the script I would like to pull two values (FGDC "publication date" and ArcGIS Spatial Reference ArcGIS ...
1
vote
1answer
20 views

Unable to find either renderd.py or generate_tiles.py

We created a Ubuntu 14.04.1 LTS x64 OSM tile server from packages using the excellent instructions provided by http://switch2osm.org/serving-tiles/building-a-tile-server-from-packages/ The tile ...
2
votes
1answer
75 views

Access ArcCatalog Window through ArcPY

I want to create a button in ArcCatalog that takes the metadata from the selected file in ArcCatalog and prints it to a text file. The metadata extraction part is done, and I have succssfully tested ...
2
votes
2answers
29 views

Output raster from IDW interpolation tool is from 3.40282e+038 to -3.40282e+038 in ArcPy

I am not familiar with Python in ArcGIS, so I used ModelBuilder first to set the environment and put the tool in. The model worked right and the output raster seemed good. Then I exported the model ...
0
votes
2answers
22 views

Transforming Shapely Polygon and MultiPolygon objects

Is there an easy way of transforming Shapely objects (namely, Polygons and MultiPolygons) from one projection to another without having to dig around and extract coordinates by hand? In fact, I ...
0
votes
1answer
55 views

UpdateLayer with arcpy

I am trying to use updatelayer in three mxd's. Each mxd has 3 data frames. I am getting an error, can anyone help? import arcpy,os,sys,string import arcpy.mapping from arcpy import env env.workspace ...
2
votes
2answers
86 views

In ESRI ArcGIS, is there an equivalent to the RStudio Console Windows?

UPDATED I know ESRI provides scripting capacity, via the Python window, but I've had a hard time with it. Making the jump from the Field calculator to the Python window was too much to me. Trying to ...
2
votes
2answers
52 views

List all feature layers

I will often create many temporary layer files with MakeFeatureLayer_management. I was wondering if there was a means to list the temporary layer files I've created. I've tried setting the workspace ...
0
votes
1answer
161 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 ...
1
vote
0answers
12 views

plugin compile with make would not compile module [closed]

Ubuntu 14.04 QGIS 2.6 PyQt4 I'm following one of many tutorials on 'plugin builder', here is the latest one I'm trying with: http://www.digital-geography.com/build-qgis-plugin/ It all seems very ...
1
vote
4answers
64 views

NameError: variable not defined even though set multiple times

This code original worked when run through the python command window in ArcCatalog. After I added the script to a toolbox I have had all sorts of troubles. The most frustrating error has been: ...
1
vote
0answers
31 views

Passing Value for Dictionary Look Up in Field Calculator fails [closed]

I've a field calculator that I am trying to use that uses a csv file to look up appropriate value based on key that is passed provided to the function. As provided below, the only values calculated ...
1
vote
2answers
124 views

Adding layer into ArcMap via Python - .pyt versus .py

In the final step of a script I've built, I'm trying to add a layer into an empty blank map document. This is my block of python code below that adds the layer. Everything works fine if its run from ...
3
votes
2answers
640 views

How to debug 'Layer is not valid error' from Python plugin?

I'm trying to understand what goes wrong with a QGIS python plugin. Basically I'm trying to render a series of POINT. The query works fine, at least giving it by hand from inside PostGIS DB: "SELECT ...
1
vote
1answer
144 views

Using GDAL to read dted files

How do I get the elevation at a certain point using gdal to read in a dted file? I don't see much useful information out on the web. I'm sorry I should have been more specific. How would I ...
3
votes
2answers
68 views

Creating a weekly FGDB backup of ArcSDE?

I need to create a script that will copy our county's parcel data, maintained in SDE/SQL, to a file geodatabase. This script will be run as a scheduled task over the weekend. What GP tool do you ...