ctos perspective on adding geospatial and location-based information

48
Bradley D. Brown, [email protected] InteliVideo, CTO CTO's Perspective on Adding Geo-spatial and Location-Based Information to Your Data

Upload: bradley-brown

Post on 11-Nov-2014

1.962 views

Category:

Education


0 download

DESCRIPTION

Well received presentation about how to move to a geospatial world.

TRANSCRIPT

Page 1: CTOs Perspective on Adding Geospatial and Location-based Information

Bradley D. Brown, [email protected]

InteliVideo, CTO

CTO's Perspective on Adding Geo-spatial and Location-Based Information to Your Data

Page 2: CTOs Perspective on Adding Geospatial and Location-based Information

Who am I?

Geospatial 101

How have I Used GeoSpatial Data?

Options Available – Mapping Solutions

Things I’ve Developed with Maps

How to Get Started

Technical Details

Spatial Queries

Agenda

Page 3: CTOs Perspective on Adding Geospatial and Location-based Information

Today• Technical CTO (write code)• Reglara and Enscicon

Boards• Rolta, Board Advisor• Equifax employee• InteliVideo in April 2012• Video Monetization

Platform• Built it to sell training

online• Focused on mid and long

tail and corporate deals and DVD duplication guys

Bradley D. Brown

Founder

• TUSC in 1988

• Questor 1992

• GUI Shootout 1994

• Sold to Rolta in 2008

• IntelliReal in 2005

• Sold to Equifax in 2011

• 10+ other companies, boards

Professor – DU

Author – 6 technical books

Mentor in Founders Institute

Who am I?

[email protected] or http://bradleydbrown.blogspot.com

Page 4: CTOs Perspective on Adding Geospatial and Location-based Information

• Mapping Solutions

• Your data vs. mapping data

• Lat / Long vs. Polygon

• Uses and Advantages

• Address Normalization

Geospatial 101

Page 5: CTOs Perspective on Adding Geospatial and Location-based Information

Google Maps• http://maps.google.com/• MapsGL

Bing Maps• http://www.bing.com/maps/

Google Earth• KML File

Geospatial 101Mapping Solutions – SaaS Solutions

Page 6: CTOs Perspective on Adding Geospatial and Location-based Information

Oracle Spatial vs. Locator

Navtec, ESRI, etc. data in your own DB

Oracle ApEx Has Built-in Mapping

Other Hosted Solutions•Open Street Integraph• Virtual Earth Natural Earth• ESRI Maps for Free

Geospatial 101Mapping Solutions – Spatial, Premise and SaaS

Page 7: CTOs Perspective on Adding Geospatial and Location-based Information

Your Data•Customers•Properties / Homes• Inventory

Mapping Data•Maps – Google, etc.•Shape Files• In / Nearest

Geospatial 101Your data vs. mapping data

Page 8: CTOs Perspective on Adding Geospatial and Location-based Information

Lat / Long• Point on the map

Polygon/Shape•Group of points• Shape File• Shapes•Metadata

Can measure “in” for polygons or “nearest” for points

Geospatial 101Lat / Long vs. Polygon

Page 9: CTOs Perspective on Adding Geospatial and Location-based Information

Using it to your advantage•Directions, Other “Similar” items, Connecting things•Nearby Gas Stations, Railroad tracks, Boundaries

Why Use? •Glitzy / Sexy / Looks good• Intelligence about your customers, your data, etc.

Geospatial 101Uses and Advantages

Page 10: CTOs Perspective on Adding Geospatial and Location-based Information

Address Normalization•Zip+4• http://www.semaphorecorp.com/cgi/zp4.html

•CorrectAddress• http://

www1.intelligentsearch.com/address-verification/correct-address.htm

•Google API

Geocoding an Address•Google Geocoding API• https://developers.google.com/maps/documentation/geocoding/

•Web Service APIs

Geospatial 101Address Normalization and Geocoding an Address

Page 11: CTOs Perspective on Adding Geospatial and Location-based Information

Hopefully something will spark ideas for you!

Things I’ve Developed with Maps and How I’ve used Geospatial Data

Page 12: CTOs Perspective on Adding Geospatial and Location-based Information

IntelliReal•Considerable geo data, knowledge, etc.

TUSC•Embedded into several apps at TUSC (ACT)

