SlideShare uma empresa Scribd logo
SAPO GIS Hands-On

Guião


Includes:

<script type=quot;text/javascriptquot; src=quot;http://mapas.sapo.pt/codebits/api_bundle.phpquot;></script>
<link rel=quot;Stylesheetquot; href=quot;http://mapas.sapo.pt/codebits/DraggableWindow.cssquot; />



   1. Adicionar o mapa a um site

        map = new SAPO.Widget.Maps({divid:quot;mapquot;, width: 1600, height: 750});


   2. Adicionar um marcador

        map.addMarker(38.70216, -9.17848, 'Codebits@LX Factory');



        2.1. Personalizar o marcador adicionado

        var opts = {
               icon: {
                         image: quot;http://mapas.sapo.pt/imgs/feed.pngquot;,
                         iconSize: { width: 20, height: 20 },
                         infoWindowAnchor: { x: 0, y: 0 },
                         iconAnchor: { x: 10, y: 10 },
                         display_titles: false
               },
               opened: false,
               selected: false,
               permanent: true,
               click_callback: function(marker){ alert(quot;clickedquot;); }
        };
        map.addMarker(38.70216,-9.17848,'Codebits@LX Factory','codebitsLayer', opts);



   3. Adicionar feeds GeoRSS

        map.getGeoRSSMarkers(quot;http://services.sapo.pt/Traffic/GeoRSSquot;,
        function (markers){map.addGeoRSSMarkers(markers,
        {layer: quot;trafficLayerquot;, iconURL: quot;images/traffic.pngquot;, iconWidth: 10, iconHeight: 19});});
4. Usar o serviço GIS para obter conteúdos georreferenciados
      4.1. Obter lista de categorias

       function fillCategories(){
              var syndicationObj = new SAPO.Communication.Syndication();
              syndicationObj.push(quot;http://services.sapo.pt/GIS/GetCategoriesJSONquot;,
                     {timeout: 4,onComplete: function(obj,
   args){categoriesCompleted(obj,args);}});
              syndicationObj.runAll();
      }

       function categoriesCompleted(obj, args){
              var result = obj.GetCategoriesResponse.GetCategoriesResult;
              var select = document.getElementById(quot;categoriesquot;);
              for(var idx = 0; idx < result.Category.length; ++idx){
                     select.options[idx] = new Option(result.Category[idx].CategoryName,
result.Category[idx].CategoryId);
              }
       }

       4.2. Pedir POIs por categoria e adicionar marcadores dinamicamente

       function addFromSelectedCategory(){
              var bounds = map.getBoundsLatLng();
              var select = document.getElementById(quot;categoriesquot;);
              var categoryId = select.options[select.selectedIndex].value;
              var url =
quot;http://services.sapo.pt/GIS/GetPOIByBoundingBoxJSON?latitude1=quot;+bounds.maxY+quot;&longitude1=quot;+bound
s.maxX+quot;&latitude2=quot;+bounds.minY+quot;&longitude2=quot;+bounds.minX+quot;&categoryId=quot;+categoryId+
quot;&matchlevelId=0&trustlevelId=0&recordsPerPage=100quot;;
              var syndicationObj = new SAPO.Communication.Syndication();
              syndicationObj.push(url,{timeout: 4,
                     onComplete: function(obj, args){selectedCategoryCompleted(obj,args);}});
              syndicationObj.runAll();
       }



       function selectedCategoryCompleted(obj, args){
              var result = obj.GetPOIByBoundingBoxResponse.GetPOIByBoundingBoxResult;
              for(var idx = 0; idx < result.POI.length; ++idx)
              {
                     map.addMarker(result.POI[idx].Latitude, result.POI[idx].Longitude,
result.POI[idx].Name);
              }
       }
5. Divisões administrativas
      5.1. Consultar os dados dos municípios através das operações do serviço GIS (ver em
           services.sapo.pt) e guardar num elemento select.

       function fillMunicipalities(){
              var syndicationObj = new SAPO.Communication.Syndication();
              syndicationObj.push(
quot;http://services.sapo.pt/GIS/GetMunicipalitiesSortedByNameJSONquot;,{timeout: 4,
onComplete: function(obj, args){municipalitiesCompleted(obj,args);}});
              syndicationObj.runAll();
       }

       function municipalitiesCompleted(obj, args){
              var result =
obj.GetMunicipalitiesSortedByNameResponse.GetMunicipalitiesSortedByNameResult;
              var select = document.getElementById(quot;municipalitiesquot;);
              for(var idx = 0; idx < result.Municipality.length; ++idx)
              {
                     select.options[idx] = new Option(result.Municipality[idx].MunicipalityName,
result.Municipality[idx].MunicipalityId);
              }
              select.selectedIndex = 0;
       }



       5.2. Utilizar uma operação do serviço GIS que permita fazer um pedido através do código de um
            município (ex.: GetPOIByMunicipalityIdAndCategoryId)


       function search(){
              var syndicationObj = new SAPO.Communication.Syndication();
              var municipalities = document.getElementById(quot;municipalitiesquot;);
              var municipalityId = municipalities.options[municipalities.selectedIndex].value;
              var categories = document.getElementById(quot;categoriesquot;);
              var categoryId = categories.options[categories.selectedIndex].value;
              syndicationObj.push(
quot;http://services.sapo.pt/GIS/GetPOIByMunicipalityIdAndCategoryIdJSON?municipalityId=quot;+municipalit
yId+quot;&categoryId=quot;+categoryId+quot;&matchlevelId=0&trustlevelId=0&recordsPerPage=10quot;,{timeout: 4,
                     onComplete: function(obj, args){searchCompleted(obj,args);},
                     onTimeout: function(){alert(quot;timeoutquot;);}});
              syndicationObj.runAll();
       }

       function searchCompleted(obj, args){
              var result =
obj.GetPOIByMunicipalityIdAndCategoryIdResponse.GetPOIByMunicipalityIdAndCategoryIdResult;
              for(var idx = 0; idx < result.POI.length; ++idx)
              {
                     map.addMarker(result.POI[idx].Latitude, result.POI[idx].Longitude,
result.POI[idx].Name);
              }
       }
