Upgrade to Pro — share decks privately, control downloads, hide ads and more …

An Open Source GIS Analytics Solution: Issues in Integrating Multiple Technologies

An Open Source GIS Analytics Solution: Issues in Integrating Multiple Technologies

Presented by Lucia Barbato, GISP
Santosh Seshadri, MS
David Lucus, PhD Candidate

Center for Geospatial Technology, Texas Tech University

More Decks by Texas Natural Resources Information System

Other Decks in Technology

Transcript

  1. Texas  GIS  Forum  2014  –  Aus5n,   An  Open  Source

     GIS  Analy5cs  Solu5on:   Issues  in  Integra5ng  Mul5ple  Technologies     Lucia  Barbato,  GISP    Santosh  Seshadri,  MS      David  Lucus,  PhD  Candidate                                Center  for  Geospa5al  Technology,  Texas  Tech  University  
  2. Texas  GIS  Forum  2014  –  Aus5n,   An  Open  Source

     GIS  Analy5cs  Solu5on:   Issues  in  Integra5ng  Mul5ple  Technologies       Web  mapping  applica5on  for  CPRIT   Cancer  Preven5on  Ins5tute  of  Texas      
  3. Texas  GIS  Forum  2014  –  Aus5n,   Open  Source  CPRIT

     Project  Mapper  Applica5on     -­‐  JavaScript  mapping  library   -­‐  JavaScript  char5ng  library   -­‐  RDBMS   -­‐  Scrip5ng  language  for  web  development   -­‐  Cross-­‐plaSorm  JavaScript  library  
  4. Texas  GIS  Forum  2014  –  Aus5n,   -­‐  Manually  produced

     maps   using  a  drawing  package     -­‐  Limited  to  17  sta5c  jpg  maps  
  5. Texas  GIS  Forum  2014  –  Aus5n,   -­‐  CPRIT  Project

     Mapper     -­‐  300,000  possible  maps    
  6. Texas  GIS  Forum  2014  –  Aus5n,   Interface   Server-­‐Side

      Database   •  Technologies   –  JQuery   –  Leaflet   •  Technologies   –  PHP   •  Technologies   –  MySQL   •  Call  via   –  Post   –  ASync   •  Files  of  Interest   –  asyncdata.js   System  Framework  
  7. Texas  GIS  Forum  2014  –  Aus5n,   System  Framework  –

     asyncdata.php   function  UpdateMapCount(cancerids,  focusids,  topicids,  isActive){          $.ajax({                  type:  "GET",                  async:  "false",                  url:  "mapcatcher.php?method=mapcount&cancerids="  +  cancerids  +  "&focusids="  +                                                                                                                                            focusids  +  "&topicids="  +  topicids  +  "&isActive="  +  isActive,                    success:  function(html)  {                            RenderMap($.parseJSON(html));                    }          }); }
  8. Texas  GIS  Forum  2014  –  Aus5n,   Interface   Server-­‐Side

      Database   •  Technologies   –  JQuery   –  Leaflet   •  Technologies   –  PHP   •  Technologies   –  MySQL   •  Call  via   –  Post   –  ASync   •  Call  via   –  Prepared   Statements   –  Dynamic   Calls   •  Files  of  Interest   –  mapcatcher.ph p   – phpfunc.php   •  Files  of  Interest   –  asyncdata.js   System  Framework  
  9. Texas  GIS  Forum  2014  –  Aus5n,   System  Framework  –

     mapcatcher.php   switch  ($_GET['method']){        case  "mapcount"  :                  echo  ConvertMapCountJSON(GetMapCountData($_GET['cancerids'],  $_GET['focusids'],                                                                                                                                                                                                                $_GET['topicids'],  $_GET['isActive']));                break;        default  :                echo  “Why  are  you  asking  me  questions!"; }
  10. Texas  GIS  Forum  2014  –  Aus5n,   System  Framework  –

     phpfunc.php   function  GetMapCountData($cancerSiteIds,  $focusIds,  $topicIds,  $isActive) {        global  $db_conn;        $db  =  new  PDO($db_conn['dsn'],  $db_conn['user'],  $db_conn['pass']);        $cmd  =  "select  c.county_id,  c.county,  c.geometry,  c.polytype,  IFNULL(data.cntycnt,  0)  as  award_cnt,                                            IFNULL(data.statewidecnt,  0)  as  state_proj_cnt    from  county  c    left  join  ";        if  (strlen($cancerSiteIds)  >  0)  {                if  ($haswhere)                        $cmd  .=  "  and  ";                else  {                        $haswhere  =  true;                        $cmd  .=  "  where  ";                }                $cmd  .=  "  a.award_id  in  (select  award_id  from  award_cancer_site  where  ";                $cmd  .=  AddInListParams($cancerSiteIds,  "cancer_site_id")  .  ")  ";                $params  =  GenBindParams($cancerSiteIds);        }
  11. Texas  GIS  Forum  2014  –  Aus5n,   System  Framework  –

     phpfunc.php          $stmt  =  $db-­‐>prepare($cmd);        if  (sizeof($params)  >  0)                $stmt-­‐>execute($params);        else                  $stmt-­‐>execute();        $data  =  $stmt-­‐>fetchAll();        return  $data;
  12. Texas  GIS  Forum  2014  –  Aus5n,   Interface   Server-­‐Side

      Database   •  Technologies   –  JQuery   –  Leaflet   •  Technologies   –  PHP   •  Technologies   –  MySQL   •  Call  via   –  Post   –  ASync   •  Call  via   –  Prepared   Statements   –  Dynamic   Calls   •  Return  via   –  Recordset   •  Files  of  Interest   –  mapcatcher.ph p   –  phpfunc.php   •  Files  of  Interest   –  asyncdata.js   System  Framework  
  13. Texas  GIS  Forum  2014  –  Aus5n,   System  Framework  –

     phpfunc.php  revisited   function  ConvertMapCountJSON($rows)  {        $s  =  NL("{");        $s  .=  NL("\"type\":\"FeatureCollection\",");        $s  .=  NL("\"properties\":{");        $s  .=  AddJsonStringTag("kind","state",  TRUE);        $s  .=  AddJsonStringTag("state","TX",  FALSE);        $s  .=  NL("},");        $s  .=  NL("\"features\":[");        $index  =  0;        foreach  ($rows  as  $r)  {                $s  .=  NL("{");                $s  .=  AddJsonStringTag("type","Feature",  TRUE);                $s  .=  NL("\"properties\":  {");                $s  .=  AddJsonStringTag("kind","county",  TRUE);                $s  .=  AddJsonStringTag("name",  $r[1],  TRUE);    //More  items  after  this  in  live  version        }        $s  =  substr($s,  0,  -­‐1)  .  "]}";    //end  feature  collection        return  $s; }
  14. Texas  GIS  Forum  2014  –  Aus5n,   Interface   Server-­‐Side

      Database   •  Technologies   –  JQuery   –  Leaflet   •  Technologies   –  PHP   •  Technologies   –  MySQL   •  Call  via   –  Post   –  ASync   •  Call  via   –  Prepared   Statements   –  Dynamic   Calls   •  Return  via   –  Recordset   •  Return  via   –  GEOJSON   –  JSON   –  PHP  Echo   •  Files  of  Interest   –  mapcatcher.ph p   – phpfunc.php   •  Files  of  Interest   –  asyncdata.js   –  render.js   System  Framework  
  15. Texas  GIS  Forum  2014  –  Aus5n,   System  Framework  –

     render.js   function  RenderCountyList(o,  ctrl)  {        var  s  =  "<div>";        for  (var  i=0;i<o.vals.length;  i++)  {                s  +=  o.vals[i].txt  +  ",  ";        }        s  =  s.substring(0,  s.length-­‐2);        s  +=  "</div>";        $("#"  +  ctrl).html(s); }
  16. Texas  GIS  Forum  2014  –  Aus5n,   Interface   Server-­‐Side

      Database   •  Technologies   –  JQuery   –  Leaflet   •  Technologies   –  PHP   •  Technologies   –  MySQL   •  Call  via   –  Post   –  ASync   •  Call  via   –  Prepared   Statements   –  Dynamic   Calls   •  Return  via   –  Recordset   •  Return  via   –  GEOJSON   –  JSON   –  PHP  Echo   •  Files  of  Interest   –  mapcatcher.ph p   –  phpfunc.php   •  Files  of  Interest   –  asyncdata.js   –  render.js   System  Framework  
  17. Texas  GIS  Forum  2014  –  Aus5n,   Dynamically  Generated  Menus

     and  Reports   Cancer  Sites  menu  is   generated  dynamically   from  the  values  in  the   database  
  18. Texas  GIS  Forum  2014  –  Aus5n,   Dynamically  Generated  Menus

     and  Reports   Focus  and  Topic  Areas   menu  is  also   generated   dynamically  from  the   values  in  the  database  
  19. Texas  GIS  Forum  2014  –  Aus5n,   Reports  and  charts

      are  dynamically   updated  per  user’s   request  using  AJAX   and  php   Dynamically  Generated  Menus  and  Reports  
  20. Texas  GIS  Forum  2014  –  Aus5n,   GeoJSON  and  Leaflet

     Integra5on   //  omap  -­‐  js  object  in  GEOJSON  format   function  RenderMap(omap)          {              map.removeLayer(geoJsonMap);                geoJsonMap  =  L.geoJson(omap,  {                                  style  :  MapStyle,                                  onEachFeature  :onEachFeature                            }).addTo(map);          } The number of Statewide and County projects are passed from the JSON file and displayed on the map. Coordinates for each county are stored in the database and Leaflet uses that field to draw the boundaries. Leanlet  code
  21. Texas  GIS  Forum  2014  –  Aus5n,   Number  of  Statewide

      Projects  is  dynamically   updated  according  to   selec5ons   Leaflet  Customiza5on   Search  (Geocoder)     Full  Extent   Display  Chart   Export  Map  (PDF)   Print  Map   Clears  Selected  Coun5es   Reset  Map   •  Leaflet  plugin  provides  Geocoder   and  Zoom     •  HighCharts  pop-­‐up  rendered  via   JS  modal   •  Export  and  Print  JS  func5ons   dynamically  design    print  page   content   •  Leaflet  func5on  clears  county   selec5ons   •  Reset  map  is  a  JS  func5on  that   defaults  all  selec5ons  and  re-­‐ renders  the  map.   When  mul5ple  coun5es  are   selected,  the  individual  county   awards  are  accumulated  and  the   total  is  displayed  in  the  popup.  
  22. Texas  GIS  Forum  2014  –  Aus5n,   Dynamic  Legends  and

     Color  Schemes   •  Users  can  pick  a  color  scheme   of  their  choice    
  23. Texas  GIS  Forum  2014  –  Aus5n,   Dynamic  Legends  and

     Color  Schemes   •  Users  can  pick  a  color  scheme   of  their  choice     •  Enter  preferred  break  values  
  24. Texas  GIS  Forum  2014  –  Aus5n,   Dynamic  Legends  and

     Color  Schemes   •  Users  can  pick  a  color  scheme   of  their  choice     •  Enter  preferred  break  values  
  25. Texas  GIS  Forum  2014  –  Aus5n,   Dynamic  Legends  and

     Color  Schemes   •  Users  can  pick  a  color  scheme              of  their  choice     •  Enter  preferred  break  values   –  Accomplished  using  JavaScript  
  26. Texas  GIS  Forum  2014  –  Aus5n,   Thank  you  

    An  Open  Source  GIS  Analy5cs  Solu5on:   Issues  in  Integra5ng  Mul5ple  Technologies       Lucia  Barbato,  GISP  -­‐  [email protected]    Santosh  Seshadri,  MS  –  [email protected]      David  Lucus,  PhD  Candidate  –  [email protected]       Center  for  Geospa5al  Technology,  Texas  Tech  University