Independent Nation•Political mapping solution

InteliVideo•Where are people connecting from?

How Have I Used Geospatial Data

Page 13: CTOs Perspective on Adding Geospatial and Location-based Information

A look at different neighborhood trends in home values

Heat Maps

Page 14: CTOs Perspective on Adding Geospatial and Location-based Information

Visual Slice and Dice – home type, bedrooms, bathrooms, price

GeoSearch

Page 15: CTOs Perspective on Adding Geospatial and Location-based Information

Find all homes that sold in this area for 20% less than their “value”

Highlight and Visual Search

Page 16: CTOs Perspective on Adding Geospatial and Location-based Information

ACT scores

By Zip Code

Google API supports–Heat Maps• Outlines• Polygons–Circles–Overlays–Events

Test Scores within a radius

Page 17: CTOs Perspective on Adding Geospatial and Location-based Information

With Google Maps or Yahoo or…

How To Get Started

Page 18: CTOs Perspective on Adding Geospatial and Location-based Information

Do you have data in your Oracle database that you would like to visually map?

All you really need is a lat and long (or an address)

Easy integration Starts At:

•https://developers.google.com/maps/

Simple Pushpins:

Mapping Your Data

Page 19: CTOs Perspective on Adding Geospatial and Location-based Information

Static HTML page

Copied HTML from Google page and pasted here

Hello World Page

Page 20: CTOs Perspective on Adding Geospatial and Location-based Information

Data driven mapping

Properties in Arapahoe County, CO

PL/SQL region with onload function

Dynamic Generation

Page 21: CTOs Perspective on Adding Geospatial and Location-based Information

Mapping that pulls data dynamically from an XML page

Lat / Long are passed to XML page

True AJAX Mapping

Page 22: CTOs Perspective on Adding Geospatial and Location-based Information

Any image

Change the Icons

Page 23: CTOs Perspective on Adding Geospatial and Location-based Information

Any information can popup

Add a Popup Windows on Click

Page 25: CTOs Perspective on Adding Geospatial and Location-based Information

Free Data and APIs from Yahoo• http://developer.yahoo.com/yql/console/

Local Events• select * from upcoming.events where woeid in (select woeid from

geo.places where text="North Beach")

Local Places• select * from local.search where zip='94085' and query='pizza'

Yahoo API - YQL

Page 26: CTOs Perspective on Adding Geospatial and Location-based Information

Technical Details

Page 27: CTOs Perspective on Adding Geospatial and Location-based Information

Create boundaries for a property• Using roads, water features (lakes, rivers), landmarks

(parks), military bases and rail roads

Created a function to return this info• Input is lat/long, but we can change to prop id once we

have parcels loaded up• Other inputs – big roads (Y/N), distance (miles from

property – 1), min distance (0), min length (.1 miles), band (1=1st, 2=2nd, etc.)

Get_Kml is in the notes…• Will produce a KML file for Google Earth viewing

Neighborhood Comp Boundaries

Page 28: CTOs Perspective on Adding Geospatial and Location-based Information

Major streets

Lakes

Parks

Major features

Square vs. Polygon

Boundary Example 1

Page 29: CTOs Perspective on Adding Geospatial and Location-based Information

Powerful Boundaries

Boundary Example 2

Page 30: CTOs Perspective on Adding Geospatial and Location-based Information

Tiger• http://www.census.gov/geo/www/tiger/shp.html•US Government Project – US Census

UK Census Data•www.census.ac.uk/casweb

Open Street Maps• http://www.openstreetmap.org/•Open Source Collection Group• It’s free! Maps are more detailed than Google too!

Tons of Free Data!

Page 31: CTOs Perspective on Adding Geospatial and Location-based Information

OpenStreetMap by State• http://osmdata.thinkgeo.com/openstreetmap-data/north-

america/us/

Getting OpenStreetMap Data“Shape Files”

Page 32: CTOs Perspective on Adding Geospatial and Location-based Information

Tiger• http://

www.census.gov/geo/www/tiger/tgrshp2012/documentation.html

• www.census.ac.uk/casweb - UK census data

OpenStreetMaps• http://wiki.openstreetmap.org/wiki/Map_Features

Features• Addresses, Landmarks (Point and Area), Water (Area

and Linear), MSAs, Railways, Military Installations, Tab Blocks (Block Groups, Blocks), Census Tracts, County, State

