0
votes
0answers
34 views

Problem reducing the width of the attributes fields of a shapefile using python

I have a shapefile with rather long attribute widths (which is resulting in a rather large file). I am trying to trim it in python, here is my code: layer = qgis.utils.iface.activeLayer() ...
0
votes
1answer
29 views

Select by attributes within the fiona Python module

Is it possible to select polygons from a shapefile based upon their attributes using the Fiona Python module? I can't seem to find anything in the docs, but it seems like a strange thing not to be ...
1
vote
2answers
57 views

Separating a shapefile into separate shapefile based upon their features using a python script [duplicate]

I have a shapefile of a US. I need to make an individual shapefile for all the states in the US using a python in ArcGIS. How can I do it?
3
votes
0answers
24 views

Why does the QgsVectorFileWriter have probelms creating vector files?

I am using QGis 2.0.1 and have tried to create a new GIS feature file (SQLite, Spatialite, and Shapefile) of a subset of the data. I am then saving a copy of the style of this layer and applying it to ...
1
vote
1answer
44 views

Selection/Deletion of all smaller polygon/s in a SHP - Python solution?

ArcMap 10.2 user, with Spatial Analyst only. No ArcServer or of sort. I have abt 500+ polygon shapefiles, each containing 2 or more polygons. All of them has a NAME column and the rest of the ...
2
votes
0answers
49 views

Identify different networks inside a line shapefile

I'm dealing with a quite big line shapefile containing road tracks. The roads are connected to each other, creating distinct networks. These networks are independent and they are not connected to each ...
1
vote
1answer
112 views

Problem creating point shapefiles programmatically using python in QGIS 2.2

I am trying to create a point shapefile in the memory buffer (for a temporary label) and then zoom to the extents on this buffer. The working (in version 2.1) test code for this is: def ...
1
vote
3answers
368 views

Python: How to create a Polygon Shapefile from a list of X,Y coordinates?

I have a list of X,Y coordinates from a csv file, that represent a polygon. I´m trying to create a Polygon-Shapefile from this list. I´ve been trying around and found a possbility to write the list to ...
1
vote
0answers
54 views

Where are dynamic hyperlinks stored?

