Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
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
Geospatial Data Science Quick Start Guide

You're reading from   Geospatial Data Science Quick Start Guide Effective techniques for performing smarter geospatial analysis using location intelligence

Arrow left icon
Product type Paperback
Published in May 2019
Publisher Packt
ISBN-13 9781789809411
Length 170 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Authors (2):
Arrow left icon
Abdishakur Hassan Abdishakur Hassan
Author Profile Icon Abdishakur Hassan
Abdishakur Hassan
Jayakrishnan Vijayaraghavan Jayakrishnan Vijayaraghavan
Author Profile Icon Jayakrishnan Vijayaraghavan
Jayakrishnan Vijayaraghavan
Arrow right icon
View More author details
Toc

Geometry and topology (lines and polygons)

In this chapter, we will use the Brazil GPS Trajectories dataset from UCI. It contains GPS points (latitude and longitude) with timestamps. It also contains unique track_id for each trajectory.

Here is what the first five rows of the data look like:

GPS trajectory: first five rows

We create a GeoDataFrame using a function we created in Chapter 4, Making Sense of Humongous Location Datasets:

def create_gdf(df, lat, lon):
""" Convert pandas dataframe into a Geopandas GeoDataFrame"""
crs = {'init': 'epsg:4326'}
geometry = [Point(xy) for xy in zip(df[lon], df[lat])]
gdf = gpd.GeoDataFrame(df, crs=crs, geometry=geometry)
return gdf

traj_gdf = create_gdf(trajectories, "latitude", "longitude")
aracaju_city_points = traj_gdf[(traj_gdf['latitude']&lt...
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