Most Popular
1500 questions
22
votes
7 answers
Plot shapefile with matplotlib
I am trying to read a shapefile and plot it using matplotlib. Here is the code:
import matplotlib.pyplot as plt
import shapefile
shpFilePath = "D:\test.shp"
listx=[]
listy=[]
test = shapefile.Reader(shpFilePath)
for sr in test.shapeRecords():
…
statBeginner
- 765
- 4
- 10
- 19
22
votes
3 answers
Importing qgis.core when writing standalone PyQGIS script
I am trying to write a standalone Python script in windows 7 that uses qgis.core and various other qgis libraries.
I have found an old question on this subject at Writing standalone Python scripts using PyQGIS? and was following its advice, by using…
user24956
- 409
- 1
- 3
- 13
22
votes
8 answers
Deleting fields using QGIS
When is the option to delete field in an attribute table enabled in QGIS?
I'm in editing mode and still am not able to delete a field.
vascobnunes
- 5,570
- 13
- 49
- 74
22
votes
5 answers
Using layer loadstart & loadend events in OpenLayers 3?
OpenLayers 2 has these layer events "loadstart & loadend."
What is equivalent to them in OpenLayers 3?
While a vector layer loads and is rendered, I need to show a loading icon.
Mariam Malak
- 603
- 1
- 6
- 17
22
votes
2 answers
Having drop down list for feature editing (attributes) in QGIS
I'm editing a lot of polygons of a shapefile in QGIS and I need to classify them, so I have to write the classes repeatedly. In ArcMap there is an option to have domains set for the fields.
How do I do this in QGIS?
vascobnunes
- 5,570
- 13
- 49
- 74
22
votes
7 answers
Options for displaying PostGIS vectors in OpenLayers
I am very new to web-mapping, so this question may be a little misguided.
I want to have a very simple web interface using OpenLayers (or even Google Maps if that will be easier) which can display a number of point and polygon tables that are…
fmark
- 9,381
- 9
- 39
- 45
22
votes
3 answers
Running Python Script when opening MXD?
Can anyone tell me how to accomplish this?
I want a Python script to run on opening the MXD which would pull an excel worksheet into a GDB and refresh the map.
I only want this to happen in this specific MXD.
gg7aph
- 321
- 2
- 3
22
votes
3 answers
Is it possible to rotate the canvas in QGIS
Can the canvas be rotated so north is pointing in some other direction than defined by the projection? This question answers with respect to the composer, but not the canvas. There is a related 5 year old entry in the bug tracking database that's…
Llaves
- 5,963
- 5
- 31
- 56
22
votes
3 answers
Why do valid polygons repeat the same start and end point?
In the GIS world, for most modern formats and Standards (e.g., Shapefiles, WKB/WKT, GML, KML, etc.), valid polygons need to have closed linear rings, which is a linestring of coordinates where the first point is a repeat of the last point. For…
Mike T
- 42,095
- 10
- 126
- 187
22
votes
2 answers
Ways of expressing geographic questions in machine readable form
A core concept of GIS is answering questions about datasets. From the point of view of a database; SQL with spatial extensions is a way of asking such questions.
What other ways can questions be expressed in a machine readable text based form?
What…
Matthew Snape
- 6,127
- 2
- 27
- 48
21
votes
9 answers
Choosing database for storing spatial data?
A couple of days ago I installed the demo of spatialware 4.9 from MapInfo into my SQL Server 2005 install and loaded all the larger dataset into it. I was quite impressed with the performance vs the old file based approach but it got me thinking…
Nathan W
- 34,706
- 5
- 97
- 148
21
votes
2 answers
How to draw polygons from the python console?
I've been visiting and revisiting the page on geometry handling in the PyQGIS Cookbook: http://documentation.qgis.org/2.0/en/docs/pyqgis_developer_cookbook/geometry.html but can't seem to figure out how to get the polygon to draw from the Python…
user25976
- 2,115
- 1
- 22
- 39
21
votes
4 answers
Calculating roundness/compactness of polygon?
I am trying to find ways to quantitatively describe the shapes of various polygons. For my project, these polygons represent lakes, rivers, lagoons, and parks. So they can be almost any shape. One easy metric is to calculate perimeter vs. area,…
user25201
- 371
- 1
- 2
- 6
21
votes
5 answers
What is unit of Shapely length attribute?
I'm doing a very simple calculation of the length of a Polyline using shapely:
from shapely.geometry import LineString
...
xy_list = [map(float, e) for e in xy_intm]
line = LineString(xy_list)
s = '%s,%s,%s' % (fr, to, line.length)
My coordinates…
LarsVegas
- 2,536
- 3
- 30
- 47
21
votes
1 answer
Why close a dataset in GDAL Python?
I see quite often in Python GDAL code that people close datasets at the end of their script. Why does it makes sense to close a dataset in Python GDAL? Are there any consequences if I don't do it?
import gdal
# open dataset
ds =…
ustroetz
- 7,994
- 10
- 72
- 118