A while back (ArcGIS 10.0 times, or maybe even 9.3) a colleague of mine created a mxd with a few hundred manholes and attached dynamic hyperlinks to them (pointing to photos of them). (I know this ...
1
vote
2answers
152 views

Creating a new feature class with python and then adding attibutes

I am having trouble adding rows to a shapefile after it has been created. I'm not sure if I need to create the shapefile in memory and add the data or creating then re-open the file. While I've ...
0
votes
0answers
55 views

QGIS and usage of ExportToKML()

I am trying to dump to a csv file the geometry (and attributes) of a shapefile, including a KML dump (using a python script as described in shp-to-csv) but I am unable to get the correct coordinates ...
0
votes
1answer
25 views

osm_id in a shapefile vs. the uid and id attributes in an OSM file

I'm parsing an OSM file using the Python package osmread. The entities parsed have the following attributes id, version, changeset, timestamp, uid, and tags. On the other hand, I have a shapefile, ...
1
vote
3answers
210 views

How to install Fiona to read Shapefile attributes with OSGeo4W?

I´m developing a plugin in Python and I need to read the shapefile attributes, so I found the Fiona API and dbfpy also but I don't understand how to install these packages because I install the QGIS ...
4
votes
1answer
57 views

SpatialLite BulkLoad and Merge

Via the U.S. Census I have downloaded all of the census group shapefiles. These are approximately 19-20GB across 56 shapefiles. I want to merge these to do some testing. Clearly, shape file ...
1
vote
1answer
56 views

Polygons not appearing when creating shapefile based on criteria using GDAL and Python (area calculated properly)

I am looping over the features of a shapefile containing multiple polygons. If certain criteria are met, I want to save the current feature in a new shapefile. I am doing this using GDAL 1.10.0 with ...
3
votes
2answers
112 views

Create network from shapefile without ArcGIS?

I want to perform shortest-path analysis on a network whose edges represent real-world roads and whose nodes are buildings or other locations. I have the shapefile for the area I'm interested in. ...
3
votes
1answer
69 views

How to find number of fields in shapefile using Python?

I've been looking at the ArcGIS resources for python but I can't seem to figure this one out. I'm looking for a method to gain access to the number of fields that are within a shapefile / feature ...
0
votes
0answers
77 views

Looking for java (or python) APIs to read shapefiles

Consider a work flow which receives a data field, e.g. “basemap” as shown in the image, and fills polygons with color on the basis of its numeric values. I am interested in java programming to carry ...
1
vote
2answers
118 views

How to add shapefile as layer to map using Python and ArcPy?

I am working on an application and I am a beginner in Python :( I want to add a shapefile, the execution is successful and everything but no result appears on ArcMap, here is the code I use: import ...
1
vote
1answer
145 views

Automatically determine polygon overlap 'islands'

I have a shapefile with many polygons. Some partly overlap with each other, some are not overlapping. I'm considering a polygon to be overlapping given a minimum area of overlap. 'Islands' of partly ...
2
votes
3answers
156 views

How to find and apply reprojection parameters?

I have a data set in one projection, and a shapefile in another, and I am trying to combine the two. I am using Python. I apologize for posting a "help me transform coordinates" question on this site ...
0
votes
1answer
113 views

How to read shapefile of road segments into Python data structure to get begin and end point coordinates? [duplicate]

How can I take a shape file that has road segments and read it into a data structure in python that I can use to get begin and end points with? For example x, y to x2, y2. It's not a large shape ...
1
vote
2answers
96 views

Using python elif syntax in Field Calculator to reclassify a range of values from a different field and populate a new field

I'm trying to use the Field Calculator with a python elif statement to reclassify values from a different field and populate a new field, and while I'm not getting an error message of any kind, I'm ...
0
votes
1answer
133 views

Why do Shapefiles and GeoJSON behave differently in GDAL Python?

I have a test.shp. I loop over the file, buffer the features, and write the buffers to a new file. I tested writing the buffers to a Shapefile and to a GeoJSON. If I try to use the new buffer layer ...
5
votes
1answer
164 views

Python3 libraries for GIS analysis

I am trying to do some spatial data analysis in Python 3 now, and I was wondering what the best libraries are for GIS in Python 3. The Fiona library was developed with Python 3.3 but the Python 3+ ...
2
votes
1answer
65 views

How to run shapefile.py

I'm script challenged and trying to repair a shapefile with a missing .shx. This tool sounds ideal: https://code.google.com/p/pyshp/, but the four step instructions are not enough. Can someone give me ...
4
votes
1answer
146 views

Convertion of multiple csv automatically to shp

I have more than two hundreds similar csv files with columns (x, y, value1, value2, objectName). I need to convert them automatically to shp files with x and y columns as the coordinates. Could you ...
1
vote
2answers
405 views

Python - GDAL : Polygon to point shape file

I want to read all the points in a polygon shape-file and use their coordinates to make a new point shape file. then find the min and max of the X coordinates. So here is the code I wrote for the ...
2
votes
2answers
343 views

Python: how to create a point shape-file from a text file

I'm writing a python code to read the points in a polygon shape-file and save them in a point shape file. I'm not sure about my approach so if you have a better idea (even if it is totally different ...
1
vote
0answers
70 views

How to join attributes by location with command line

I would like to joint the attributes of 2 shapefiles by location but with a command line (linux). This feature is easy in QGIS but it is VERY slow. Is there a way of doing this with ogr or pyqgis ? ...
2
votes
2answers
250 views

How to select specific filenames nested within several folders?

I have hundreds of shapefiles that are stored in separate folders, which are nested within several other folders. Among the shapefiles I only need the ones that are named 'POINT*.shp' How do I get ...
2
votes
2answers
64 views

Accessing features via arcpy

i try to use arcpy to accessing the features of a shapefile. I tried to use a searcheCursor, like that: cursor = arcpy.da.SearchCursor(Points, ["SHAPE@XY"]) for row in cursor: x, y = row[0] ...
0
votes
3answers
1k views

Using the python shape library: pyshp - how to convert polygons in .csv file to .shp

I'm converting csv data to shapefiles using the pyshp python library. What I want to do is very similar to Using the python shape library: pyshp - how to convert .csv file to .shp, except that I ...
0
votes
3answers
277 views

Python: best practise to ceate a large shapefile

What is the best approach to create a create a very large shapefile (close to the max of 2GB) using python? Best approach means: robust and fast. Above all fast.
1
vote
0answers
120 views

How to shift vertices of shapes in shapefile using FOSS python library?

I need to shift each vertice of shape in a shapefile (of any type:point, line, polygon, multiline etc.) with Python. I need to loop in all shapes, get the vertices, get it's coordinates and for each ...
0
votes
2answers
175 views

Help writing script using a shapefile - select by attribute

I am trying to take an existing shapefile and narrow down the attributes using the 'select by attribute' The problem I am trying to solve is: Find parcels that have an acreage >= 100. The code I ...
5
votes
1answer
2k views

How to convert shapefile to SVG keeping internal data?

I am very new to GIS. I found a tutorial on how to make a choropleth using Python tools. I want to follow it but use my own data and map. However the tutorial uses a US map SVG file and I need to use ...
2
votes
2answers
272 views

Python GDAL/OGR: retrieved feature is NoneType

I'm doing some scripts in Python to deal with shapefiles, and I have an issue I don't understand. I'm looping over a shapefile, and I want to retrieve the geometry of each feature, but very often I ...
4
votes
2answers
483 views

Is it possible to route shapefiles using python and without ArcGIS, QGIS, or Pgrouting?

The question is pretty much in the title. Is there a way to route through a road line shapefile using python and some library without having to resort to converting the data into PostGIS/pgrouting or ...
9
votes
6answers
335 views

How to programmatically check if the number of shapes = number of table records?

I have a handful of approximately 1000 shapefiles that are corrupted (see attached error message). The shapefiles were generated from eCognition Developer 8. There is a script tool that seems to ...
0
votes
1answer
282 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 ...
1
vote
1answer
285 views

Python GDAL/OGR: WGS84 & meters units

I'm dealing with shapefiles projected in: GEOGCS["GCS_WGS_1984", DATUM["WGS_1984", SPHEROID["WGS_84",6378137,298.257223563]], PRIMEM["Greenwich",0], ...
17
votes
2answers
3k views

Visualize shapefile in Python

I was searching the internet to see if it is possible to visualize geographical data in Python, without always opening ArcGIS and make a map (because I have a lot of scripts that uses arcpy). On the ...
1
vote
1answer
126 views

How to iterate all input folders (containing coverages) using Python with ArcGIS 9.3?

I'm trying to write python scripts to batch convert thousands of coverages to shapefiles in arcgis 9.3. The coverages files are in different folders: d:/area_A/building d:/area_B/building ...
0
votes
2answers
82 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
93 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
180 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
629 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
410 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
477 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 ...