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

learn more… | top users | synonyms

1
vote
1answer
33 views

why does my script not save a layer when it encounters a “ \” character in the string

i have some code that takes a field and finds every unique value in that field. it then creates a layer for each unique value. The code is working ok , but it is failing when there are \ characters ...
0
votes
0answers
17 views

Wrap Legend Text in ArcMap using Python

Is it possible to use Python to wrap text in a legend in ArcMap so that the entire legend element will fit on a page? Here's a screenshot of my problem: http://s21.postimg.org/ss1x2rgpz/before.png ...
0
votes
0answers
15 views

A very small percent of script results come back with “None” instead of Geometry objects?

I have a script that generates a mesh network from vertex and centroid inputs, and it works for almost all my points. But for some records that get created in the feature class for the script, their ...
1
vote
1answer
25 views

Writing out comma separated values inside a single cell in a spreadsheet using python

Please excuse the long subject header. I have gotten pretty good at writing data out to csv files but i seem to have stumbled into this block. Anytime a ',' (comma) is used to join values, it shifts ...
0
votes
1answer
23 views

Combining and extracting attributes from 2 columns to populate a third (Concatenate)

I am working with a FEMA flood zone shapefile which contains a FIELD_ZONE field and a SUBTY field. I created a third field called ZONE_TYPE that needs to be populated by combining or extracting ...
1
vote
0answers
14 views

How to control QGIS from within Anaconda's Spyder (Continuum Analytics Python distribution) in Windows

I would like to control QGIS from within Anaconda's Spyder, in particular use the QGIS core modules. My config: Windows 7 Anaconda 64x for Python 2.7 Spyder 2.3 Postgresql 9.4 PostGIS 2.1 QGIS 2.8 ...
2
votes
0answers
16 views

How to access Landsat bucket from Amazon?

I tried to access amazon Landsat S3 bucket with the following python code import boto import boto.s3.connection from boto.s3.connection import S3Connection access_key = <userid> secret_key = ...
0
votes
0answers
14 views

Closest raster VALUE to a given x,y point [duplicate]

Is there a way in ArcGIS to find the closest VALUE in a raster to a given x,y point? There might only be NoData at a certain point, in which case I want to find the closest pixel value. I cant seem ...
1
vote
1answer
42 views

What defines where the files will be saved?

Hi I have a script I am using to save out layers automatically I have posted another question here ArcGIS creating individual layers for unique attribute in a given feild. Limitations of Where ...
1
vote
1answer
54 views

Change field names automatically

I have an attribute table with over 2500 fields. About 2000 fields start with the name "All_txt_" (eg "All_txt_Watermelon"). Is there a way to remove this "All_txt_" from all the fieldnames ...
0
votes
1answer
30 views

How to read landsat images from Amazon S3 using python?

I would like to read and process landsat images from Amazon using pyton thanks,
1
vote
1answer
16 views

Using pyQGIS transform a layer of polygons into a layer of holes inside a bbox

I'm using python in QGIS. I have a layer of polygons (its a result of some earlier dissolving and has no overlapping polygons but some holes and islands in holes etc). I want to build a new layer ...
1
vote
2answers
21 views

Identify Census blocks inside urban areas (using pyshp or similar)

I am trying to find the Census blocks that are inside specific urban areas or urban clusters. The Census Bureau provides a list of urban areas/urban clusters with the following information: | ...
2
votes
2answers
26 views

Controlling default value of arcpy.AddField_management

I have a large collection of shapefiles that use text fields to hold numerical values. I have created new fields, and populated them with the numerical equivalent of the text field. When adding the ...
0
votes
0answers
13 views

OSGeo4W and GDAL - gdal2tiles.py error

Wondering why gdal2tiles is throwing errors, I've added the gdaldata and gdalplugins environmental variables and my python is at Python27/ArcGIS10.3/, and am wondering if that is messing with the ...
0
votes
0answers
48 views

UpdateCursor not iterating as desired, updating erroneously

(EDIT BELOW WITH WORKING CHANGES) I have a script in which I am trying to compare attributes in row n to row n+1. If all the attributes match, I want row n+1 to have a field ([Modifier]) updated to ...
1
vote
1answer
19 views

Cleaning shape file with multiple boundaries defined more than once

