Python Geospatial Development Essentials
Packt Publishing Ltd, 17/06/2015 - 192 páginas
This book provides you with the resources to successfully develop your own GIS application in Python. The book begins by walking you through the loading and saving of data structures before you start to build the look and feel of your application and create its interactive map window. You'll then move on to managing, editing, and analyzing spatial data from within the application and finish with instructions for packaging the application for distribution.
By the end of the book, you should be able to use your GIS application as a template for further development, with the potential to expand and customize it to suit your needs.
Resultados 1-5 de 5
To deal with the shapefile format, an old but very commonly used vector file
format, we use the popular and lightweight PyShp library. To install it in the
command line just type C:/Python27/Scripts/pip install pyshp. Inside the from_file
import builtins import itertools # import fileformats import shapefile as pyshp
import pygeoj # shapefile if filepath.endswith(".shp"): into nr shapewriter = pyshp.
Writer() #  Chapter 2 File format not supported Saving vector data.
Unfortunately, PyShp currently has no ready-made way to save geometries
directly from GeoJSON dictionaries, so we first create a function to do this
conversion. Doing this requires making an empty PyShp shape instance and
setting the ...
We can then loop all our features, use our function to convert GeoJSON into
PyShp shape instances, append those to the writer's _shapes list, encode and
add the feature's row with the record method, and finish up by saving. The entire
geojtype = geoj ["type" | if geojtype == "Null": pyshptype = pyshp. NULL elif
geojtype == "Point": pyshptype = pyshp. POINT elif geojtype == "LineString":
pyshptype = pyshp. POLYLINE elif geojtype == "Polygon": pyshptype = pyshp.