Slide 1

Slide 1 text

PYCON 2012 A GENTLE INTRODUCTION TO GIS Jason Scheirer esri bit.ly/pycongis

Slide 2

Slide 2 text

Front Matter Things I wish I’d known Lots of theory The web is already covered bit.ly/pycongis

Slide 3

Slide 3 text

More than points

Slide 4

Slide 4 text

More than points

Slide 5

Slide 5 text

More than points

Slide 6

Slide 6 text

More than points

Slide 7

Slide 7 text

More than points

Slide 8

Slide 8 text

More than points

Slide 9

Slide 9 text

No content

Slide 10

Slide 10 text

Storage

Slide 11

Slide 11 text

Vector Data FILE Shapefile KML GML GPX GeoJSON Spatialite File GDB (Esri) DATABASE SQL Server Oracle PostGIS

Slide 12

Slide 12 text

Raster Data FILE GeoTIFF JPEG2000 Esri GRID NetCDF HDF5 IMG ECW MrSID File GDB (Esri) DATABASE SQL Server Oracle PostGIS

Slide 13

Slide 13 text

Data is conventional

Slide 14

Slide 14 text

Constraints are not Integrity = Topology

Slide 15

Slide 15 text

COPY/CONVERT/TRANSLATE/REPROJECT ogr, pyproj ogr2ogr, gdalwarp, gdaltransform, gdal* arcpy.management.CopyFeatures arcpy.management.CopyRaster arcpy.management.Project arcpy.management.DefineProjection OSS: ArcGIS:

Slide 16

Slide 16 text

What

Slide 17

Slide 17 text

Perfect sphere

Slide 18

Slide 18 text

Lumps and bumps

Slide 19

Slide 19 text

Tweak to fit

Slide 20

Slide 20 text

Just a little more...

Slide 21

Slide 21 text

Close enough!

Slide 22

Slide 22 text

No content

Slide 23

Slide 23 text

Geodesy

Slide 24

Slide 24 text

WGS 84 Global Positioning System datum

Slide 25

Slide 25 text

NAD 83 North American datum

Slide 26

Slide 26 text

No content

Slide 27

Slide 27 text

No content

Slide 28

Slide 28 text

No content

Slide 29

Slide 29 text

No content

Slide 30

Slide 30 text

DEGREE/MINUTE/SECOND 17°39'27"E 14°42'33"N DECIMAL DEGREES 17.6574318720082 14.7092630700184 UTM ZONE 33P 1627845N 786174E

Slide 31

Slide 31 text

UTM ZONES

Slide 32

Slide 32 text

UTM GRID

Slide 33

Slide 33 text

UTM GRID

Slide 34

Slide 34 text

U.S. STATE PLANE !

Slide 35

Slide 35 text

No content

Slide 36

Slide 36 text

No content

Slide 37

Slide 37 text

Geographic Coordinate Systems Global Degrees Regional UTM Zones Local Grids/Planes

Slide 38

Slide 38 text

Visualization

Slide 39

Slide 39 text

No content

Slide 40

Slide 40 text

f(x, y, z) (x, y) Map Projection

Slide 41

Slide 41 text

Mathematical model of planet/area of interest Datum/Grid/Benchmark Context for referring to places on model Geographic Coordinate System Mapping from geographic to map coordinates Projected Coordinate System Map

Slide 42

Slide 42 text

The big tradeoff Preservation of shape Preservation of area

Slide 43

Slide 43 text

Every map is a LIAR

Slide 44

Slide 44 text

No content

Slide 45

Slide 45 text

No content

Slide 46

Slide 46 text

No content

Slide 47

Slide 47 text

No content

Slide 48

Slide 48 text

No content

Slide 49

Slide 49 text

No content

Slide 50

Slide 50 text

No content

Slide 51

Slide 51 text

No content

Slide 52

Slide 52 text

No content

Slide 53

Slide 53 text

No content

Slide 54

Slide 54 text

Great Circle

Slide 55

Slide 55 text

