Python is an open source interpreted programming language used in many GIS programs.
0
votes
0answers
15 views
Python OGR, psycopg, postgis - geometry is null when updating
I'm attempting a python script that takes data from a file and updates only the geometry and a key field in a post gis table. But no matter what I try the geometry always seems to be updated null.
...
3
votes
0answers
19 views
Pick random points in an earth circle
All I need is the ability to create random points within a radius of another point.
so given self.fence.latitude and self.fence.longitude and self.fence.radius I should be able to generate random ...
0
votes
0answers
13 views
how to differentiate between common parts of the triangle and extract linestring from it [closed]
Can you help me break down shape A to different linestrings: lines 2 & 3 AND line 1 ?
I'm using Postgis 1.5 / Python Shapely
2
votes
0answers
17 views
Rounding error in qgis point sampling tool
I'm not sure if this is a bug or of it is due to the implementation. I am using a raster that has values greater than 1,000,000 and Qgis displays these numbers in a scientific notation. For instance, ...
0
votes
1answer
51 views
While looping with arcpy: ERROR 010240: Could not save raster dataset
Hi I am very new to python coding and have been struggling with this for a while I cannot see the reason for this error! Any help will be greatly appreciated.
Here is the code that is causing this ...
0
votes
1answer
36 views
How to append a vector layer using Qgis and Python?
I am working on scripting some data processing using Qgis and Python, but I'm running across issues that I need to debug. Since my data is really large, and run-times can be lengthy, I would like to ...
2
votes
1answer
65 views
Writing python plugin: How terminate plugin from script without closing QGIS?
I'm writing a QGIS conversion plugin in python to be able to create Obstacle-files for a model from shapefiles.
What I want to do now is just to close the plugin cleanly. This means, to close the ...
3
votes
2answers
47 views
use a selection of features in ArcMap in Python script
I am trying to write a python script and am stuck on the first obstacle.
I want the user to select features in ArcMap and then use these selected features in a python script. Is that at all possible ...
0
votes
1answer
76 views
Join multiple shapes in a workspace based on a common field
I’m completely stucked!!! I’m working with meteorological data (wind) but I have to arrange the data for a program to be able to process it. I have text files, two per day (one with the wind direction ...
1
vote
2answers
339 views
How to make editable polygons in Google Maps?
I've just recently started learning Google maps, JavaScript, etc., and have a few questions about a project that I'd like to do. I'm wanting to take some ESRI shapefiles, convert them to KML, and then ...
4
votes
1answer
1k views
How to programmatically add shapefile to data frame in Arcmap
I have a toolbox with python script which creates a shapefile from JSON txt file, but it does not show the generated shapefile in arcmap, i have to add it from the output location. What code shall I ...
0
votes
2answers
865 views
Looking for a solution for 'expected an indented block' error
I have been trying to list all the field names of a shapefile but it is showing 'expected an indented block'. What should I do?
import arcpy
fieldList = ...
2
votes
1answer
80 views
How come “Zoom to Polygon” always puts me in the middle of Nebraska?
This is an issue related to this question I'd asked a few days ago. I've got that code working, to an extent. Every time, though, that I double click on one of the Polygons in the attribute table that ...
0
votes
1answer
43 views
Arcpy Network Analyst solver error
Hello GIS Stack Exchange,
I am finding it difficult to load locations to sublayers using python in ArcGIS 10.0 network analyst Vehicle routing problem.
I'm also having some trouble debugging my ...
1
vote
2answers
54 views
Copying netCDF coordinate system
I have many NEXRAD precipitation netCDF files which I created from the raw files using the netCDF-Java API (ver. 4.3.17). I am now trying to compute monthly average rainfall rates and returning a new ...
1
vote
1answer
56 views
Looking for PyQGIS Syntax Examples/Guide
I am a long-time user of arcgis with intermediate experience python scripting for automation of geoprocessing workflows. I am moving towards using QGIS on the regular and I would like to dive into ...
0
votes
1answer
179 views
What causes PythonFactory failure in FME?
2011-10-04 09:59:18| 2.3| 0.1|FATAL |PythonFactory failed to load python symbol `module2.py'
2011-10-04 09:59:18| 2.3| 0.0|FATAL |Factory proxy not initialized
2011-10-04 09:59:18| 2.3| ...
3
votes
2answers
82 views
Move the cursor backward - opposite of row = rows.next()
I'd appreciate if anyone could please tell me if there is a way to go up one row in python cursor. opposite of row = rows.next()
Thank you!
-1
votes
1answer
38 views
Is it possible to import/run AML script into GRASS?
I have an AML script that has instructions to import tmp files of (grid, network, basin...)
is there any way to run the script in GRASS? I tried to converted to Python but I couldn't do it for the ...
1
vote
3answers
63 views
Apply rotation before FeatureToRaster_conversion
I am converting polygon shapefiles to rasters. With arcpy I am using the function FeatureToRaster_conversion.
gp.FeatureToRaster_conversion(InFeatures, InField, OutRaster, InCellSize)
This function ...
3
votes
1answer
56 views
Iterating through an numpy array and index to a value in another numpy array
I am struggling to get this code to work I want to iterate through an numpy array and based on the result, index to a value in another numpy array and then save that in a new position based on that ...
4
votes
4answers
81 views
How to rename a file in the output (ArcGIS python)?
raslist=arcpy.ListRasters()
for ras in raslist:
arcpy.ProjectRaster_management(ras,outfolder2+ras+'_Albers',spatialref2)
print ras+' has been reprojected'
I was using the above code for ...
1
vote
1answer
74 views
How can I change SQL query through a layer of an action (python)?
I have three layers from three diferent database tables.
When I click in other layer I want to change (with an action) the query of that three layers.
How can I do that?
Thank you
5
votes
3answers
161 views
Migrate in a new programming GIS language
The last five years I have been working with VBA and ArcObjects for developing a specific application within ArcGIS. That project that began around 2008-2009 carried out with VBA and ArcObjects which ...
2
votes
2answers
44 views
How to travers fields of records without introducing them all in the function?
In my previous question I wanted to reach a field in the field calculation; however, it was pretty easy to introduce a few more inputs for that function.
Now, I am facing a problem which needs around ...
4
votes
0answers
83 views
Finding the “center of gravity” of multiple points where points have unequal weights [closed]
I'm trying to reduce a set of lat/lons (each with it's own weight) into one lat/lon that is the center of mass of all of the points.
however when I map the results the average point falls no where ...
4
votes
1answer
44 views
arcpy “The table name is invalid”
I wrote a script that, ideally, loads raw .las (LiDAR data) files into a geodatabase, then creates a terrain from the multipoint files that are created. When I run the script though I get:
...
7
votes
1answer
161 views
Determine minimum number of polygons from shapefile to cover an area of interest
I have a large number shapefiles representing areas of interest for an analysis that will be conducted using various sources of satellite imagery (IKONOS, RapidEye, etc.). Unfortunately, the imagery ...
2
votes
2answers
188 views
OSR Python testSR.ImportFromEPSG(4326) returns empty spatial reference
This is empty using Python .ImportFromEPSG(4326):
import osr
#this fails:
testSR = osr.SpatialReference()
testSR.ImportFromEPSG(4326)
print testSR.ExportToPrettyWkt()
#why did the import from EPSG ...
1
vote
2answers
81 views
How to get an attribute of the selected feature and pass it into a URL?
As a total Novice with Python, I thought 2 weeks would be enough time to learn how to build some tools for our GIS... I was wrong and I'm running up on a deadline.
I am attempting to get a value ...
7
votes
6answers
774 views
How to integrate SAGA Python Modules into ArcGIS Desktop?
I have been having a look at SAGA (http://www.saga-gis.org/en/index.html) and it seems to have some nice tools for geoprocessing. I was wondering if anyone out there has had any luck bringing SAGA ...
6
votes
1answer
68 views
Python in ArcGIS: How to add a space between upper and lowercase letters in TOC
I'd like to use python to update the TOC by adding a space (white space) for layer names that are like this: "BoundaryBuffer" or "WaterEdge" and replace them with "Boundary Buffer" or "Water Edge".
...
14
votes
11answers
2k views
What are the Python tools/modules/add-ins crucial in GIS?
With ArcGIS 10, Python has become the de-facto scripting language for ESRI. While leading Open source software like QGIS, GeoServer, PostGIS all supports Python. Thus it became important to know/learn ...
7
votes
2answers
185 views
Is there a compelling case to learn/use Python Toolboxes (new at ArcGIS 10.1) over Python Script Tools?
I've written a few Python Toolboxes (which are new at ArcGIS 10.1), but am yet to decide whether/when I should write them rather than Python Script Tools in a standard toolbox.
I thought the Online ...
0
votes
1answer
45 views
How to reopen a plugin-window in QGIS?
I am currently taking my first steps in playing around with programming a plugin in python 2.7 for QGIS 1.8. While my plugin does what it should, I would like to make it more userfriendly. At the ...
4
votes
2answers
125 views
Arcpy memory leak
I'm trying to import a great number of csv files of about 250MB each. I wrote a python script for that as follows:
import gc
import glob
tables = ...
8
votes
5answers
3k views
ArcGIS/ArcPy Python, how to get latitude and longitude of a projected point?
I have a point feature in a feature class that is being accessed by ArcPy. The point is projected but I need to find an efficient means to get the unprojected latitude and longitude for this point. ...
3
votes
1answer
153 views
How to clip a Oracle query layer directly in a Python script?
I have a query layer directly running from ORACLE database in a MXD. I want to clip this layer with a layer being created in another MXD in a Python based tool. My question is to do this clip ...
1
vote
1answer
211 views
Slow tiles generation for leaflet js
I am currently trying to use leaflet to display images (jpeg or png) instead of maps, I have followed the instructions on this blog post to create the tiles using gdal2tiles.py here is the code we ...
0
votes
1answer
30 views
Mapnik - Error on rendering linestring
I am using Mapnik 2.0.1rc0 on a Windows 7 with python 2.7 32bits inside a GeoDjango App using xml. The datasource come from spatialite 4.0. My tiling script can render polygon and point features ...
0
votes
1answer
116 views
Where Clause problems when all parts are user input variables
I have written some generic user ipnut code for a toolbox script (ArcGIS 10.0) but because everything is a variable I don't know how to write the SQL whereclause.
Please can someone help and suggest ...
1
vote
0answers
77 views
How can I draw an ellipse filling the dataframe with ArcPy?
I need to modify one of my template scripts to draw a circle from the centre of the (inset) data frame to the edge of the data frame. This will then be used to clip the data frame to shape. I'm using ...
2
votes
1answer
51 views
How to sort features in a layer using OGR/Python?
How can I sort the features of an ogr layer by the values of a field?
I tried naive variations of
def sortlayer(ds, layer, field):
lname = layer.GetName()
lsort = ds.ExecuteSQL(b'select * ...
1
vote
0answers
86 views
How to write vector layer to csv file with geometry by PYTHON?
I use Python try to write vector layer file to csv file with this code
QgsVectorFileWriter.writeAsVectorFormat(mylayer, r'c:\temp\xyz.csv', "utf-8", None, "CSV")
It can export to xyz.csv but only ...
2
votes
1answer
70 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
1answer
29 views
How to use in_field_map parameter of CreateCompositeAddressLocator_geocoding?
I would like to know if anyone who has worked with the CreateCompositeAddressLocator_geocoding method knows how the "in_field_map" parameter is formed?
1
vote
1answer
211 views
How to drop ArcSDE connection using Python scripting?
I want to be able to control connections to ArcSDE via python. Here is my script so far using ESRI's example.
import arcpy
from arcpy import env
env.workspace = r"SDEConnection"
fcList = ...
2
votes
1answer
162 views
Create a square grid polygon shapefile with python
i have the following coordinates
minx,maxx,miny,maxy = 448262.080078, 450360.750122, 6262492.020081, 6262938.950073
i wish to create a square grid of size 1 m using python.
import math
...
1
vote
1answer
59 views
Showing map in Grass Layer Manager/Map Display via Python
I've created some raster(tif) maps using Grass libraries in Python. I want to opem them automatically in Grass GIS Map Display or Layer Manager after creation. I don't want to use GUI for this. What ...
3
votes
0answers
28 views
Using PROJ.4 library to transform from local coordinate system coordinates to global coordinate system using ground control points?
I have a point cloud whose coordinates are with respect to a local coordinate system. I also have ground control points with GPS values. Can I convert these local coordinates to a global coordinate ...




