Tagged Questions
0
votes
2answers
58 views
Python to get ids from shp dont return all records
I have some Python code to get the ids and georeference from a shapefile:
canvas = qgis.utils.iface.mapCanvas()
allLayers = canvas.layers()
nos = QgsFeature()
for i in allLayers:
if ...
0
votes
1answer
68 views
How to convert geometry of SHP to decimals
I try to create a line with two points. These points are obtained in a SHP layer.
How can i convert that points to decimals?
Thank you
0
votes
2answers
52 views
Splitting Shapefiles [duplicate]
I am trying to create a code that will accept the input of a shapefile, and separate each of its features into separate shapefiles into a specified directory location. Can anyone help ? I am trying to ...
1
vote
2answers
62 views
How to Add Shapefile with Symbology from Layer File to ArcMap MXD using ArcPy/Python?
Say I have a Shapefile:
C:\DATA\points.shp
A layer file:
C:\SYMBOLOGY\symbology.lyr
And a map document:
C:\MAPS\map.mxd
How can I add points.shp to map.mxd with the properties of symbology.lyr ...
0
votes
0answers
141 views
Problem reading attribute with Python using osgeo.ogr
I am working thru "Python Geospatial Programming" and I have a problem in a program in Chapter 6 that I cannot seem to solve.
The small program:
import osgeo.ogr
shapefile = ...
3
votes
2answers
115 views
Csv to Shp conversion? [duplicate]
I am working on a really big script right now where I have a csv file that I have removed rows and columns from, and edited the headers. I need to create one big shapefile for the entire csv file then ...
1
vote
1answer
154 views
Find and replace unicode character in a shapefile
I've found several example of script and blog posts on working with unicode characters, but I haven't been able to make anything works so far... It's a little frustrating
I have a shapefile encoded ...
2
votes
1answer
69 views
OGR - Weird GeomType -2147483645 on polygon shapefile
I am trying to import a shapefile (multipolygon) in an app with ogr but I got an error about invalid geom type. If I inspect the data with ogr like this:
datasource = ogr.Open("c:\\temp\\data.shp")
...
3
votes
3answers
127 views
Updating Attributes using Pyshp
Is it possible to update an attribute field in a shapefile using pyshp ?
I went through their documentation and all they show is how to create new attribute rather than editing or updating an already ...
1
vote
1answer
108 views
Why does Add Field to Layer File give “ERROR 000840: The value is not a Feature Layer”?
I'm trying to add a field to a layer file, but it always gives an error. What I did was making a closest facility layer and save the result as a layer and after that I tried to add a field, but then ...
1
vote
2answers
150 views
PyQgis overwrite shape file and adding layer to Qgis
I am creating a shapefile in python by:
driver = ogr.GetDriverByName('ESRI Shapefile')
datasource = driver.CreateDataSource('c:/temp/toke2.shp')
layer = ...
0
votes
0answers
88 views
Help in GRASS/QGIS/Python
I have Idea about ArcGIS, and a bit of QGIS and zero programming knowledge, which I am trying for thesedays. I saw GRASS GIS and have started working with shapefiles, which are not being loaded... :( ...
2
votes
1answer
74 views
need help for script checking topology using ogr in python
My main goal is to create a new feature indicating if the line features intersect each other as well as if they are not connected to a feature.
My problem is how to identify the intersecting and not ...
4
votes
2answers
267 views
How to write Shapely geometries to shapefiles?
Can someone demonstrate a simple way to write geometry data-structures from shapely into shapefiles? I am particularly interested in polygons with holes and linestrings. It would also be beneficial to ...
4
votes
2answers
202 views
Split a shapefile into multiple shapefiles based on a particular Field [duplicate]
I have a shapefile where there are 3 fields OBJECTID, NAME , LOCALITY. I want to create new shapefile that contains the geometry, projection etc. of the parent shapefile and according to the locality;
...
5
votes
2answers
281 views
How to get text attributes from shapefile with python / pyshp
I have a shapefile, containing only points in XY-coordinates and a string attribute for each point. I would like to read the coordinates and the attribute for postprocessing in python, but can't get ...
0
votes
0answers
81 views
Regional statistics from a dataset (point inside a polygon aka region)
I am relatively new to GIS and I am trying to do some geographical analysis on same data I've collected. The dataset I have consists essentially in a file with the following format:
...
7
votes
1answer
105 views
Reading shapefile tolerance in python
Is there a way to get the cluster or xytolerance from a shapefile into python using free/open source software?
I'm currently using the pyshp package and can't see methods for this anywhere. Also it ...
6
votes
2answers
121 views
How can I turn a vector layer into a graph G = (V, E)?
I have a number of rail networks, in the form of shapefiles of the "line" type. I want to turn them into a more abstract graph format, i.e. the kind with vertices and edges, not chart-type graphs. ...
1
vote
2answers
302 views
How to incorporate drop-down list within cells of shapefile attribute table using ArcGIS 10.0 or 10.1?
A question has been brought to my attention. When working with a shapefile within either 10 or 10.1. Is it possible to create a python script or some sort of programming language to accomplish this ...
2
votes
3answers
387 views
Creating new shapefile based on its attributes with python
I have a shapefile which has an attribute year. I used to generally copy and paste these features in the dataframe and then using the definition query just show polygons which were established before ...
6
votes
3answers
128 views
Are there any open source Python modules compatible with arcpy that will allow complex SQL queries?
I am trying to handle string (non-geometry) duplicates in a large attribute table of a shapefile without having to convert to gdb and back or connect to a postgres db. I need to be able to use a count ...
2
votes
2answers
298 views
Problems converting CSV to Shapefile using pyshp
I have a python script which converts csv data to shapefiles. It converts but won't get angle from csv.
Can anyone help me?
The CSV data looks like this:
fid_nr;x;y;angle
...
5
votes
1answer
65 views
Where do I append point values with pyshp?
I would like to generate a .shp with five points using shapefile available through pyshp. However, when I loop through my list I get only the last value. This makes sense as I did not append any of ...
2
votes
3answers
487 views
How do I use ogr2ogr to convert a GML to shapefile in Python
I am trying to convert a GML to an ESRI shapefile using ogr2ogr utility in a python script.
I have successfully installed the GDAL/OGR package via osgeo but I am now struggling to find/understand ...
1
vote
1answer
175 views
Edit Shapefiles Attribute data in GeoServer Programatically
I'm rendering a shapefile using GeoServer and using OpenLayers library to render it in the web browser.
Now I have created the option of editing the attribute data in web browser. I want the edited ...
1
vote
1answer
97 views
Extending ArcGIS
I've been tasked with a thesis project where i have to extend the features of ArcGis. I've been asked to create a model written in Python that can run out of ArcGIS 10. This model will have a simple ...
7
votes
1answer
152 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
476 views
From text data create a FeatureClass with table with python
I'm searching how the output of one program (text file with some writings, but also with data as numbers, dates, times, coordinates, all separated with commas) can be transformed to a Feature Dataset.
...
5
votes
1answer
667 views
Use python to add layers to TOC
I've been battling with adding layers to the TOC for some time now. I have managed to single layers added but need to loop through a folder and add all layers. Shapefiles I cannot get to add at all. ...
4
votes
1answer
906 views
Using the python shape library: pyshp - how to convert .csv file to .shp
I am trying to understand how I can use the csv module in python to open a csv file in the same folder as the python script, and then create a shapefile using the shapefile module pyshp.
The csv file ...
3
votes
3answers
196 views
How to compare a set of images with a shapefile?
I have around 150 images (rasters), each one is just a map of certain "classes", e.g. pixel value 1=forest.
I also have a shapefile that consists of roughly the same area as the 150 images constitute ...
5
votes
2answers
383 views
Importing attributes from Excel file into new Polygons
I have a constantly updated Excel file containing address information which I am currently copying into the attributes of new polygons which I am creating on a daily basis. I am currently doing this ...
4
votes
2answers
369 views
Python - Check for number of shapefiles in a directory
I want to test:
to see whether or not ONE AND ONLY ONE shapefile (which will be based on a filename wildcard) exists in a directory.
Add these shapefiles to a list
Use this list variable as an ...
3
votes
1answer
234 views
Python: shp file to GML using OGR
I am trying to convert a shapefile to GML 3.1.1 . I am using gdal 1.9.1 however the GML conversion it generates for a geometry feature is GML 2 and it also swaps the long/latitude coordinates. Are ...
1
vote
2answers
407 views
How to batch convert Shapefiles to GMLs?
I know how to do this within Quantum GIS but I have 30+ shapefiles that need to be converted to GML. Is there a Python script sample or plugin for Quantum GIS that I can use to convert my shapefiles ...
3
votes
1answer
379 views
How to save a newly created shapefile in PostGIS?
I am creating shapefile using shapefile.py and my database has records more that 65k which is the limit of the shapefile. How can I create shapefiles then?
Is it possible that somehow I am able to ...
3
votes
3answers
254 views
Add date to feature class name?
I still working on my big project, big at least for me, but I am currently stuck on this:
I have a lots of .shp, that I want to move to a gdb. While creating a feature class, I want
to add date ...
1
vote
3answers
405 views
Update shapefile data source with wildcard using python
I am attempting to update a layer's data source in Arcmap using python
for lyr in arcpy.mapping.ListLayers(mxd, "*", df):
if lyr.name == "project_whl":
...
2
votes
2answers
421 views
Unable to create shapefile using shapefile.py
I am trying to create shapefile from csv data using shapefile.py but i am constantly getting this error,
Traceback (most recent call last):
File "createShp_Davis.py", line 31, in <module>
...
4
votes
1answer
567 views
Move .SHP from .MXD to gdb [duplicate]
Possible Duplicate:
How to move SHP to gdb with ArcView license?
Let's cut it short, I have numerous mxd with layer coming from .SHP and various servers WMS that I need to move to a gdb.
...
4
votes
3answers
1k views
How do I include a variable in the where clause of arcpy.Select_analysis?
I am trying to loop through a shapefile, selecting each feature in turn and copying it to a temporary shapefile to by included in a union analysis. I'm using a cursor to find the ID name for each ...
2
votes
2answers
200 views
How do I set custom spatial reference/coordinate sys to my shapefile
I have a python code which converts JSON text file to a shapefile. I have to set coordinate system to this shapefile created. I do not want to access the .prj file from my computer as this code will ...
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 ...
3
votes
1answer
159 views
Problem with precision when convert from WKT to shapefile
I have a problem with converting from WKT to shapefile in pygdal. In wkt I have fields with precision (for example real 7.2). When I create a shapefile I have field numeric with no precision (numeric ...
4
votes
2answers
824 views
Check if shapefiles exists in folder
In ArcGIS modelbuilder I want to check if a shapefiles exists, if not I want to create the shapefile in that folder. I guess the calculate value tool within ArcGIS modelbuilder can be used, but I need ...
2
votes
1answer
210 views
How to add Real Attributes to Shapefile using pyqgis?
I created the Qmarxan plugin using the fTools plugin as an example base. When I create a new shapefile using the QgsVectorFileWriter function I don't have any difficulty specifying a "Real" field with ...
0
votes
1answer
360 views
ArcGIS: Extracting data from large intersect dataset
I have a big dataset imported into ArcMap. For each point, I created a buffers of 200m. And I apply Intersect to all the buffers, resulting in a huge dataset of around 2183962 objects.
Previously, I ...
5
votes
6answers
936 views
how to overlay shapefile and raster?
I have a shapefile with polygons. And I have a global raster file. I want to overlay the shapefile's polygons onto the raster grid and calculate the mean raster value for each polygon.
How can I do ...
2
votes
2answers
1k views
select column in csv file in Python
I would like to study a range of data using the same technique in ArcMAP (it will take too much time to do it one by one ;) !). I've been just recently playing with ArcMAP and Python (which can help ...