>>> geod = pyproj.Geod(ellps='WGS84') >>> geod.npts(-116.993, 36.404, -0.659, 53.501, 10) [(-111.95067424159357, 41.97895680147041), (-105.96857250647616, 47.28567205186159), (-98.70968905555657, 52.20795019303087), (-89.76321873473009, 56.57373830261407), (-78.73417693105489, 60.137140502912196), (-65.50792704328728, 62.583294153845756), (-50.664741106486275, 63.59986753968315), (-35.59231296246254, 63.024821865584016), (-21.813955926298505, 60.952490703845044), (-10.156489980662073, 57.66944410754948)]

Slide 56

Slide 56 text

>>> sr = arcpy.SpatialReference("WGS 1984 World Mercator") >>> start, end = (arcpy.Point(-116.993, 36.404), arcpy.Point(-0.659, 53.501)) >>> polyline = arcpy.Polyline(arcpy.Array([start, end]), sr) >>> [polyline.positionAlongLine(polyline.length * (idx / (11.))) for idx in xrange(12)] [, , , , , , , , , , , ]

Slide 57

Slide 57 text

No content

Slide 58

Slide 58 text

No content

Slide 59

Slide 59 text

Analysis

Slide 60

Slide 60 text

Doing stuff with spatial data

Slide 61

Slide 61 text

Geocoding 480 New York St, Redlands, CA Art Galleries near 92373 White House

Slide 62

Slide 62 text

Network Analysis Right on... Left on... Currently there are 15 households without power...

Slide 63

Slide 63 text

Spatial Analysis Relational Topological

Slide 64

Slide 64 text

Relational operators Contains Indicates if this geometry contains the other geometry. Crosses Indicates if the two geometries intersect in a geometry of lesser dimension. Disjoint Indicates if the two geometries share no points in common. Negate this result to compute the Intersect relation. Equals Indicates if the two geometries are of the same type and define the same set of points in the plane. Overlaps Indicates if the intersection of the two geometries has the same dimension as one of the input geometries. Touches Indicates if the boundaries of the geometries intersect. Within Indicates if this geometry is contained (is within) another geometry.

Slide 65

Slide 65 text

Relational operators NOT DISJOINT

Slide 66

Slide 66 text

Topological operators Boundary The boundary of this geometry. A polygon's boundary is a polyline. A polyline's boundary is a multipoint. A point or multipoint's boundary is an empty point or multipoint. Buffer Constructs a polygon that is the locus of points at a distance less than or equal to a specified distance from this geometry. Convex Hull Constructs the convex hull of this geometry. Cut Splits this geometry into a part left of the cutting polyline, and a part right of it. Difference Constructs the geometry containing points from this geometry but not the other geometry. Intersect Constructs the geometry that is the set-theoretic intersection of the input geometries. Use different resultDimension values to generate results of different dimensions. Symmetric Difference Constructs the geometry that contains points from either but not both input geometries. Union Constructs the geometry that is the set-theoretic union of the input geometries.

Slide 67

Slide 67 text

Topological operators

Slide 68

Slide 68 text

Topological operators

Slide 69

Slide 69 text

Topological operators

Slide 70

Slide 70 text

Topological operators

Slide 71

Slide 71 text

Topological operators

Slide 72

Slide 72 text

Topological operators

Slide 73

Slide 73 text

Topological operators

Slide 74

Slide 74 text

Intersect/not disjoint (ArcGIS) sr = arcpy.SpatialReference("WGS 1984 World Mercator") with arcpy.da.SearchCursor('fastfood.shp', 'SHAPE@' spatial_reference=sr) as cursor: buffered_points = [row[0].buffer(1000) for row in cursor] with arcpy.da.SearchCursor('schools.shp', ['SHAPE@', 'school_name']) as school_cursor: schools_within_1k_of_fast_food = [row[1] for row in school_cursor if any(not shape.disjoint(pt) for pt in buffered_points)] buffer_dataset = arcpy.analysis.Buffer('fastfood.shp', r'in_memory\buffered_points', '1 kilometer') arcpy.analysis.SelectByLocation('schools.shp', 'within', buffer_dataset) arcpy.management.CopyFeatures('schools.shp', 'found_schools.shp') arcpy.management.Delete(buffer_dataset)

Slide 75

Slide 75 text

No content

Slide 76

Slide 76 text

No content

Slide 77

Slide 77 text

gis.stackexchange.com bit.ly/pycongis Basemaps used: Light Gray Canvas, World Topo, National Geographic World Map. All on ArcGIS Online.