Search Results
Search type | Search syntax |
---|---|
Tags | [tag] |
Exact | "words here" |
Author |
user:1234 user:me (yours) |
Score |
score:3 (3+) score:0 (none) |
Answers |
answers:3 (3+) answers:0 (none) isaccepted:yes hasaccepted:no inquestion:1234 |
Views | views:250 |
Code | code:"if (foo != bar)" |
Sections |
title:apples body:"apples oranges" |
URL | url:"*.example.com" |
Saves | in:saves |
Status |
closed:yes duplicate:no migrated:no wiki:no |
Types |
is:question is:answer |
Exclude |
-[tag] -apples |
For more details on advanced search visit our help page |
Python is an open source interpreted programming language used in many GIS programs.
2
votes
Accepted
Storing a geographic minimum spanning tree with PyShp
Looking at the second graphic it looks like edge_list is all the coordinate values mixed together and sorted in order, not coordinate pairs. For the shapefile geometry you should be appending (x,y) tu …
3
votes
Accepted
How to use rasterio transform on all bands
Rasterio's docs for pad say:
pad_width: int
number of pixels to pad array on all four sides
So you need to pass a single value, not numpy's sequence of before/after values:
pilpadimg = rasteri …
1
vote
Linearly comparing one point to all points within 20' foot area, for every point in dataset ...
In this type of analysis it can be nice to jump out of nested cursors and buffers and work directly on the data with a spatial index. In doing similar work I've found that using the rtree library cuts …
1
vote
Inverting spatial filter
Inverting your current filter means you would have the rest of the 43m points to search through, so that doesn't sound good.
Since you know the radius of your circles, you can buffer the big polygons …
4
votes
Get all vertices of a polygon using OGR and Python
If you're looking just at shapefiles, you could also use pyshp.
import shapefile
sf = shapefile.Reader("shapefiles/blockgroups")
shapes = sf.shapes()
for shape in shapes:
for vertex in shape.points …
4
votes
Creating two-colored map of region in one color, and neighbors in another color?
You could go the GIS route - use QGIS, and use its Python automation to generate a map and export it to an image.
If you like Javascript, D3 can make nice maps. … Another Python alternative would be to use a combination of Shapely, MatPlotLib, and Descartes. Here's a blog post that shows a map creation workflow. …
1
vote
Accepted
Embedding Basic-Script in ArcGIS?
The subprocess module should do the job:
import subprocess
# ... do what you need to do
grapher = "\path\to\grapher.exe"
x_opt = '-x'
bas_file = "\path\to\filename.bas"
result = subprocess.check_outp …
1
vote
Saving geographic minimum spanning tree in KML and shapefile using Python?
Your KML still isn't interleaved correctly. Your original data is approximately -70 longitude and 10 latitude, you have a cluster of points and around (-70, -70), and another cluster around (10, 10).
…
5
votes
Python rtree and parallelized code
The problem is that rtree is a ctypes wrapper around libspatialindex, and pickle has no way of storing the pointer to the rtree in memory.
You could instead store the index to disk:
from multiproces …
1
vote
Accepted
Using Python to create a GeoTIFF File
First see this post for how to write GCPs:
In python gdal how to add Ground Control point to GeoTiff image by using gdal_translate
You can then get the GCPs in your source image with ds.GetGCPs
So all …
1
vote
Python Fiona affecting external GDAL binaries?
Importing Fiona can set some GDAL library paths, so you may want to run your subprocess using a copy of your original environment before the Fiona import changes anything.
import subprocess, os
my_en …
8
votes
Accepted
Saving python Rtree spatial index to file?
Is the built-in disk serialization an acceptable solution?
Make an index and flush it to disk:
from rtree.index import Index
idx = Index('filename')
idx.insert(0, (1, 2, 3, 4))
idx.get_bounds()
# [1 …
2
votes
Accepted
Calling Python ogr2ogr from PHP doesn't work as expected?
You may need to set some of GDAL's environmental variables when you run subprocess, such as GDAL_DATA.
You can see which are being set in the MS4W setenv.bat script.
0
votes
Executing Python code takes a lot of time (more than 2 hours)? (Arcgis10.1)
I don't totally understand the output of your analysis, but it seems like that for each feature being evaluated you're doing a lot fiddling - copying datatsets, joining them, adding fields, deleting t …
2
votes
Counting nodes/vertices in large polyline GeoJSON?
You can use the json or simplejson library to convert the geojson to a Python object, then loop through each LineString. …