I have a shape file which contains a lot of polygons which define airspace. These polygons overlap and this is fine (e.g. different airspace configurations for the same airport). My problem is that ...
2
votes
4answers
83 views

How to get values of last row in table with ArcPy/SearchCursor?

I would like to base my query on the last row of a table? I know the basic syntax/functionality for my search cursor, how do I query only the last row; Below is an example of my search criteria, ...
0
votes
0answers
30 views

ArcGIS creating individual layers for unique attribute in a given feild. Limitations of Where Clause

I am putting together some code that makes a layer for each unique attribute within a given field. So if I had a shapefile that contained point data for locations of say postboxes in every city , for ...
0
votes
0answers
15 views

Arcpy MakeGraph “Parameters are not valid”

I have a Python add-in that should create a graph based on the location ID of a water quality testing station. The user clicks on the point and a relevant graph should be created in the layout window. ...
0
votes
0answers
17 views

how to compile a python script (proxy.cgi) in ubuntu?

I want to know please how to compile a python script ubuntu 14.10, I have a file proxy.cgi I want to compile in order to access to the geoserver. when I type localhost/cgi-bin/proxy.cgi, it displays ...
1
vote
2answers
50 views

Convert a string field to a number field using arcpy

Accidentally posted this in the general stack overflow forum first. I have a large (>1000) number of shape-files in which there are fields containing numbers that are defined as text fields. I need ...
1
vote
4answers
148 views

Python script for Field Calculator. ArcGis 10.2.2

I have a point shapefile with two columns i want to process. The first column is aspect and the second is aspect_m60, there is only one row with the aspect of my point. I have tried to write a script ...
2
votes
0answers
22 views

Error inserting new column in ArcSDE table (ERROR 999999)

I am using a python script to populate a table with values I get from rasters files. I use arcpy.AddField_management to add a new column and arcpy.CalculateField_management to insert the values for ...
0
votes
0answers
28 views

Python error in array declaration

I am getting a error as follows File "C:\Program Files (x86)\ArcGIS\Desktop10.3\ArcPy\arcpy__init__.py", line 2292, in NumPyArrayToRaster return _NumPyArrayToRaster(*args, **kwargs) ValueError: ...
1
vote
1answer
39 views

PyQgis, styling vector layers in different canvas

I'm developing a QGIS plugin and I need some help with styling layers in different canvas objects. In my dialog window I've got two QgsMapCanvas objects canvas1 and canvas2. Layers from registry are ...
0
votes
2answers
39 views

Convert a tiff Float32 image to 8bit tif (or jpeg) image using GDAL and Python

I need to convert a Float32 tiff image to 8bit format in order to display the image in a web page. In order to do that I need a jpg image but this conversion is not correctly done with GDAL because ...
0
votes
0answers
27 views

arcpy.da.Walk not adhering to datatype filter “Locator”

I have a file gdb containing feature classes and address locators. I am listing and storing the names of the datasets using arcpy.env.workspace = "C:\input.gdb" (root, fds, ftrs) = ...
0
votes
0answers
23 views

Never get the information about obective interpollation and optical interpollation

I have point data want to interpolate it and convert it into 3d grid format but i am not get any proper information which interpolation i have to used objective / optical. please let me know any ...
1
vote
1answer
42 views

Stand alone - Python Append (multiple shps from a folder to one dataset)

I have users creating data (shp) daily into a specific folder, I already know how to invoke GP tools to append these data sets into one. What I am trying to do is run a task (which I already know) to ...
2
votes
1answer
32 views

Clip Point Features to Polygons with Model Builder/ArcPy

Here is the context of my question: I have point features for about 2000 individual trees spread throughout 50 different tree districts. The tree districts are polygons in a polygon feature class and ...
0
votes
1answer
25 views

How to convert GeomSHP to WKB

I have imported a point shapefile called site_locations.shp into a personal geodatabase. Now I'm trying to retrieve the data from the database using SQL: dbpath = ...
2
votes
1answer
145 views

How to split filenames for their first word in Python? [on hold]

I have 2 shapefiles, each one placed in a different folder: "C:\...\Folder O\Germany (O).shp" "C:\...\Folder P\Germany Berlin (P).shp" The following script finds the shapefiles and contains a ...
0
votes
0answers
33 views

Not matching schema problems when appending a list of CSV's into an existing FGDB table