6. Estatísticas
   6.1. Utilizar um feed que devolve estatísticas para a área visível e actualizar os marcadores de
        cada vez que houver uma actualização no mapa

   Feed:
   http://services.sapo.pt/GISStatistics/GetStatisticsForCategoriesInGeoRSS?minLatitude=37.23608&
   minLongitude=-13.04962&maxLatitude=38.09214&maxLongitude=-7.70803
   Evento: addMapStateChangeListener

   function statisticsByCategory(enable){
          if(enable){
                 refreshStatisticsByCategory();
                 statisticsListener =
   map.addMapStateChangeListener(refreshStatisticsByCategory);
          }
          else{
                 map.removeMapStateChangeListener(statisticsListener);
                 map.removeLayer(quot;statisticsLayerquot;);
          }
   }

   function refreshStatisticsByCategory(){
          map.removeLayer(quot;statisticsLayerquot;);
          var bounds = map.getBoundsLatLng();
          map.getGeoRSSMarkers(
          quot;http://services.sapo.pt/GISStatistics/GetStatisticsForCategoriesInGeoRSS?minLatitu
   de=quot;+bounds.minY+quot;&minLongitude=quot;+bounds.minX+quot;&maxLatitude=quot;+bounds.maxY+quot;&maxLongitude=quot;
   +bounds.maxX, function(markers){map.addGeoRSSMarkers(markers, {layer:
   statisticsLayerquot;});});
   }


    6.2. Mostrar no mapa os últimos POIs georreferenciados, com actualização periódica

   Ver operação GetLastPOIs
   Utilizar o serviço Transformer para transformar o XML dos POIs em GeoRSS:
   http://services.sapo.pt/Transformer/GisPoiToGeoRSS?url={url url-encoded}
   Função Javascript setInterval

   function lastGeoReferencedPOIs(enable){
          if(enable){
                 statisticsInterval = setInterval(function(){
   map.getGeoRSSMarkers(quot;http://services.sapo.pt/Transformer/GisPoiToGeoRSS?url=http%3A%2F%2F
   services.sapo.pt%2FGIS%2FGetLastPOIs%3FrecordsPerPage%3D10quot;,
   function(markers){
          map.removeLayer(quot;statisticsLayerquot;);
          map.addGeoRSSMarkers(markers, {layer: quot;statisticsLayerquot;, displayTitle: true});});},
   2000);
          }
          else{
                 clearInterval(statisticsInterval);
                 map.removeLayer(quot;statisticsLayerquot;);
          }
   }

Mais conteúdo relacionado

Destaque

Natal eb1
Natal eb1Natal eb1
Natal eb1
marimasoro
 
Aplicações Web TV no Meo
Aplicações Web TV no MeoAplicações Web TV no Meo
Aplicações Web TV no Meo
codebits
 
1 ciclo
1 ciclo1 ciclo
1 ciclo
ruimborges
 
Bob evans chicago sun times 10 18_2010
Bob evans chicago sun times  10 18_2010Bob evans chicago sun times  10 18_2010
Bob evans chicago sun times 10 18_2010
Brunner
 
XMPP Hands-On
XMPP Hands-OnXMPP Hands-On
XMPP Hands-On
codebits
 
Blogs SAPO
Blogs SAPOBlogs SAPO
Blogs SAPO
codebits
 
Forms Usability 101
Forms Usability 101Forms Usability 101
Forms Usability 101
codebits
 
SAPO Videos
SAPO VideosSAPO Videos
SAPO Videos
codebits
 
Future of Real-Time
Future of Real-TimeFuture of Real-Time
Future of Real-Time
jeff squires
 
Coders need to learn hardware hacking NOW
Coders need to learn hardware hacking NOWCoders need to learn hardware hacking NOW
Coders need to learn hardware hacking NOW
Matt Biddulph
 
20141107 nus friday hacks presentation get started with electronics
20141107 nus friday hacks presentation get started with electronics20141107 nus friday hacks presentation get started with electronics
20141107 nus friday hacks presentation get started with electronics
Takeda Pharmaceuticals
 
