ctos perspective on adding geospatial and location-based information
DESCRIPTION
Well received presentation about how to move to a geospatial world.TRANSCRIPT
Bradley D. Brown, [email protected]
InteliVideo, CTO
CTO's Perspective on Adding Geo-spatial and Location-Based Information to Your Data
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
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
• Mapping Solutions
• Your data vs. mapping data
• Lat / Long vs. Polygon
• Uses and Advantages
• Address Normalization
Geospatial 101
Google Maps• http://maps.google.com/• MapsGL
Bing Maps• http://www.bing.com/maps/
Google Earth• KML File
Geospatial 101Mapping Solutions – SaaS Solutions
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
Your Data•Customers•Properties / Homes• Inventory
Mapping Data•Maps – Google, etc.•Shape Files• In / Nearest
Geospatial 101Your data vs. mapping data
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
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
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
Hopefully something will spark ideas for you!
Things I’ve Developed with Maps and How I’ve used Geospatial Data
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
A look at different neighborhood trends in home values
Heat Maps
Visual Slice and Dice – home type, bedrooms, bathrooms, price
GeoSearch
Find all homes that sold in this area for 20% less than their “value”
Highlight and Visual Search
ACT scores
By Zip Code
Google API supports–Heat Maps• Outlines• Polygons–Circles–Overlays–Events
Test Scores within a radius
With Google Maps or Yahoo or…
How To Get Started
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
Static HTML page
Copied HTML from Google page and pasted here
Hello World Page
Data driven mapping
Properties in Arapahoe County, CO
PL/SQL region with onload function
Dynamic Generation
Mapping that pulls data dynamically from an XML page
Lat / Long are passed to XML page
True AJAX Mapping
Any image
Change the Icons
Any information can popup
Add a Popup Windows on Click
Yahoo Pipeshttp://pipes.yahoo.com
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
Technical Details
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
Major streets
Lakes
Parks
Major features
Square vs. Polygon
Boundary Example 1
Powerful Boundaries
Boundary Example 2
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!
OpenStreetMap by State• http://osmdata.thinkgeo.com/openstreetmap-data/north-
america/us/
Getting OpenStreetMap Data“Shape Files”
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
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
Download at http://www.oracle.com/technetwork/middleware/mapviewer/downloads/index.htm
ljava –jar MapBuilder.jar
Import Shapefile
Loading Data Visually using Oracle MapBuilder
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
Spatial Queries
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
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
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
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?
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
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
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)
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
</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
• 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?
Questions?
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