Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Python GeoSpatial Analysis Essentials

You're reading from   Python GeoSpatial Analysis Essentials Process, analyze, and display geospatial data using Python libraries and related tools

Arrow left icon
Product type Paperback
Published in Jun 2015
Publisher
ISBN-13 9781782174516
Length 200 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Erik Westra Erik Westra
Author Profile Icon Erik Westra
Erik Westra
Arrow right icon
View More author details
Toc

Spatial analysis recipes

Now that we have a full set of geospatial analysis libraries available to us, let's see how we can use them to solve some real-world problems. We will look at how we can calculate and work with locations, lengths, and areas, as well as how we can use NetworkX to calculate the shortest available path between two points.

Calculating and comparing coordinates

As we saw earlier, PyProj can be used to calculate the real-world distance between two locations. It can also be used to measure the angle of a line going between two points, and calculate new points based on a starting point, a distance, and a heading.

Let's use PyProj to calculate the distance between two points. We will then use it to calculate a location at a certain distance and heading from a given point.

Start by creating a new Python program named coord_analysis.py. Enter the following code into the start of this program:

import pyproj
geod = pyproj.Geod(ellps="WGS84")

So far, this is identical...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image