Geolocation
Geolocation
Data Analysis
● decimal degrees
Example Task
● You are given the records of taxi trips in San
Francisco
Example Task
● You are given the records of taxi trips in San
Francisco
Departure Arrival
Car ID
Date-Time Latitude Longitude Date-Time Latitude Longitude
two-dimensional
plane?
Longitude
Map Projections
We cannot just use latitude and longitude as
coordinates in a two-dimensional plane!
Cylindrical Projections
map = Basemap(projection='ortho',
lat_0=0, lon_0=0)
map.drawmapboundary(fill_color='aqua')
map.fillcontinents(color='coral',lake_color='aqua')
map.drawcoastlines()
x, y = map(lons, lats)
map.scatter(x, y, marker='D',color='m')
Visualizing Spatial Data
● You want to see how the departure/arrivals are scattered in different
areas of the city.
● Zones of city are not natural features. You have to load this data
separately.
Shapes
Geospatial data often represents shapes in the form of points,
paths and surfaces
● A Point is a coordinate
● A LineString consists of a series of segments
● A Polygon is a closed LineString
LineString Polygon
GIS data formats
● GIS data files usually represent:
– Geospatial features (points, lines, shapes, ...)
– Attributes (population, name, ...)
– Meta-data (datum, projection, ...)
– Display information (color, line styles, ...)
– ...
● Types of GIS data:
– Raster format data
– Vector format data
raster vector
Shapefiles
● Shapefiles are one of the most common vector data formats
● A collection of multiple files
– .shp (spatial information)
– .prj (projection information)
– .dbf (database of attributes)
– .shx (index for fast access)
– ...
● Equals
● Disjoint (no point in common)
● Intersects (not disjoint)
● Touches (at least one boundary point in
common, but no shared interior points)
● Contains
● Within (same as Contains, opposite order
of argument)
True
Example Task (continued)
For each date/time/region, we should count the number of
trips in the data