pins polygons and perspectives visualizing geographic
play

Pins Polygons and Perspectives Visualizing Geographic Data in APEX - PowerPoint PPT Presentation

Pins Polygons and Perspectives Visualizing Geographic Data in APEX Christoph Ruepprich Accenture Enkitec Group Pins Polygons & Perspectives 1 Who Am I? Dad & Husband Consultant @ Accenture an Enkitec Group DBA/Developer


  1. Pins Polygons and Perspectives 
 Visualizing Geographic Data in APEX Christoph Ruepprich Accenture Enkitec Group Pins Polygons & Perspectives 1

  2. Who Am I? ● Dad & Husband ● Consultant @ Accenture an Enkitec Group ● DBA/Developer cruepprich@enkitec.com ● Fitness ruepprich.wordpress.com ● Bass player cruepprich ● Board gamer @CRuepprich Pins Polygons & Perspectives 2

  3. About Accenture Enkitec Group ● Result of acquisition of Enkitec by Accenture in May 2014 ● Global systems integrator focused on the Oracle platform ● Headquartered in Dallas, Texas ● Consultants average 15+ years of Oracle experience ● ~20 Oracle ACE members on staff Pins Polygons & Perspectives 3

  4. What is covered? ● Geocoding ● Mapping APIs ● Interacting with database ● Pins and Polygons ● Third party data Pins Polygons & Perspectives 4 4

  5. What’s Covered ● Geolocation ● Map APIa ● Rendering Maps ● Third Party Data ● Relationships Pins Polygons & Perspectives 5

  6. First we need … Data! Turn addresses into geographic coordinates Pins Polygons & Perspectives 6

  7. Coordinates Pins Polygons & Perspectives 7

  8. Layers use Coordinates ● Pins ● Polygons ● Lines ● Routes ● etc. Pins Polygons & Perspectives 8

  9. Geocoding Webservices ● Find coordinates from and address Reverse Geocoding ● Find address from coordinates Pins Polygons & Perspectives 9

  10. Geocoding Webservices Pins Polygons & Perspectives 10

  11. Geocoding with ● Uses SQL! https://query.yahooapis.com/v1/public/yql?q=select * from https://query.yahooapis.com/v1/public/yql?q=select * from geo.placefinder where text="1400 6th Ave, Seattle, WA 98101" geo.placefinder where text="1400 6th Ave, Seattle, WA 98101" ● Output XML or JSON https://query.yahooapis.com/v1/public/yql? https://query.yahooapis.com/v1/public/yql? format=json &q=select * from geo.placefinder where text="1400 format=json &q=select * from geo.placefinder where text="1400 6th Ave, Seattle, WA 98101" 6th Ave, Seattle, WA 98101" https://developer.yahoo.com/yql/guide/usage_info_limits.html Pins Polygons & Perspectives 11

  12. Geocoding with Sample XML result Pins Polygons & Perspectives 12

  13. Geocoding with ● Other queries select * from local.search where zip='76051' and query='hair cut' select * from weather.forecast where woeid=2502265 Pins Polygons & Perspectives 13

  14. Geocoding with ● Use maps.googleapis.com http://maps.googleapis.com/maps/api/geocode/xml? http://maps.googleapis.com/maps/api/geocode/xml? json? sensor=false&address=1400 6th Ave, Seattle, WA 98101 sensor=false&address=1400 6th Ave, Seattle, WA 98101 Pins Polygons & Perspectives 14

  15. Geocoding with Sample result: Pins Polygons & Perspectives 15

  16. Reverse Geocoding with ● Use maps.googleapis.com http://maps.googleapis.com/maps/api/geocode/xml? http://maps.googleapis.com/maps/api/geocode/xml? json? latlng=40.714224,-73.961452 latlng=40.714224,-73.961452 Pins Polygons & Perspectives 16

  17. ReverseGeocoding with Pins Polygons & Perspectives 17

  18. Geocoding with ● Apex Plug-in ● Creates collection ● Results in report on collection ● Good with PL/SQL Pins Polygons & Perspectives 18

  19. Which geocoding service do I use? ● Many other services available ● Check cost and usage limits ● Check response times ● Bulk processing ● Verify results Pins Polygons & Perspectives 19

  20. Processing the Results Pins Polygons & Perspectives 20

  21. What to do with the results Basic Steps: ● Store XML/JSON result in clob ● Parse result and loop through arrays ● Store results in table or collection 
 and/or 
 Render on map Pins Polygons & Perspectives 21

  22. 
 What to do with the results ● XML - Use Oracle’s built in XML functions ● Good when processing results with PL/SQL 
 ● JSON - ● Good with JavaScript ● PLJSON package (sourceforge) 
 http://sourceforge.net/projects/pljson/ 
 My Blog: http://wp.me/pRyVI-k1 Pins Polygons & Perspectives 22

  23. We have coordinates. Pins Polygons & Perspectives 23

  24. Mapping with ● Optional Free API Key - Get usage stats ● Extensible ● Usage Limit: 25k map loads per day 
 (don’t quote me on that) ● Excellent Documentation ● API Reference ● Examples https://developers.google.com/maps/ Pins Polygons & Perspectives 24

  25. Mapping with ● You need ● Javascript Library ● API Key (optional) Pins Polygons & Perspectives 25

  26. Mapping with ● Requires Application Key (Free) ● Extensible ● Good Documentation / Examples https://developer.yahoo.com/maps/ajax/v2start.html https://developer.yahoo.com/maps/flash/jsGettingStarted.html Pins Polygons & Perspectives 26

  27. Mapping with ● You need ● Javascript Library ● API Key Pins Polygons & Perspectives 27

  28. Mapping with ● Sample Geolocation Showcase (Apex 4.2.5) ● Mapping through Plug-Ins ● See Carsten Czarski’s Presentation: 
 Location Data for Everyone - in APEX 4.2.5. What the Sample Geolocation Showcase can do for you. 
 ODTUG Webinars Pins Polygons & Perspectives 28

  29. Mapping with ● You Need ● Plug-Ins Pins Polygons & Perspectives 29

  30. Mapping with ● Free API ● Lightweight ● Good for Mobile ● Use other tile servers ● Extensible ● Concise coding http://leafletjs.com/ Pins Polygons & Perspectives 30

  31. Mapping with ● You need ● JS Library ● CSS Style Sheet Pins Polygons & Perspectives 31

  32. Tile Layers with http://leaflet-extras.github.io/leaflet-providers/preview/ Pins Polygons & Perspectives 32

  33. API Comparisons ● http://robinlovelace.net/software/2014/03/05/ webmap-test.html Pins Polygons & Perspectives 33

  34. How to display Javascript maps ● HTML Region with <div> <div id=“map” style=“min-height:500px;”> � ● Javascript ● Include libraries ● Renders map in div Pins Polygons & Perspectives 34

  35. How to display Oracle maps ● Map Region Plugin ● Marker Plugins Pins Polygons & Perspectives 35

  36. Demo Simple Map Pins Polygons & Perspectives 36

  37. Interacting with Map and Database Pins Polygons & Perspectives 37

  38. Interacting with the Database Pins Polygons & Perspectives 38

  39. Data Example Gas Stations ID Brand Latitude Longitude 1 Shell 32.34321 -97.398834 2 Valero 32.15534 -97.19984 3 Exxon 33.92234 -94.88223 Pins Polygons & Perspectives 39

  40. Convert to JSON { "stations":[ { "id":"1", "brand":"Shell", "lat":32.343214, Gas Stations "lng":-97.398834 }, ID Brand Latitude Longitude { "id":"2", "brand":"Valero", 1 Shell 32.34321 -97.398834 "lat":32.15534, "lng":-97.19984 }, 2 Valero 32.15534 -97.19984 { "id":"3", 3 Exxon 33.92234 -94.88223 "brand":"Exxon", "lat":33.92234, "lng":-94.88223 Page Item: } ] P110_JSON } Pins Polygons & Perspectives 40

  41. Convert to JSON with PL/SQL Loop • Page Process � • On Demand Process begin for c1 in (select NAME, LAT, LNG from gas_stations) loop - -Build JSON string … end loop; - - Store string in page item :P110_JSON := l_json; — - For On Demand Process use - - htp.p(l_json); end; Store large JSON objects in collection CLOB. Pins Polygons & Perspectives 41

  42. Loop Through JSON var json = JSON.parse($v('P110_JSON')); //json contains “stations” object var gs = json.stations; for (var i=0;i<gs.length;i++){ var latlng = new L.LatLng(gs[i].lat ,gs[i].lng); var marker = L.marker(latlng); marker.addTo(map); markersArr.push(marker); } Pins Polygons & Perspectives 42

  43. Keep Track of Markers/Polygons markersArr[0].lat = 123 markersArr[0].lng = 456 markersArr[1].lat = 123 markersArr[1].lng = 456 Pins Polygons & Perspectives 43

  44. Remove Markers/Polygons • Loop through markers array and remove each one from the map for (var i=0;i<markersArr.length;i++){ //remove markers to the map using map.removeLayer(markersArr[i]); } Pins Polygons & Perspectives 44

  45. Add Popup ● Add ‘on-click’ event listener to each marker markersArr[0].bindPopup(‘Some html text’); Pins Polygons & Perspectives 45

  46. Circles ● Lat/Lng to define center ● Radius Pins Polygons & Perspectives 46

  47. Polygons ● Use arrays ● Add events ● Multiple points var corners =[]; corners[0] = new L.LatLng(47.65521295468833 ,-122.41790771484375); corners[1] = new L.LatLng(47.663537612601345,-122.1734619140624); corners[2] = new L.LatLng(47.56170075451973 ,-122.18719482421874); corners[3] = new L.LatLng(47.56077405523748 ,-122.43301391601562); � polygon = L.polygon(corners); � polygon.addTo(map); Pins Polygons & Perspectives 47

  48. Demo Gas Stations Pins Polygons & Perspectives 48

  49. Third Party Data Pins Polygons & Perspectives 49

  50. WKT - Well Known Text ● Polygons can have thousands of points ● Complex geometries from 3rd party providers Pins Polygons & Perspectives 50

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend