2. Agenda
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
3. Who am I?
Bradley D. Brown Today
Founder • Technical CTO (write code)
• TUSC in 1988 • Reglara and Enscicon Boards
• Questor 1992 • Rolta, Board Advisor
• GUI Shootout 1994 • Equifax employee
• Sold to Rolta in 2008 • InteliVideo in April 2012
• IntelliReal in 2005
• Video Monetization Platform
• Sold to Equifax in 2011
• Built it to sell training online
• 10+ other companies, boards
• Focused on mid and long tail
Professor – DU and corporate deals and DVD
Author – 6 technical books duplication guys
Mentor in Founders Institute
brad@intelivideo.com or http://bradleydbrown.blogspot.com
4. Geospatial 101
• Mapping Solutions
• Your data vs. mapping data
• Lat / Long vs. Polygon
• Uses and Advantages
• Address Normalization
6. Geospatial 101
Mapping Solutions – Spatial, Premise and SaaS
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
7. Geospatial 101
Your data vs. mapping data
Your Data
• Customers
• Properties / Homes
• Inventory
Mapping Data
• Maps – Google, etc.
• Shape Files
• In / Nearest
8. Geospatial 101
Lat / Long vs. Polygon
Lat / Long
• Point on the map
Polygon/Shape
• Group of points
• Shape File
• Shapes
• Metadata
Can measure “in” for
polygons or “nearest” for
points
9. Geospatial 101
Uses and Advantages
Why Use? Using it to your
• Glitzy / Sexy / Looks good advantage
• Intelligence about your • Directions, Other
customers, your data, “Similar”
etc. items, Connecting things
• Nearby Gas
Stations, Railroad
tracks, Boundaries
10. Geospatial 101
Address Normalization and Geocoding an Address
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
12. How Have I 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?
13. Heat Maps
A look at different neighborhood trends in home values
18. Mapping Your Data
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:
25. Yahoo API -YQL
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'
26.
27. Neighborhood Comp Boundaries
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
30. Tons of Free Data!
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!
32. Map Features
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)
33. Point to Point Comparison
Nearest “In” or “At”
Area Water (lake) State
Linear Water (river) County
MSA
Area Landmark (park)
City
Area Point (hospital)
Census Tract
Schools
Block Group
Military Installation
Block
Railroad Latitude, Longitude
Address Range
34. Loading Data Visually using Oracle
MapBuilder
Download at
http://www.oracle.com/technetwork/middleware/mapviewer/downloads/index.htm
l java –jar MapBuilder.jar
Import Shapefile
35. Loading Shape Files in Batch
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 DataADDRFEAT 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
36.
37. 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,
SDO_GEOM.SDO_AREA(geometry, 0.005, 'unit=acre') area,
SDO_GEOM.SDO_CENTROID(geometry, 0.005) centroid,
t.*
FROM TL_2011_08031_AREAWATER t
order by 1;
38. Nearest x Objects (Address Ranges) to
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 t
WHERE 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';
39. Nearest 5 Landmarks within 10 Miles
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';
40. What Block is this Property In?
SELECT *
FROM TL_2011_08_TABBLOCK
WHERE SDO_WITHIN_DISTANCE(Geometry,
SDO_GEOMETRY(2001, 4269,
SDO_POINT_TYPE (-104.958587,39.71464,NULL), NULL, NULL),
'distance=0 unit=mile') = 'TRUE';
41. 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 t
WHERE 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';
42. 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_POINTLM t
where mtfcc = 'K1231';
43. 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_08031_LINEARWATER t
WHERE 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'
44. 5 Nearest Railways
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 t
WHERE 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';
45. Extracting KML for Google Earth
create or replace </PolyStyle>
FUNCTION GET_KML (in_geometry sdo_geometry) </Style>
RETURN CLOB AS <Placemark>
<name>Entire</name>
v_output clob := ''; <styleUrl>#transGreenPoly</styleUrl>
<Polygon>
cursor get_ordinates_cur(in_geometry sdo_geometry) is <extrude>1</extrude>
SELECT t.x lat, t.y lng <altitudeMode>relativeToGround</altitudeMode>
FROM TABLE(SDO_UTIL.GETVERTICES(in_geometry)) t; <outerBoundaryIs>
<LinearRing>
BEGIN <coordinates>';
v_output := ' for get_ordinates_rec in get_ordinates_cur(in_geometry)
<?xml version="1.0" encoding="UTF-8"?> loop
<kml xmlns="http://www.opengis.net/kml/2.2"> dbms_lob.append(v_output,get_ordinates_rec.lat || ',' ||
<Document> get_ordinates_rec.lng || ',17' || chr(13) || chr(10));
<Style id="transBluePoly"> end loop;
<LineStyle>
<width>1.5</width> v_output := v_output || '</coordinates>
</LineStyle> </LinearRing>
<PolyStyle> </outerBoundaryIs>
<color>7dff0000</color> </Polygon>
</PolyStyle> </Placemark>
</Style> </Document>
<Style id="transGreenPoly"> </kml>';
<LineStyle>
<width>1.5</width> RETURN v_output;
</LineStyle>
<PolyStyle> END GET_KML;
<color>7f00ff00</color>
46. What Did We Cover?
• 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!
I’d also encourage you to check out Yahoo Pipes. Pipes allows you to prompt for information, use YQL, draw it in a map, overlay data and more. The maps you see here are 2 maps I created that show current traffic on a map. The map on the bottom of the page shows the culinary events that are in town. Again, I plan on merging this information with my “current” location and sending daily emails of maps and other items of interest. So let’s take a look at how you can do this with ApEx…