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

learn more… | top users | synonyms

0
votes
1answer
14 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
18 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
0answers
17 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
25 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
27 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
43 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 ...
2
votes
1answer
66 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
40 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
20 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') ...
0
votes
0answers
24 views

ArcGIS python script validation to update the text based on a list

I'm having issue with using validation to update an input box. Some background: I created a tool to update and resize text in ArcGIS. This is done by having a series of text elements and shape ...
4
votes
1answer
23 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
48 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
33 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
33 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
22 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
152 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 = ...
1
vote
1answer
36 views

creating a random gdal raster with random predefined values

So far I have developed the below code but for some reason it only works for say one class of landuse instead of two. Would you please tell me where I have gone wrong? Thanks so much import os, ...
1
vote
3answers
58 views

How to delete a feature from a GeoJSON with Python

Given a GeoJSON like following: { "type": "FeatureCollection", "features": [ { "type": "Feature", "properties": { "city": "city1" }, "geometry": { ...
0
votes
1answer
38 views

Select by location-arcpy

i work with arcview 10.3 on 20 mxd's (each mxd has 25 layers) and i try to do select by location (with arcpy) and want to see a layers that are visible in the current map extent only. All Other layers ...
0
votes
0answers
17 views

Arcpy - Updating fields using time.localtime()

My objective is to change the values under field "DATE_IMPOR" which are currently set at to the current time using time.localtime function. I'm having some problems getting there, above all one line ...
0
votes
0answers
25 views

Get min/max value of each band from landsat image?

I am trying to get min/max value of each band from Landsat image with the following code. from osgeo import gdal raster = "raster.tif" # load raster gdalData = gdal.Open(raster) # get number of ...
2
votes
0answers
35 views
+50

How to configure a available feature types in GeoServer using python gsconfig

How to configure a available feature types in GeoServer using python gsconfig? I have created work space and data store using gsconfig. Now , how i can configure available layers in a exist data store ...
1
vote
1answer
28 views

ArcObjects/Python: Add JPG to layout

I am attempting (and failing) to add an image to a map layout using ArcObjects via Python comtypes. I do need to run this outside of ArcMap (i.e. not in the ArcMap Python window). The basic idea is: ...
-1
votes
0answers
23 views

Converting INQ-UNIX ArcView3 & PC ArcView3 in to ArcMap [closed]

Hi i have base map developed in the INQ-UNIX ArcView3 in coverages, I need to use this data and create shapefiles in ArcMap.... any suggestions
0
votes
0answers
26 views

Import addresses from an Excel file via Python for route optimisation

relative newbie here. Apologies if this is very obvious or basic! I have created a route optimisation model through ArcGIS modelbuilder, then exported the Python script. Within the model I had a ...
0
votes
0answers
17 views

How to call QGIS modules (qgis.core) from python idle as I can call arcpy

I was trying to set up path to be able to call qgis modules as it defined in their website Introduction and set PYTHONPATH=c:\qgispath\python . I also try to follow suggestion in link below How to ...
0
votes
0answers
10 views

Geoserver WPS process chaining raster clip and zip with python

i am using geoserver 2.6, i want to apply clip and zip functionality of raster data with using python script and implementing wps client. So, what is parameter should i use in python script for clip ...
0
votes
2answers
53 views

Placing message in geoprocessing progress dialog?

I am after a way on using arcpy.GetMessage to achieve the following message in the geoprocessing dialog result window?; The above 4 datasets have been reprojected to: WGS Web Mercator (auxiliary ...
1
vote
1answer
36 views

Rewriting csv file for QGIS

So, I have a .csv file. Here an example how the a row from the original .csv looks like: "AREA",44.37,-00.83,"5","1","8","E","E",,,"KKI","KKO" Some lines have missing latitudes and longitudes, ...
2
votes
0answers
28 views

Query out a specific date regardless of the time, using python

Problem: I have a feature class with an attribute table with a field called Edited_Date and its data in the field is as follows: 4/8/2015 10:00:00 PM. I want to select all records that are Edited_Date ...
1
vote
3answers
56 views

Shapefile list gone missing in dialog window

I have updated my script in ArcGIS 10.3 to include the copyFeatures_management geoprocessing tool because I want to only copy the features that already have the same projection, not reproject them; ...
2
votes
0answers
32 views

DBSCAN gives “AttributeError: NoneType has no attribute issparse”

I am running a Python script invoking the DBSCAN tool to cluster feature points. When I open ArcMap, load the feature layer, and run the script, it works the way I expect it to. But if I run it ...
2
votes
1answer
135 views

Standalone script looping incorrectly?

Following on from my previous question, I would like the script to do the following (includes illustration): Search for the first shapefile (Paris (O).shp) in Country_France > Original files and ...
0
votes
2answers
63 views

Add in copyfeatures into script

I am having trouble with CopyFeatures in my script. The files went being copied to the output folder. Can someone please assist. Here's a snippet of my script for ArcGIS 10.3; #Loop through shapfiles ...
1
vote
1answer
33 views

Python/GDAL hyperspectral Image wavelengths

I can open and read a hyperspectral image using GDAL according to the instructions brought by Max König here: So after reading the data like this : data = gdal.Open( filename ) then I can see ...
0
votes
1answer
27 views

creating a random raster image using gdal

I want to create a random image containing say three classes with predefind percentages of each of the classes using gdal in python.Any sample code would be very appreciated.
-1
votes
1answer
65 views

Rewriting VB codeblock as Python for ArcGIS Field Calculator?

I am looking for assistance to rewrite my VB codeblock into Python. Im on Win7, Arc10.2 and Python 2.7 The code below works fine for me, I am simply looking to port it to Python so i can progress down ...
1
vote
1answer
21 views

QGIS - Python errors not reporting to Python Console

Ive been writing a number of small plugins for use in QGIS, and have found that during development having the traceback calls reporting to the python console plugin to be quite useful. I Use QGIS on ...
2
votes
0answers
17 views

GDAL merge; Why add 0.1?

In the implementation of gdal_merge: https://svn.osgeo.org/gdal/trunk/gdal/swig/python/scripts/gdal_merge.py a value of 0.1 is added to the conversion from geo-referenced coordinates to pixel ...
1
vote
3answers
67 views

Removing filepath from ArcGIS geoprocessing result?

This is my python script code in ArcGIS 10.3; projectResult = arcpy.Project_management(fc, outFolder + "\\" + fc, template) #Name of shapefiles re-projected arcpy.AddMessage(projectResult) ...
0
votes
0answers
18 views

why when I use python to program the exact same command as netcdf make a table tool, the table is empty? [duplicate]

If I use the ArcGIS tool "create a table view from netcdf file" eveything works great, but I need to automate a marge larger program. When I use the exact same tool in python, the table it creates is ...
0
votes
1answer
44 views

Using Python parser of ArcGIS Field Calculator to populate values in one field based on those in another?

I am trying to populate a field with a sorting code that represents the value of another field. Example: EXPCODE|SORT| S4DNN2 |3.5 H2BNN2 5.0 EXPCODE is a field with a value like "S4DNN2." SORT ...
2
votes
1answer
39 views

PyQGIS: subtracting two values and append ID to list

I would like to subtract two values retrieved from qgs feature iterator objects and append the value of the feature id to a list depending on a condition. I have two layers: roadsLayer pathsLayer ...
1
vote
1answer
37 views

Getting and using XY centroids in ArcGIS Field Calculator using Python Code Block

I am writing a script to obtain Grid reference but cannot fathom how to get XY centroids without creating new fields (all examples I have found are based on writing XY centroids to field). Here's ...
0
votes
1answer
30 views

Project only required shapefiles in folder - update [duplicate]

I have updated the script from my previous question; Project only required shapefiles in folder I cant get the if fcspatialRef != spatialRef: to work. The script won't filter the shapefiles in ...
2
votes
0answers
21 views

Not able to get the PostGIS Layer Viewer running in pgAdmin or command line

I've installed PostGIS Layer Viewer as a plugin for pgAdmin. I've downloaded postgis_viewer.py from the official repository on GitHub! and followed the install instructions described on Web site!. ...
3
votes
2answers
56 views

Image processing using Python, GDAL and Scikit-Image

I'm new here and I'm sorry if I do something wrong. I am struggling with a processing and hopefully I will be able to solve here. I work with Remote Sensing applied to Forestry, especially working ...
1
vote
1answer
42 views

Using defined function code block with Python in ArcGIS

I am running a Field Calculation within a Python script in ArcGIS. Within this Field Calculation I am calling a defined function within a code block. Here is the dialogue that I ran and works: ...
2
votes
1answer
52 views

QGIS Python - raster as point layer, coordinates issues

I would like to create point layer for storing values retrieved from a raster file. My idea was to iterate through all raster cells. If cell value is different than NULL, I wish to create a new point ...