CTOs Perspective on Adding Geospatial and Location-based Information

2,948 views

Published on

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

Published in: Education
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
2,948
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
4
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide
  • 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…
  • create or replaceFUNCTION GET_KML (in_geometrysdo_geometry)RETURN CLOB AS  v_output          clob := '';   cursor get_ordinates_cur(in_geometrysdo_geometry) is  SELECT t.xlat, t.ylng  FROM   TABLE(SDO_UTIL.GETVERTICES(in_geometry)) t;BEGIN  v_output := '<?xml version="1.0" encoding="UTF-8"?><kmlxmlns="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>      </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;
  • CTOs Perspective on Adding Geospatial and Location-based Information

    1. 1. Bradley D. Brown, brad@intelivideo.comInteliVideo, CTO
    2. 2. AgendaWho am I?Geospatial 101How have I Used GeoSpatial Data?Options Available – Mapping SolutionsThings I’ve Developed with MapsHow to Get StartedTechnical DetailsSpatial Queries
    3. 3. Who am I?Bradley D. Brown TodayFounder • 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 tailProfessor – DU and corporate deals and DVDAuthor – 6 technical books duplication guysMentor in Founders Institute brad@intelivideo.com or http://bradleydbrown.blogspot.com
    4. 4. Geospatial 101• Mapping Solutions• Your data vs. mapping data• Lat / Long vs. Polygon• Uses and Advantages• Address Normalization
    5. 5. Geospatial 101Mapping Solutions – SaaS SolutionsGoogle Maps• http://maps.google.com/• MapsGLBing Maps• http://www.bing.com/maps/Google Earth• KML File
    6. 6. Geospatial 101Mapping Solutions – Spatial, Premise and SaaSOracle Spatial vs. LocatorNavtec, ESRI, etc. data in your own DBOracle ApEx Has Built-in MappingOther Hosted Solutions• Open Street Integraph• Virtual Earth Natural Earth• ESRI Maps for Free
    7. 7. Geospatial 101Your data vs. mapping dataYour Data• Customers• Properties / Homes• InventoryMapping Data• Maps – Google, etc.• Shape Files• In / Nearest
    8. 8. Geospatial 101Lat / Long vs. PolygonLat / Long• Point on the mapPolygon/Shape• Group of points• Shape File • Shapes • MetadataCan measure “in” forpolygons or “nearest” forpoints
    9. 9. Geospatial 101Uses and AdvantagesWhy 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. 10. Geospatial 101Address Normalization and Geocoding an AddressAddress Normalization• Zip+4 • http://www.semaphorecorp.com/cgi/zp4.html• CorrectAddress • http://www1.intelligentsearch.com/address-verification/correct- address.htm• Google APIGeocoding an Address• Google Geocoding API • https://developers.google.com/maps/documentation/geocoding/• Web Service APIs
    11. 11. Hopefully something will spark ideas for you!
    12. 12. How Have I Used Geospatial DataIntelliReal• Considerable geo data, knowledge, etc.TUSC• Embedded into several apps at TUSC (ACT)Independent Nation• Political mapping solutionInteliVideo• Where are people connecting from?
    13. 13. Heat MapsA look at different neighborhood trends in home values
    14. 14. GeoSearchVisual Slice and Dice – home type, bedrooms, bathrooms, price
    15. 15. Highlight and Visual SearchFind all homes that sold in this area for 20% less than their “value”
    16. 16. Test Scores within a radiusACT scoresBy Zip CodeGoogle API supports– Heat Maps • Outlines • Polygons– Circles– Overlays– Events
    17. 17. With Google Maps or Yahoo or…
    18. 18. Mapping Your DataDo you have data in your Oracle database thatyou would like to visually map?All you really need is a lat and long (or anaddress)Easy integration Starts At:• https://developers.google.com/maps/Simple Pushpins:
    19. 19. Hello World PageStatic HTML pageCopied HTML fromGoogle page andpasted here
    20. 20. Dynamic GenerationData driven mappingProperties inArapahoe County, COPL/SQL region withonload function
    21. 21. True AJAX MappingMapping that pullsdata dynamicallyfrom an XML pageLat / Long arepassed to XML page
    22. 22. Change the IconsAny image
    23. 23. Add a Popup Windows on ClickAny informationcan popup
    24. 24. Yahoo Pipeshttp://pipes.yahoo.com
    25. 25. Yahoo API -YQLFree 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. 26. Neighborhood Comp BoundariesCreate boundaries for a property• Using roads, water features (lakes, rivers), landmarks (parks), military bases and rail roadsCreated 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
    27. 27. Boundary Example 1Major streetsLakesParksMajor featuresSquare vs. Polygon
    28. 28. Boundary Example 2Powerful Boundaries
    29. 29. Tons of Free Data!Tiger• http://www.census.gov/geo/www/tiger/shp.html• US Government Project – US CensusUK Census Data• www.census.ac.uk/caswebOpen Street Maps• http://www.openstreetmap.org/• Open Source Collection Group• It’s free! Maps are more detailed than Google too!
    30. 30. Getting OpenStreetMap Data“Shape Files”OpenStreetMap by State• http://osmdata.thinkgeo.com/openstreetmap-data/north-america/us/
    31. 31. Map FeaturesTiger• http://www.census.gov/geo/www/tiger/tgrshp2012/documentation.html• www.census.ac.uk/casweb - UK census dataOpenStreetMaps• http://wiki.openstreetmap.org/wiki/Map_FeaturesFeatures• Addresses, Landmarks (Point and Area), Water (Area and Linear), MSAs, Railways, Military Installations, Tab Blocks (Block Groups, Blocks), Census Tracts, County, StateShape Files• Points and Polygons• Data (e.g. Road Name, Type)
    32. 32. Point to Point ComparisonNearest “In” or “At”Area Water (lake) StateLinear Water (river) County MSAArea Landmark (park) CityArea Point (hospital) Census TractSchools Block GroupMilitary Installation BlockRailroad Latitude, Longitude Address Range
    33. 33. Loading Data Visually using OracleMapBuilderDownload athttp://www.oracle.com/technetwork/middleware/mapviewer/downloads/index.html java –jar MapBuilder.jarImport Shapefile
    34. 34. Loading Shape Files in BatchLoad Shape to Spatial Data Option (SDO)http://download.oracle.com/otn/other/spatial/shp2sdo.zipCreates file structureIf you have multiple files – run the creation only once and create thespatial 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
    35. 35. Water’s Distance from a PropertySELECT 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;
    36. 36. Nearest x Objects (Address Ranges) toPropertySELECT 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;
    37. 37. Nearest 5 Landmarks within 10 MilesSELECT *FROM TL_2011_08031_AREALMWHERE 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;
    38. 38. What Block is this Property In?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;
    39. 39. Nearest 5 Schools, Churches andShopping CentersSELECT 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;
    40. 40. Nearest Hospitals in the Countyselect 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;
    41. 41. 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 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
    42. 42. 5 Nearest RailwaysSELECT 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;
    43. 43. Extracting KML for Google Earthcreate 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>
    44. 44. 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!
    45. 45. Questions?
    46. 46. Copyright InformationNeither InteliVideo nor the author guarantee thisdocument to be error-free. Please providecomments/questions to brad@intelivideo.com.InteliVideo © 2013. This document cannot bereproduced without expressed written consentfrom an officer of InteliVideo.

    ×