So far I have the following code for creating the FGDB table and defining fields which works just fine. But when I try to append a list of csv's to this table I always get a matching schema error. Do ...
0
votes
1answer
20 views

raster to point in batch mode using Python

I have a list of raster files in tiff format and I want to convert that tiff to point using raster to point conversion (tool of ArcMap). This tool will convert the raster into a point shape file. I ...
1
vote
1answer
21 views

Plot points on map using Fiona and/or Shapely

I have written a parser in Python that extracts the coordinates out of a GPX file and I would like to view those points on a map. I have done a little research and it seems like either Fiona or ...
0
votes
1answer
28 views

enter coordinates into web form and retrieve results with python

There is a web site that will take XY coordinates and return the closest county/route/postmile within california. I'd like to be able to access the site, enter XY values and retrieve ...
2
votes
1answer
45 views

How to use the math tool (“times”) in ArcGIS modelbuilder to multiply two raster sets while using an iterator?

I have two sets of rasters (in the same gdb), representing "loss" and "forestmask". I would like to multiply each forestmask raster (value 1 = forest) with its corresponding loss raster (value ...
1
vote
0answers
33 views

RGB satellite image in Python with Basemap

Can anyone recommend a workflow or python library that will let me work with RGB images and BaseMap (or something equivalent - could be CartoPy). I have Landsat 8 images, and can load one in python ...
1
vote
1answer
48 views

Add layer to mxd files ignoring specific item- arcpy

I try to add layer (abc) to several mxd files with arcpy and ignoring mxd file which called "land use" . I work with arcview 10.3 : import arcpy,os,sys,string,datetime import arcpy.mapping from arcpy ...
3
votes
1answer
70 views

Alternative to an arcpy script for points to lines to polygons?

I'm relatively new to arcpy and python, so I feel like I could be missing something obvious in regards to tool options for what I'm trying to achieve. I have a script that creates triangular ...
1
vote
1answer
45 views

Converting multiple File geodatabase (.gdb) into multiple Personal geodatabase (.mdb)

Individually I will Export the gdb to XML Workspace then import that into the personnel geodatabase and all Domains go over fine. But... Let's Say I have several file geodatabase in a folder and Each ...
0
votes
0answers
24 views

What driver should I use when trying to open a Geospatial PDF with OSGEO and Python?

My code is as follows: from osgeo import ogr from osgeo import gdal dso = ogr.Open('myfile.pdf') print dso dsg = gdal.Open('myfile.pdf') print dsg driverGeoPDFogr = ogr.GetDriverByName('PDF') ...
4
votes
1answer
32 views

Dump a GeoJSON FeatureCollection from Spatialite query with Python

Given a Spatialite database, holding a table with a geometry column and some other attribute columns. I want to query that table in a Python script and get a GeoJSON FeatureCollection string in return ...
1
vote
2answers
53 views

How to assign a unique ID to groups of items in the attribute table in ArcMap?

Using arcmap's field calculator I need to programatically loop through all of the entries in the field and for each name it gets its own unique id. So names that are the same would get the same ...
0
votes
1answer
34 views

How to convert latitude, longitude to EPSG 3857?

I'm looking to study the math involved to see how a given latitude and longitude in decimal degrees can be converted to epsg 3857. Can anybody point to a good reference or a possible python/c/c++/java ...
1
vote
1answer
34 views

ArcGIS Field Calculator nested elif is None not working

I am calculating a field based on two other fields in ArcMap 10.2 using python. My Pre-Logic Script Code is def myfunc(legend,Btype): if(legend == 'Apple'): return 'Banana' elif(legend == ...
0
votes
0answers
24 views

Python script can't find custom module in ArcSDE

I've been working on a python script for some time. Its working well but I'm having trouble running it in SDE. My main issue is that the python script, when run in SDE, cannot find any of the ...
2
votes
2answers
157 views

Performing math in Python parser of ArcGIS field calculator?

I never used python but now I need a code to do this calculation: I'm doing this: math.atan(math.fabs( !Y2! - !Y1!)/math.fabs( !X2! - !X1!) )*(180/math.pi)
1
vote
1answer
20 views

arcpy.GetCount_managment not returning result in dialog window

I am having trouble with GetCount to work in my script. It is not printing the GetCount arcpy.AddMessage in the geoprocessing window dialog; # Get the spatial reference spatialRef = ...