Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Spatial Thinking with Python

Spatial Thinking with Python

A primer on Geospatial data

396d4ded03b2144bb96786c150ad06bf?s=128

sangarshanan

October 05, 2019
Tweet

Transcript

  1. Spatial Thinking with Python Sangarshanan

  2. {{ ME_IRL }} 2 sangarshanan sangarshanan Sangarshanan Recently graduated from

    VIT Vellore Working at Grofers Makes memes hanging upside down
  3. None
  4. The geostory begins

  5. When you realize that John Snow was basically the first

    person to effectively make use of geospatial data everything
  6. None
  7. Location Intelligence 7 Intelligence you acquire from spatial thinking

  8. When you realize that spatial data doesn’t get the attention

    it deserves
  9. WHAT IS GEOSPATIAL DATA ?

  10. Geospatial data is any data with a geographic component that

    can be layered onto a map 10
  11. Types of these geographic components ?

  12. 12 Vector Points / Geometries /Shapes eg: Shapefiles, GEOJSON Raster

    Pixels with or without spatial metadata eg: GEOTIFF, TIFF
  13. Raster Data

  14. None
  15. We can get our Raster’s degree now

  16. We can get our Raster’s degree now - Monitoring and

    predicting natural phenomena like Hurricanes, Forest fires etc - Do tons of cool analysis over time like calculating the Affluence of the area, Extent of vegetation, Types of buildings, Road network, Population, Nightlights.
  17. Well Known text Well known binary

  18. Spatial Reference System Geographic coordinate systems Projected coordinate systems

  19. SHP KML Carto KMZ Geojson GML KML Geotiff CSV GPX

    ESRI GeoRSS GSC SHP Sentinel 2
  20. Read/ Write/ Analyze

  21. None
  22. GDAL / OGR Geospatial Data Abstraction Library YEAR 1998 154

    raster and 93 vector geospatial data formats
  23. ogr2ogr can convert data in PostGIS to KML ogrinfo lists

    information about the data
  24. None
  25. Vector Data OGR's neat and nimble API for Python programmers

    Geographic data to pandas objects Geometry Engine – Open Source
  26. OSR Projections / Rtree Pythonic cartographic projections and coordinate transformations

    library Advanced spatial indexing features Fiona ,Shapely, Geopandas
  27. Indexing Geospatial Data Suppose you want to find all the

    geospatial points in a given radius Are you gonna iterate ? HELL NAHHH Use Spatial indices provided by the spatial extensions of traditional databases like postgres ( Postgis uses Rtrees )
  28. None
  29. None
  30. None
  31. None
  32. None
  33. None
  34. Hexagonal grid indexing (Uber H3)

  35. Raster Data Rasterio reads and writes raster formats and provides

    a Python API based on N-D arrays.
  36. There are also packages than combine these existing packages that

    are actually wrappers on already existing packages
  37. Vector data Raster data

  38. OSMNX (0SM + Networkx) Work with road network data from

    osm using networkx Analyze and visualize street networks, routing , travel times etc
  39. Visualize

  40. When you plot and visualize all your spatial layers on

    a basemap
  41. None
  42. You need to know javascript to create such cool maps

  43. Just Plot em Matplotlib (for everything) Leaflet / Openlayers /

    Mapbox Plotly + Mapbox / Mapboxgl
  44. Geometry + Matplotlib = Descartes Enables plotting of shapely geometries

    as matplotlib paths/ patches.
  45. None
  46. None
  47. Me after running import tensorflow as tf

  48. PySAL: Python Spatial Analysis Library Spatially constrained Clustering Spatio-temporal data

    analysis Spatial regression and Statistical modeling
  49. It’s Code Time https://github.com/Sangarshanan/talks/blob/master/spatial-thinking- with-python/spatial_thinking.ipynb

  50. https://github.com/Sangarshanan/talks/tree/master/spatial-thinking-with-python

  51. What’s the POINT(12.22,73.32) ?

  52. Marketing

  53. GEO - Marketing

  54. None
  55. PennyWISE Decision Making

  56. GEO - Surge

  57. That was UnUbercool

  58. None
  59. Blogs I stole from - https://blog.mapbox.com/a-dive-into-spatial-search-algorithms-ebd0c5e39d2a - https://github.com/pcjericks/py-gdalogr-cookbook - https://medium.com/locale-ai

    - https://geoffboeing.com/ - https://towardsdatascience.com/geospatial-indexing-with-ubers-h3-766399b690c - https://medium.com/@chrieke/essential-geospatial-python-libraries-5d82fcc38731 - https://pysal.readthedocs.io/en/latest/
  60. Hey You…. Yes you :) You’re Breathtaking