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

GCP GIS Quickstart

GCP GIS Quickstart

Sergei Kozyrenko
CTO, Parknav

More Decks by Texas Natural Resources Information System

Other Decks in Technology

Transcript

  1. Cloud SQL • Postgres 9.6, PostGIS 2.3 • Enable PostGIS:

    create extension postgis; • https://cloud.google.com/sql/docs/postgres/extensions
  2. Demo: app that queries and shows RideAustin data on the

    map https://github.com/kozyr/gis-java-sql
  3. PostGIS - Geometry columns Add geometry columns for faster queries

    SELECT AddGeometryColumn ('public','ride','end_geom',3857,'POINT',2); update ride set end_geom=ST_Transform(ST_SetSRID(ST_Point(end_location_long,end_location_lat),4326),3857); CREATE INDEX idx_ride_end_geom ON ride USING gist(end_geom);
  4. Java and GIS Lots of libraries: • hibernate-spatial (part of

    hibernate core as of hibernate 5) • JTS • GeoTools
  5. Java Topology Suite (JTS) https://github.com/locationtech/jts • Classes for representing geometries

    on a plane - Points, Polygons, LineStrings, etc. • Area and distance calculation, buffer computation, geometric simplification, spatial index with quadtree and STR-tree, convex hull, spatial graphs, WKT/WKB/GML support and many more features • GEOS, a port of JTS into C/C++, is widely used and is present in QGIS, PostGIS, R, GeoDjango etc.
  6. hibernate-spatial Works with JPA, Spring Data and JTS to make

    storing/retrieving geometry columns easy
  7. GeoTools http://geotools.org/ Builds on JTS, adds support for converting between

    different coordinate systems - see TransformHelper in the demo app
  8. Cloud SQL and k8s CronJobs Cloud SQL Proxy does not

    terminate by itself when cron job is done Solution: kill the proxy manually - name: cloudsql-proxy image: gcr.io/cloudsql-docker/gce-proxy:1.11 command: ["sh", "-c"] args: - /cloud_sql_proxy -instances=... -credential_file=... & pid=$! && (sleep 30 && kill -9 $pid 2>/dev/null)
  9. Redis: Demo MSET 592590 json1 592617 json2 GEOADD ride 30.272

    -97.726 592590 GEOADD ride 30.291 -97.741 592617 keys = GEORADIUS ride 15 30.272 -97.726 m WITHDIST MGET key1 key2