Shape Files• Points and Polygons• Data (e.g. Road Name, Type)

Map Features

Page 33: CTOs Perspective on Adding Geospatial and Location-based Information

Nearest “In” or “At”State

County

MSA

City

Census Tract

Block Group

Block

Latitude, Longitude

Address Range

Area Water (lake)

Linear Water (river)

Area Landmark (park)

Area Point (hospital)

Schools

Military Installation

Railroad

Point to Point Comparison

Page 35: CTOs Perspective on Adding Geospatial and Location-based Information

Load Shape to Spatial Data Option (SDO)

http://download.oracle.com/otn/other/spatial/shp2sdo.zip

Creates file structure

If you have multiple files – run the creation only once and create the spatial index, load the data…• shp2sdo.exe Tiger Data\ADDRFEAT\ tl_2011_01001_addrfeat

tl_2011_addrfeat -g geometry –f -x (-180,180) -y (-90,90) -s 8307 -t 0.000005 –v

• sqlplus username/password @ tl_2011_addrfeat.sql

• CREATE INDEX index_name ON table (geometry) INDEXTYPE IS MDSYS.SPATIAL_INDEX

• sqlldr username/password tl_2011_addrfeat

Loading Shape Files in Batch

Page 36: CTOs Perspective on Adding Geospatial and Location-based Information

Spatial Queries

Page 37: CTOs Perspective on Adding Geospatial and Location-based Information

SELECT SDO_GEOM.SDO_DISTANCE(Geometry, sdo_cs.transform(SDO_GEOMETRY(2001, 4269, SDO_POINT_TYPE (-104.958587,39.71464,NULL), NULL, NULL),8307),.01,'unit=mile') distance, SDO_GEOM.SDO_AREA(geometry, 0.005, 'unit=acre') area, SDO_GEOM.SDO_CENTROID(geometry, 0.005) centroid, t.*FROM TL_2011_08031_AREAWATER torder by 1;

Water’s Distance from a Property

Page 38: CTOs Perspective on Adding Geospatial and Location-based Information

SELECT SDO_GEOM.SDO_DISTANCE(Geometry, sdo_cs.transform(SDO_GEOMETRY(2001, 4269, SDO_POINT_TYPE (-104.958587,39.71464,NULL), NULL, NULL),8307),.01,'unit=mile') distance, t.*FROM TL_2011_08031_ADDRFEAT tWHERE SDO_NN(geometry, SDO_GEOMETRY(2001, 4269, SDO_POINT_TYPE (-104.958587,39.71464,NULL), NULL, NULL), 'sdo_num_res=1 distance=1 unit=mile') = 'TRUE';

Nearest x Objects (Address Ranges) to Property

Page 39: CTOs Perspective on Adding Geospatial and Location-based Information

SELECT *FROM TL_2011_08031_AREALM WHERE SDO_NN(geometry, SDO_GEOMETRY(2001, 4269, SDO_POINT_TYPE (-104.958587,39.71464,NULL), NULL, NULL), 'sdo_num_res=5 distance=10 unit=mile') = 'TRUE';

Nearest 5 Landmarks within 10 Miles

Page 40: CTOs Perspective on Adding Geospatial and Location-based Information

SELECT *FROM TL_2011_08_TABBLOCKWHERE SDO_WITHIN_DISTANCE(Geometry, SDO_GEOMETRY(2001, 4269, SDO_POINT_TYPE (-104.958587,39.71464,NULL), NULL, NULL), 'distance=0 unit=mile') = 'TRUE';

What Block is this Property In?

Page 41: CTOs Perspective on Adding Geospatial and Location-based Information

SELECT SDO_GEOM.SDO_DISTANCE(Geometry, sdo_cs.transform(SDO_GEOMETRY(2001, 4269, SDO_POINT_TYPE (-104.958587,39.71464,NULL), NULL, NULL),8307),.01,'unit=mile') distance, t.*FROM TL_2011_08031_POINTLM tWHERE SDO_NN(geometry, SDO_GEOMETRY(2001, 4269, SDO_POINT_TYPE (-104.958587,39.71464,NULL), NULL, NULL), 'sdo_num_res=5 distance=5 unit=mile') = 'TRUE';