Hardware Hacking area: Make Cool Things with Microcontrollers (and learn to s...
Hardware Hacking area: Make Cool Things with Microcontrollers (and learn to s...Hardware Hacking area: Make Cool Things with Microcontrollers (and learn to s...
Hardware Hacking area: Make Cool Things with Microcontrollers (and learn to s...
codebits
 
Futuristic World with Sensors and Smart Devices [ Electronics Rocks'14
Futuristic World with Sensors and Smart Devices [ Electronics Rocks'14Futuristic World with Sensors and Smart Devices [ Electronics Rocks'14
Futuristic World with Sensors and Smart Devices [ Electronics Rocks'14
Samarth Shah
 
Hardware Hacking for JavaScript Engineers
Hardware Hacking for JavaScript EngineersHardware Hacking for JavaScript Engineers
Hardware Hacking for JavaScript Engineers
FITC
 
Hardware Reverse Engineering: From Boot to Root
Hardware Reverse Engineering: From Boot to RootHardware Reverse Engineering: From Boot to Root
Hardware Reverse Engineering: From Boot to Root
Yashin Mehaboobe
 
Velocity london 2012 bbc olympics
Velocity london 2012 bbc olympicsVelocity london 2012 bbc olympics
Velocity london 2012 bbc olympics
Andrew Brockhurst
 
Eloi Sanfélix y Javier Moreno - Hardware hacking on your couch [RootedCON 2012]
Eloi Sanfélix y Javier Moreno - Hardware hacking on your couch [RootedCON 2012]Eloi Sanfélix y Javier Moreno - Hardware hacking on your couch [RootedCON 2012]
Eloi Sanfélix y Javier Moreno - Hardware hacking on your couch [RootedCON 2012]
RootedCON
 
Hardware Hacking
Hardware HackingHardware Hacking
Hardware Hacking
Andrew Brockhurst
 
EAN’s World of Data: Prototyping apps using real data
EAN’s World of Data: Prototyping apps using real dataEAN’s World of Data: Prototyping apps using real data
EAN’s World of Data: Prototyping apps using real data
Matt Biddulph
 
Having fun with hardware
Having fun with hardwareHaving fun with hardware
Having fun with hardware
Sudar Muthu
 

Destaque (20)

Natal eb1
Natal eb1Natal eb1
Natal eb1
 
Aplicações Web TV no Meo
Aplicações Web TV no MeoAplicações Web TV no Meo
Aplicações Web TV no Meo
 
1 ciclo
1 ciclo1 ciclo
1 ciclo
 
Bob evans chicago sun times 10 18_2010
Bob evans chicago sun times  10 18_2010Bob evans chicago sun times  10 18_2010
Bob evans chicago sun times 10 18_2010
 
XMPP Hands-On
XMPP Hands-OnXMPP Hands-On
XMPP Hands-On
 
Blogs SAPO
Blogs SAPOBlogs SAPO
Blogs SAPO
 
Forms Usability 101
Forms Usability 101Forms Usability 101
Forms Usability 101
 
SAPO Videos
SAPO VideosSAPO Videos
SAPO Videos
 
Future of Real-Time
Future of Real-TimeFuture of Real-Time
Future of Real-Time
 
Coders need to learn hardware hacking NOW
Coders need to learn hardware hacking NOWCoders need to learn hardware hacking NOW
Coders need to learn hardware hacking NOW
 
20141107 nus friday hacks presentation get started with electronics
20141107 nus friday hacks presentation get started with electronics20141107 nus friday hacks presentation get started with electronics
20141107 nus friday hacks presentation get started with electronics
 
Hardware Hacking area: Make Cool Things with Microcontrollers (and learn to s...
Hardware Hacking area: Make Cool Things with Microcontrollers (and learn to s...Hardware Hacking area: Make Cool Things with Microcontrollers (and learn to s...
Hardware Hacking area: Make Cool Things with Microcontrollers (and learn to s...
 
Futuristic World with Sensors and Smart Devices [ Electronics Rocks'14
Futuristic World with Sensors and Smart Devices [ Electronics Rocks'14Futuristic World with Sensors and Smart Devices [ Electronics Rocks'14
Futuristic World with Sensors and Smart Devices [ Electronics Rocks'14
 
Hardware Hacking for JavaScript Engineers
Hardware Hacking for JavaScript EngineersHardware Hacking for JavaScript Engineers
Hardware Hacking for JavaScript Engineers
 
Hardware Reverse Engineering: From Boot to Root
Hardware Reverse Engineering: From Boot to RootHardware Reverse Engineering: From Boot to Root
Hardware Reverse Engineering: From Boot to Root
 
Velocity london 2012 bbc olympics
Velocity london 2012 bbc olympicsVelocity london 2012 bbc olympics
Velocity london 2012 bbc olympics
 
Eloi Sanfélix y Javier Moreno - Hardware hacking on your couch [RootedCON 2012]
Eloi Sanfélix y Javier Moreno - Hardware hacking on your couch [RootedCON 2012]Eloi Sanfélix y Javier Moreno - Hardware hacking on your couch [RootedCON 2012]
Eloi Sanfélix y Javier Moreno - Hardware hacking on your couch [RootedCON 2012]
 
Hardware Hacking
Hardware HackingHardware Hacking
Hardware Hacking
 
EAN’s World of Data: Prototyping apps using real data
EAN’s World of Data: Prototyping apps using real dataEAN’s World of Data: Prototyping apps using real data
EAN’s World of Data: Prototyping apps using real data
 
Having fun with hardware
Having fun with hardwareHaving fun with hardware
Having fun with hardware
 

Semelhante a Gis SAPO Hands On

Gmaps Railscamp2008
Gmaps Railscamp2008Gmaps Railscamp2008
Gmaps Railscamp2008
xilinus
 
Google Maps Api
Google Maps ApiGoogle Maps Api
Google Maps Api
Anas Alpure
 
Big Data for each one of us
Big Data for each one of usBig Data for each one of us
Big Data for each one of us
OSCON Byrum
 
Hands on with the Google Maps Data API
Hands on with the Google Maps Data APIHands on with the Google Maps Data API
Hands on with the Google Maps Data API
ss318
 
Ioannis Doxaras on GIS and Gmaps at 1st GTUG meetup Greece
Ioannis Doxaras on GIS and Gmaps at 1st GTUG meetup Greece Ioannis Doxaras on GIS and Gmaps at 1st GTUG meetup Greece
Ioannis Doxaras on GIS and Gmaps at 1st GTUG meetup Greece
CoLab Athens
 
Adding where to your ruby apps
Adding where to your ruby appsAdding where to your ruby apps
Adding where to your ruby apps
Roberto Pepato
 
Google Maps JS API
Google Maps JS APIGoogle Maps JS API
Google Maps JS API
Alberto Simões
 
Barcamp GoogleMaps - praktické ukázky kódu
Barcamp GoogleMaps - praktické ukázky kóduBarcamp GoogleMaps - praktické ukázky kódu
Barcamp GoogleMaps - praktické ukázky kódu
Milos Lenoch
 
Enterprise workflow with Apps Script
Enterprise workflow with Apps ScriptEnterprise workflow with Apps Script
Enterprise workflow with Apps Script
ccherubino
 
JQuery Flot
JQuery FlotJQuery Flot
JQuery Flot
Arshavski Alexander
 
Google Maps API 101
Google Maps API 101Google Maps API 101
Google Maps API 101
Sebastian Roming
 
UIWebView Tips
UIWebView TipsUIWebView Tips
UIWebView Tips
Katsumi Kishikawa
 
Build Location Based App on bada
Build Location Based App on badaBuild Location Based App on bada
Build Location Based App on bada
Cheng Luo
 
Synapse india reviews sharing chapter 23 – asp.net-part2
Synapse india reviews sharing  chapter 23 – asp.net-part2Synapse india reviews sharing  chapter 23 – asp.net-part2
Synapse india reviews sharing chapter 23 – asp.net-part2
Synapseindiappsdevelopment
 
Do something useful in Apps Script 5. Get your analytics pageviews to a sprea...
Do something useful in Apps Script 5. Get your analytics pageviews to a sprea...Do something useful in Apps Script 5. Get your analytics pageviews to a sprea...
Do something useful in Apps Script 5. Get your analytics pageviews to a sprea...
Bruce McPherson
 
Yahoo Query Language: Select * from Internet
Yahoo Query Language: Select * from InternetYahoo Query Language: Select * from Internet
Yahoo Query Language: Select * from Internet
drgath
 
Scripting GeoServer
Scripting GeoServerScripting GeoServer
Scripting GeoServer
Jared Erickson
 
CARTO ENGINE
CARTO ENGINECARTO ENGINE
CARTO ENGINE
Jorge Sanz
 
How data rules the world: Telemetry in Battlefield Heroes
How data rules the world: Telemetry in Battlefield HeroesHow data rules the world: Telemetry in Battlefield Heroes
How data rules the world: Telemetry in Battlefield Heroes
Electronic Arts / DICE
 
Synapse india dotnet development web approch
Synapse india dotnet development web approchSynapse india dotnet development web approch
Synapse india dotnet development web approch
Synapseindiappsdevelopment
 

Semelhante a Gis SAPO Hands On (20)

Gmaps Railscamp2008
Gmaps Railscamp2008Gmaps Railscamp2008
Gmaps Railscamp2008
 
Google Maps Api
Google Maps ApiGoogle Maps Api
Google Maps Api
 
Big Data for each one of us
Big Data for each one of usBig Data for each one of us
Big Data for each one of us
 
Hands on with the Google Maps Data API
Hands on with the Google Maps Data APIHands on with the Google Maps Data API
Hands on with the Google Maps Data API
 
Ioannis Doxaras on GIS and Gmaps at 1st GTUG meetup Greece
Ioannis Doxaras on GIS and Gmaps at 1st GTUG meetup Greece Ioannis Doxaras on GIS and Gmaps at 1st GTUG meetup Greece
Ioannis Doxaras on GIS and Gmaps at 1st GTUG meetup Greece
 
Adding where to your ruby apps
Adding where to your ruby appsAdding where to your ruby apps
Adding where to your ruby apps
 
Google Maps JS API
Google Maps JS APIGoogle Maps JS API
Google Maps JS API
 
Barcamp GoogleMaps - praktické ukázky kódu
Barcamp GoogleMaps - praktické ukázky kóduBarcamp GoogleMaps - praktické ukázky kódu
Barcamp GoogleMaps - praktické ukázky kódu
 
Enterprise workflow with Apps Script
Enterprise workflow with Apps ScriptEnterprise workflow with Apps Script
Enterprise workflow with Apps Script
 
JQuery Flot
JQuery FlotJQuery Flot
JQuery Flot
 
Google Maps API 101
Google Maps API 101Google Maps API 101
Google Maps API 101
 
UIWebView Tips
UIWebView TipsUIWebView Tips
UIWebView Tips
 
Build Location Based App on bada
Build Location Based App on badaBuild Location Based App on bada
Build Location Based App on bada
 
Synapse india reviews sharing chapter 23 – asp.net-part2
Synapse india reviews sharing  chapter 23 – asp.net-part2Synapse india reviews sharing  chapter 23 – asp.net-part2
Synapse india reviews sharing chapter 23 – asp.net-part2
 
Do something useful in Apps Script 5. Get your analytics pageviews to a sprea...
Do something useful in Apps Script 5. Get your analytics pageviews to a sprea...Do something useful in Apps Script 5. Get your analytics pageviews to a sprea...
Do something useful in Apps Script 5. Get your analytics pageviews to a sprea...
 
Yahoo Query Language: Select * from Internet
Yahoo Query Language: Select * from InternetYahoo Query Language: Select * from Internet
Yahoo Query Language: Select * from Internet
 
Scripting GeoServer
Scripting GeoServerScripting GeoServer
Scripting GeoServer
 
CARTO ENGINE
CARTO ENGINECARTO ENGINE
CARTO ENGINE
 
How data rules the world: Telemetry in Battlefield Heroes
How data rules the world: Telemetry in Battlefield HeroesHow data rules the world: Telemetry in Battlefield Heroes
How data rules the world: Telemetry in Battlefield Heroes
 
Synapse india dotnet development web approch
Synapse india dotnet development web approchSynapse india dotnet development web approch
Synapse india dotnet development web approch
 

Mais de codebits

Speak up: como criar Speech-based apps
Speak up: como criar Speech-based appsSpeak up: como criar Speech-based apps
Speak up: como criar Speech-based apps
codebits
 
Mitos da Acessibilidade Web
Mitos da Acessibilidade WebMitos da Acessibilidade Web
Mitos da Acessibilidade Web
codebits
 
Getting started with mobile devices development - Openmoko Freerunner
Getting started with mobile devices development - Openmoko FreerunnerGetting started with mobile devices development - Openmoko Freerunner
Getting started with mobile devices development - Openmoko Freerunner
codebits
 
CouchDB
CouchDBCouchDB
CouchDB
codebits
 
Getting started with mobile devices development - Openmoko Freerunner
Getting started with mobile devices development - Openmoko FreerunnerGetting started with mobile devices development - Openmoko Freerunner
Getting started with mobile devices development - Openmoko Freerunner
codebits
 
Exploring XMPP
Exploring XMPPExploring XMPP
Exploring XMPPcodebits
 
Sapo BUS Hands-On
Sapo BUS Hands-OnSapo BUS Hands-On
Sapo BUS Hands-On
codebits
 
Qtractor - An Audio/MIDI multi-track sequencer
Qtractor - An Audio/MIDI multi-track sequencerQtractor - An Audio/MIDI multi-track sequencer
Qtractor - An Audio/MIDI multi-track sequencer
codebits
 
Making the Chumby
Making the ChumbyMaking the Chumby
Making the Chumby
codebits
 
Globs - Gestão de Glossários
Globs - Gestão de GlossáriosGlobs - Gestão de Glossários
Globs - Gestão de Glossários
codebits
 
ATrad - Sistema de Garantia de Qualidade de Traduções
ATrad - Sistema de Garantia de Qualidade de TraduçõesATrad - Sistema de Garantia de Qualidade de Traduções
ATrad - Sistema de Garantia de Qualidade de Traduções
codebits
 
Alto Desempenho com Java
Alto Desempenho com JavaAlto Desempenho com Java
Alto Desempenho com Java
codebits
 
Sapo GIS Hands-On
Sapo GIS Hands-OnSapo GIS Hands-On
Sapo GIS Hands-On
codebits
 
Gis@sapo
Gis@sapoGis@sapo
Gis@sapo
codebits
 
Practical Thin Server Architecture With Dojo Sapo Codebits 2008
Practical Thin Server Architecture With Dojo Sapo Codebits 2008Practical Thin Server Architecture With Dojo Sapo Codebits 2008
Practical Thin Server Architecture With Dojo Sapo Codebits 2008
codebits
 
Optimização de pesquisas Web utilizando Colónias de Formigas
Optimização de pesquisas Web utilizando Colónias de FormigasOptimização de pesquisas Web utilizando Colónias de Formigas
Optimização de pesquisas Web utilizando Colónias de Formigas
codebits
 
Web cartooning ao vivo e a cores
Web cartooning ao vivo e a coresWeb cartooning ao vivo e a cores
Web cartooning ao vivo e a cores
codebits
 
Introductory Perl
Introductory PerlIntroductory Perl
Introductory Perlcodebits
 
Perl
PerlPerl
Perl
codebits
 
Mapascodebits2007
Mapascodebits2007Mapascodebits2007
Mapascodebits2007
codebits
 

Mais de codebits (20)

Speak up: como criar Speech-based apps
Speak up: como criar Speech-based appsSpeak up: como criar Speech-based apps
Speak up: como criar Speech-based apps
 
Mitos da Acessibilidade Web
Mitos da Acessibilidade WebMitos da Acessibilidade Web
Mitos da Acessibilidade Web
 
Getting started with mobile devices development - Openmoko Freerunner
Getting started with mobile devices development - Openmoko FreerunnerGetting started with mobile devices development - Openmoko Freerunner
Getting started with mobile devices development - Openmoko Freerunner
 
CouchDB
CouchDBCouchDB
CouchDB
 
Getting started with mobile devices development - Openmoko Freerunner
Getting started with mobile devices development - Openmoko FreerunnerGetting started with mobile devices development - Openmoko Freerunner
Getting started with mobile devices development - Openmoko Freerunner
 
Exploring XMPP
Exploring XMPPExploring XMPP
Exploring XMPP
 
Sapo BUS Hands-On
Sapo BUS Hands-OnSapo BUS Hands-On
Sapo BUS Hands-On
 
Qtractor - An Audio/MIDI multi-track sequencer
Qtractor - An Audio/MIDI multi-track sequencerQtractor - An Audio/MIDI multi-track sequencer
Qtractor - An Audio/MIDI multi-track sequencer
 
Making the Chumby
Making the ChumbyMaking the Chumby
Making the Chumby
 
Globs - Gestão de Glossários
Globs - Gestão de GlossáriosGlobs - Gestão de Glossários
Globs - Gestão de Glossários
 
ATrad - Sistema de Garantia de Qualidade de Traduções
ATrad - Sistema de Garantia de Qualidade de TraduçõesATrad - Sistema de Garantia de Qualidade de Traduções
ATrad - Sistema de Garantia de Qualidade de Traduções
 
Alto Desempenho com Java
Alto Desempenho com JavaAlto Desempenho com Java
Alto Desempenho com Java
 
Sapo GIS Hands-On
Sapo GIS Hands-OnSapo GIS Hands-On
Sapo GIS Hands-On
 
Gis@sapo
Gis@sapoGis@sapo
Gis@sapo
 
Practical Thin Server Architecture With Dojo Sapo Codebits 2008
Practical Thin Server Architecture With Dojo Sapo Codebits 2008Practical Thin Server Architecture With Dojo Sapo Codebits 2008
Practical Thin Server Architecture With Dojo Sapo Codebits 2008
 
Optimização de pesquisas Web utilizando Colónias de Formigas
Optimização de pesquisas Web utilizando Colónias de FormigasOptimização de pesquisas Web utilizando Colónias de Formigas
Optimização de pesquisas Web utilizando Colónias de Formigas
 
Web cartooning ao vivo e a cores
Web cartooning ao vivo e a coresWeb cartooning ao vivo e a cores
Web cartooning ao vivo e a cores
 
Introductory Perl
Introductory PerlIntroductory Perl
Introductory Perl
 
Perl
PerlPerl
Perl
 
Mapascodebits2007
Mapascodebits2007Mapascodebits2007
Mapascodebits2007
 

Último

Ocean lotus Threat actors project by John Sitima 2024 (1).pptx
Ocean lotus Threat actors project by John Sitima 2024 (1).pptxOcean lotus Threat actors project by John Sitima 2024 (1).pptx
Ocean lotus Threat actors project by John Sitima 2024 (1).pptx
SitimaJohn
 
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
Jeffrey Haguewood
 
Recommendation System using RAG Architecture
Recommendation System using RAG ArchitectureRecommendation System using RAG Architecture
Recommendation System using RAG Architecture
fredae14
 
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
Edge AI and Vision Alliance
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
innovationoecd
 
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development ProvidersYour One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
akankshawande
 
Taking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdfTaking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdf
ssuserfac0301
 
20240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 202420240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 2024
Matthew Sinclair
 
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success StoryDriving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Safe Software
 
Introduction of Cybersecurity with OSS at Code Europe 2024
Introduction of Cybersecurity with OSS  at Code Europe 2024Introduction of Cybersecurity with OSS  at Code Europe 2024
Introduction of Cybersecurity with OSS at Code Europe 2024
Hiroshi SHIBATA
 
UI5 Controls simplified - UI5con2024 presentation
UI5 Controls simplified - UI5con2024 presentationUI5 Controls simplified - UI5con2024 presentation
UI5 Controls simplified - UI5con2024 presentation
Wouter Lemaire
 
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
saastr
 
Monitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdfMonitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdf
Tosin Akinosho
 
OpenID AuthZEN Interop Read Out - Authorization
OpenID AuthZEN Interop Read Out - AuthorizationOpenID AuthZEN Interop Read Out - Authorization
OpenID AuthZEN Interop Read Out - Authorization
David Brossard
 
Best 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERPBest 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERP
Pixlogix Infotech
 
Programming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup SlidesProgramming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup Slides
Zilliz
 
Choosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptxChoosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptx
Brandon Minnick, MBA
 
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy SurveyTrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
danishmna97
 
GenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizationsGenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizations
kumardaparthi1024
 

Último (20)

Ocean lotus Threat actors project by John Sitima 2024 (1).pptx
Ocean lotus Threat actors project by John Sitima 2024 (1).pptxOcean lotus Threat actors project by John Sitima 2024 (1).pptx
Ocean lotus Threat actors project by John Sitima 2024 (1).pptx
 
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
 
Recommendation System using RAG Architecture
Recommendation System using RAG ArchitectureRecommendation System using RAG Architecture
Recommendation System using RAG Architecture
 
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
 
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development ProvidersYour One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
 
Taking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdfTaking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdf
 
20240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 202420240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 2024
 
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success StoryDriving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success Story
 
Introduction of Cybersecurity with OSS at Code Europe 2024
Introduction of Cybersecurity with OSS  at Code Europe 2024Introduction of Cybersecurity with OSS  at Code Europe 2024
Introduction of Cybersecurity with OSS at Code Europe 2024
 
UI5 Controls simplified - UI5con2024 presentation
UI5 Controls simplified - UI5con2024 presentationUI5 Controls simplified - UI5con2024 presentation
UI5 Controls simplified - UI5con2024 presentation
 
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
 
Monitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdfMonitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdf
 
OpenID AuthZEN Interop Read Out - Authorization
OpenID AuthZEN Interop Read Out - AuthorizationOpenID AuthZEN Interop Read Out - Authorization
OpenID AuthZEN Interop Read Out - Authorization
 
Best 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERPBest 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERP
 
Programming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup SlidesProgramming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup Slides
 
Choosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptxChoosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptx
 
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy SurveyTrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy Survey
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
 
GenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizationsGenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizations
 

Gis SAPO Hands On

  • 1. SAPO GIS Hands-On Guião Includes: <script type=quot;text/javascriptquot; src=quot;http://mapas.sapo.pt/codebits/api_bundle.phpquot;></script> <link rel=quot;Stylesheetquot; href=quot;http://mapas.sapo.pt/codebits/DraggableWindow.cssquot; /> 1. Adicionar o mapa a um site map = new SAPO.Widget.Maps({divid:quot;mapquot;, width: 1600, height: 750}); 2. Adicionar um marcador map.addMarker(38.70216, -9.17848, 'Codebits@LX Factory'); 2.1. Personalizar o marcador adicionado var opts = { icon: { image: quot;http://mapas.sapo.pt/imgs/feed.pngquot;, iconSize: { width: 20, height: 20 }, infoWindowAnchor: { x: 0, y: 0 }, iconAnchor: { x: 10, y: 10 }, display_titles: false }, opened: false, selected: false, permanent: true, click_callback: function(marker){ alert(quot;clickedquot;); } }; map.addMarker(38.70216,-9.17848,'Codebits@LX Factory','codebitsLayer', opts); 3. Adicionar feeds GeoRSS map.getGeoRSSMarkers(quot;http://services.sapo.pt/Traffic/GeoRSSquot;, function (markers){map.addGeoRSSMarkers(markers, {layer: quot;trafficLayerquot;, iconURL: quot;images/traffic.pngquot;, iconWidth: 10, iconHeight: 19});});
  • 2. 4. Usar o serviço GIS para obter conteúdos georreferenciados 4.1. Obter lista de categorias function fillCategories(){ var syndicationObj = new SAPO.Communication.Syndication(); syndicationObj.push(quot;http://services.sapo.pt/GIS/GetCategoriesJSONquot;, {timeout: 4,onComplete: function(obj, args){categoriesCompleted(obj,args);}}); syndicationObj.runAll(); } function categoriesCompleted(obj, args){ var result = obj.GetCategoriesResponse.GetCategoriesResult; var select = document.getElementById(quot;categoriesquot;); for(var idx = 0; idx < result.Category.length; ++idx){ select.options[idx] = new Option(result.Category[idx].CategoryName, result.Category[idx].CategoryId); } } 4.2. Pedir POIs por categoria e adicionar marcadores dinamicamente function addFromSelectedCategory(){ var bounds = map.getBoundsLatLng(); var select = document.getElementById(quot;categoriesquot;); var categoryId = select.options[select.selectedIndex].value; var url = quot;http://services.sapo.pt/GIS/GetPOIByBoundingBoxJSON?latitude1=quot;+bounds.maxY+quot;&longitude1=quot;+bound s.maxX+quot;&latitude2=quot;+bounds.minY+quot;&longitude2=quot;+bounds.minX+quot;&categoryId=quot;+categoryId+ quot;&matchlevelId=0&trustlevelId=0&recordsPerPage=100quot;; var syndicationObj = new SAPO.Communication.Syndication(); syndicationObj.push(url,{timeout: 4, onComplete: function(obj, args){selectedCategoryCompleted(obj,args);}}); syndicationObj.runAll(); } function selectedCategoryCompleted(obj, args){ var result = obj.GetPOIByBoundingBoxResponse.GetPOIByBoundingBoxResult; for(var idx = 0; idx < result.POI.length; ++idx) { map.addMarker(result.POI[idx].Latitude, result.POI[idx].Longitude, result.POI[idx].Name); } }
  • 3. 5. Divisões administrativas 5.1. Consultar os dados dos municípios através das operações do serviço GIS (ver em services.sapo.pt) e guardar num elemento select. function fillMunicipalities(){ var syndicationObj = new SAPO.Communication.Syndication(); syndicationObj.push( quot;http://services.sapo.pt/GIS/GetMunicipalitiesSortedByNameJSONquot;,{timeout: 4, onComplete: function(obj, args){municipalitiesCompleted(obj,args);}}); syndicationObj.runAll(); } function municipalitiesCompleted(obj, args){ var result = obj.GetMunicipalitiesSortedByNameResponse.GetMunicipalitiesSortedByNameResult; var select = document.getElementById(quot;municipalitiesquot;); for(var idx = 0; idx < result.Municipality.length; ++idx) { select.options[idx] = new Option(result.Municipality[idx].MunicipalityName, result.Municipality[idx].MunicipalityId); } select.selectedIndex = 0; } 5.2. Utilizar uma operação do serviço GIS que permita fazer um pedido através do código de um município (ex.: GetPOIByMunicipalityIdAndCategoryId) function search(){ var syndicationObj = new SAPO.Communication.Syndication(); var municipalities = document.getElementById(quot;municipalitiesquot;); var municipalityId = municipalities.options[municipalities.selectedIndex].value; var categories = document.getElementById(quot;categoriesquot;); var categoryId = categories.options[categories.selectedIndex].value; syndicationObj.push( quot;http://services.sapo.pt/GIS/GetPOIByMunicipalityIdAndCategoryIdJSON?municipalityId=quot;+municipalit yId+quot;&categoryId=quot;+categoryId+quot;&matchlevelId=0&trustlevelId=0&recordsPerPage=10quot;,{timeout: 4, onComplete: function(obj, args){searchCompleted(obj,args);}, onTimeout: function(){alert(quot;timeoutquot;);}}); syndicationObj.runAll(); } function searchCompleted(obj, args){ var result = obj.GetPOIByMunicipalityIdAndCategoryIdResponse.GetPOIByMunicipalityIdAndCategoryIdResult; for(var idx = 0; idx < result.POI.length; ++idx) { map.addMarker(result.POI[idx].Latitude, result.POI[idx].Longitude, result.POI[idx].Name); } }
  • 4. 6. Estatísticas 6.1. Utilizar um feed que devolve estatísticas para a área visível e actualizar os marcadores de cada vez que houver uma actualização no mapa Feed: http://services.sapo.pt/GISStatistics/GetStatisticsForCategoriesInGeoRSS?minLatitude=37.23608& minLongitude=-13.04962&maxLatitude=38.09214&maxLongitude=-7.70803 Evento: addMapStateChangeListener function statisticsByCategory(enable){ if(enable){ refreshStatisticsByCategory(); statisticsListener = map.addMapStateChangeListener(refreshStatisticsByCategory); } else{ map.removeMapStateChangeListener(statisticsListener); map.removeLayer(quot;statisticsLayerquot;); } } function refreshStatisticsByCategory(){ map.removeLayer(quot;statisticsLayerquot;); var bounds = map.getBoundsLatLng(); map.getGeoRSSMarkers( quot;http://services.sapo.pt/GISStatistics/GetStatisticsForCategoriesInGeoRSS?minLatitu de=quot;+bounds.minY+quot;&minLongitude=quot;+bounds.minX+quot;&maxLatitude=quot;+bounds.maxY+quot;&maxLongitude=quot; +bounds.maxX, function(markers){map.addGeoRSSMarkers(markers, {layer: statisticsLayerquot;});}); } 6.2. Mostrar no mapa os últimos POIs georreferenciados, com actualização periódica Ver operação GetLastPOIs Utilizar o serviço Transformer para transformar o XML dos POIs em GeoRSS: http://services.sapo.pt/Transformer/GisPoiToGeoRSS?url={url url-encoded} Função Javascript setInterval function lastGeoReferencedPOIs(enable){ if(enable){ statisticsInterval = setInterval(function(){ map.getGeoRSSMarkers(quot;http://services.sapo.pt/Transformer/GisPoiToGeoRSS?url=http%3A%2F%2F services.sapo.pt%2FGIS%2FGetLastPOIs%3FrecordsPerPage%3D10quot;, function(markers){ map.removeLayer(quot;statisticsLayerquot;); map.addGeoRSSMarkers(markers, {layer: quot;statisticsLayerquot;, displayTitle: true});});}, 2000); } else{ clearInterval(statisticsInterval); map.removeLayer(quot;statisticsLayerquot;); } }