Nearest 5 Schools, Churches and Shopping Centers

Page 42: CTOs Perspective on Adding Geospatial and Location-based Information

select SDO_GEOM.SDO_DISTANCE(Geometry, sdo_cs.transform(SDO_GEOMETRY(2001, 4269, SDO_POINT_TYPE (-104.958587,39.71464,NULL), NULL, NULL),8307),.01,'unit=mile') distance, t.*FROM TL_2011_08031_POINTLM twhere mtfcc = 'K1231';

Nearest Hospitals in the County

Page 43: CTOs Perspective on Adding Geospatial and Location-based Information

SELECT SDO_GEOM.SDO_DISTANCE(Geometry, sdo_cs.transform(SDO_GEOMETRY(2001, 4269, SDO_POINT_TYPE (-104.958587,39.71464,NULL), NULL, NULL),8307),.01,'unit=mile') distance, t.*FROM TL_2011_08031_LINEARWATER tWHERE SDO_NN(geometry, SDO_GEOMETRY(2001, 4269, SDO_POINT_TYPE (-104.958587,39.71464,NULL), NULL, NULL), 'sdo_num_res=5 distance=5 unit=mile') = 'TRUE'

Nearest River, Creek, etc (Linear Water)

Page 44: CTOs Perspective on Adding Geospatial and Location-based Information

SELECT SDO_GEOM.SDO_DISTANCE(Geometry, sdo_cs.transform(SDO_GEOMETRY(2001, 4269, SDO_POINT_TYPE (-104.958587,39.71464,NULL), NULL, NULL),8307),.01,'unit=mile') distance, t.*FROM TL_2011_US_RAILS tWHERE SDO_NN(geometry, SDO_GEOMETRY(2001, 4269, SDO_POINT_TYPE (-104.958587,39.71464,NULL), NULL, NULL), 'sdo_num_res=5 distance=5 unit=mile') = 'TRUE';

5 Nearest Railways

Page 45: CTOs Perspective on Adding Geospatial and Location-based Information

      </PolyStyle>    </Style>    <Placemark>      <name>Entire</name>      <styleUrl>#transGreenPoly</styleUrl>      <Polygon>        <extrude>1</extrude>        <altitudeMode>relativeToGround</altitudeMode>        <outerBoundaryIs>          <LinearRing>            <coordinates>';

  for get_ordinates_rec in get_ordinates_cur(in_geometry) loop      dbms_lob.append(v_output,get_ordinates_rec.lat || ',' || get_ordinates_rec.lng || ',17' || chr(13) || chr(10));  end loop;

  v_output := v_output || '</coordinates>          </LinearRing>        </outerBoundaryIs>      </Polygon>    </Placemark>  </Document></kml>';

  RETURN v_output;

END GET_KML;

create or replaceFUNCTION GET_KML (in_geometry sdo_geometry)RETURN CLOB AS

  v_output          clob := ''; 

  cursor get_ordinates_cur(in_geometry sdo_geometry) is  SELECT t.x lat, t.y lng  FROM   TABLE(SDO_UTIL.GETVERTICES(in_geometry)) t;

BEGIN

  v_output := '<?xml version="1.0" encoding="UTF-8"?><kml xmlns="http://www.opengis.net/kml/2.2">  <Document>    <Style id="transBluePoly">      <LineStyle>        <width>1.5</width>      </LineStyle>      <PolyStyle>        <color>7dff0000</color>      </PolyStyle>    </Style>    <Style id="transGreenPoly">      <LineStyle>        <width>1.5</width>      </LineStyle>      <PolyStyle>        <color>7f00ff00</color>

Extracting KML for Google Earth

Page 46: CTOs Perspective on Adding Geospatial and Location-based Information

• Geospatial 101

• Ideas on How you Might Use GeoSpatial Data

• Mapping Solutions

• How to Get Started

• Technical Details

• Spatial Queries

• Now it’s your turn!

What Did We Cover?

Page 47: CTOs Perspective on Adding Geospatial and Location-based Information

Questions?

Page 48: CTOs Perspective on Adding Geospatial and Location-based Information

Neither InteliVideo nor the author guarantee this document to be error-free. Please provide comments/questions to [email protected].

InteliVideo © 2013. This document cannot be reproduced without expressed written consent from an officer of InteliVideo.

Copyright Information