SlideShare uma empresa Scribd logo
1 de 4
Baixar para ler offline
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

DOCUMENT VOLUNTATS ANTICIPADES
DOCUMENT VOLUNTATS ANTICIPADESDOCUMENT VOLUNTATS ANTICIPADES
DOCUMENT VOLUNTATS ANTICIPADESJordi Casanovas
 
EuSakai: Directions for Standards in Teaching and Learning
EuSakai: Directions for Standards in Teaching and LearningEuSakai: Directions for Standards in Teaching and Learning
EuSakai: Directions for Standards in Teaching and LearningCharles Severance
 
20140703 die zukunft liegt in deiner hand google austria smech
20140703 die zukunft liegt in deiner hand google austria smech20140703 die zukunft liegt in deiner hand google austria smech
20140703 die zukunft liegt in deiner hand google austria smechWerbeplanung.at Summit
 
How to get more conversion out of your website
How to get more conversion out of your websiteHow to get more conversion out of your website
How to get more conversion out of your websiteAlex Wang
 
Are you getting the most out of your membership
Are you getting the most out of your membershipAre you getting the most out of your membership
Are you getting the most out of your membershipNAWBO SEVA
 
15.07.2011 Closing Keynote Karin Frick Gottlieb Duttweiler Institut
15.07.2011 Closing Keynote Karin Frick Gottlieb Duttweiler Institut15.07.2011 Closing Keynote Karin Frick Gottlieb Duttweiler Institut
15.07.2011 Closing Keynote Karin Frick Gottlieb Duttweiler InstitutWerbeplanung.at Summit
 
Hy solution사례(5)저축보험가입고객
Hy solution사례(5)저축보험가입고객Hy solution사례(5)저축보험가입고객
Hy solution사례(5)저축보험가입고객valuasset
 
More Productivitiy with Spring Roo
More Productivitiy with Spring RooMore Productivitiy with Spring Roo
More Productivitiy with Spring RooEberhard Wolff
 
12.07.2012 T10 Branding, Matthias Zacek, news networld
12.07.2012 T10 Branding, Matthias Zacek, news networld12.07.2012 T10 Branding, Matthias Zacek, news networld
12.07.2012 T10 Branding, Matthias Zacek, news networldWerbeplanung.at Summit
 
Werbeplanung.at SUMMIT 15 - Die RTA Strategien der Einkäufer - Monika Kugler
Werbeplanung.at SUMMIT 15 - Die RTA Strategien der Einkäufer - Monika KuglerWerbeplanung.at SUMMIT 15 - Die RTA Strategien der Einkäufer - Monika Kugler
Werbeplanung.at SUMMIT 15 - Die RTA Strategien der Einkäufer - Monika KuglerWerbeplanung.at Summit
 
The University as a Cloud: Openness in Education
The University as a Cloud: Openness in EducationThe University as a Cloud: Openness in Education
The University as a Cloud: Openness in EducationCharles Severance
 
15.07.2011 M8 Erfolgreiche Optimierung von Social Media Konzepten atwork Mart...
15.07.2011 M8 Erfolgreiche Optimierung von Social Media Konzepten atwork Mart...15.07.2011 M8 Erfolgreiche Optimierung von Social Media Konzepten atwork Mart...
15.07.2011 M8 Erfolgreiche Optimierung von Social Media Konzepten atwork Mart...Werbeplanung.at Summit
 
 How to make a WP Blog in 15 minutes
 How to make a WP Blog in 15 minutes How to make a WP Blog in 15 minutes
 How to make a WP Blog in 15 minutesEduCampKyiv2008
 
Los Deditos
Los DeditosLos Deditos
Los DeditosIvy
 
Offre CMS libres Linagora
Offre CMS libres LinagoraOffre CMS libres Linagora
Offre CMS libres LinagoraLINAGORA
 
Presentazione Cerisdi (7Nov2008)
Presentazione Cerisdi (7Nov2008)Presentazione Cerisdi (7Nov2008)
Presentazione Cerisdi (7Nov2008)euresgroup
 

Destaque (20)

DOCUMENT VOLUNTATS ANTICIPADES
DOCUMENT VOLUNTATS ANTICIPADESDOCUMENT VOLUNTATS ANTICIPADES
DOCUMENT VOLUNTATS ANTICIPADES
 
EuSakai: Directions for Standards in Teaching and Learning
EuSakai: Directions for Standards in Teaching and LearningEuSakai: Directions for Standards in Teaching and Learning
EuSakai: Directions for Standards in Teaching and Learning
 
20140703 die zukunft liegt in deiner hand google austria smech
20140703 die zukunft liegt in deiner hand google austria smech20140703 die zukunft liegt in deiner hand google austria smech
20140703 die zukunft liegt in deiner hand google austria smech
 
How to get more conversion out of your website
How to get more conversion out of your websiteHow to get more conversion out of your website
How to get more conversion out of your website
 
Are you getting the most out of your membership
Are you getting the most out of your membershipAre you getting the most out of your membership
Are you getting the most out of your membership
 
15.07.2011 Closing Keynote Karin Frick Gottlieb Duttweiler Institut
15.07.2011 Closing Keynote Karin Frick Gottlieb Duttweiler Institut15.07.2011 Closing Keynote Karin Frick Gottlieb Duttweiler Institut
15.07.2011 Closing Keynote Karin Frick Gottlieb Duttweiler Institut
 
Hy solution사례(5)저축보험가입고객
Hy solution사례(5)저축보험가입고객Hy solution사례(5)저축보험가입고객
Hy solution사례(5)저축보험가입고객
 
Mislindosamigos[1]
Mislindosamigos[1]Mislindosamigos[1]
Mislindosamigos[1]
 
More Productivitiy with Spring Roo
More Productivitiy with Spring RooMore Productivitiy with Spring Roo
More Productivitiy with Spring Roo
 
12.07.2012 T10 Branding, Matthias Zacek, news networld
12.07.2012 T10 Branding, Matthias Zacek, news networld12.07.2012 T10 Branding, Matthias Zacek, news networld
12.07.2012 T10 Branding, Matthias Zacek, news networld
 
Werbeplanung.at SUMMIT 15 - Die RTA Strategien der Einkäufer - Monika Kugler
Werbeplanung.at SUMMIT 15 - Die RTA Strategien der Einkäufer - Monika KuglerWerbeplanung.at SUMMIT 15 - Die RTA Strategien der Einkäufer - Monika Kugler
Werbeplanung.at SUMMIT 15 - Die RTA Strategien der Einkäufer - Monika Kugler
 
AAT recruitment casestudy
AAT recruitment casestudyAAT recruitment casestudy
AAT recruitment casestudy
 
The University as a Cloud: Openness in Education
The University as a Cloud: Openness in EducationThe University as a Cloud: Openness in Education
The University as a Cloud: Openness in Education
 
15.07.2011 M8 Erfolgreiche Optimierung von Social Media Konzepten atwork Mart...
15.07.2011 M8 Erfolgreiche Optimierung von Social Media Konzepten atwork Mart...15.07.2011 M8 Erfolgreiche Optimierung von Social Media Konzepten atwork Mart...
15.07.2011 M8 Erfolgreiche Optimierung von Social Media Konzepten atwork Mart...
 
20081106 Luisterpunt Buitenbeentjes
20081106 Luisterpunt Buitenbeentjes20081106 Luisterpunt Buitenbeentjes
20081106 Luisterpunt Buitenbeentjes
 
 How to make a WP Blog in 15 minutes
 How to make a WP Blog in 15 minutes How to make a WP Blog in 15 minutes
 How to make a WP Blog in 15 minutes
 
Wheat 01
Wheat 01Wheat 01
Wheat 01
 
Los Deditos
Los DeditosLos Deditos
Los Deditos
 
Offre CMS libres Linagora
Offre CMS libres LinagoraOffre CMS libres Linagora
Offre CMS libres Linagora
 
Presentazione Cerisdi (7Nov2008)
Presentazione Cerisdi (7Nov2008)Presentazione Cerisdi (7Nov2008)
Presentazione Cerisdi (7Nov2008)
 

Semelhante a Sapo GIS Hands-On

Gmaps Railscamp2008
Gmaps Railscamp2008Gmaps Railscamp2008
Gmaps Railscamp2008xilinus
 
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 usOSCON 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 APIss318
 
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 appsRoberto Pepato
 
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óduMilos Lenoch
 
Enterprise workflow with Apps Script
Enterprise workflow with Apps ScriptEnterprise workflow with Apps Script
Enterprise workflow with Apps Scriptccherubino
 
Build Location Based App on bada
Build Location Based App on badaBuild Location Based App on bada
Build Location Based App on badaCheng 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-part2Synapseindiappsdevelopment
 
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 Internetdrgath
 
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 HeroesElectronic Arts / DICE
 

Semelhante a Sapo GIS 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

Gis SAPO Hands On
Gis SAPO Hands OnGis SAPO Hands On
Gis SAPO Hands Oncodebits
 
Aplicações Web TV no Meo
Aplicações Web TV no MeoAplicações Web TV no Meo
Aplicações Web TV no Meocodebits
 
Forms Usability 101
Forms Usability 101Forms Usability 101
Forms Usability 101codebits
 
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 appscodebits
 
XMPP Hands-On
XMPP Hands-OnXMPP Hands-On
XMPP Hands-Oncodebits
 
Mitos da Acessibilidade Web
Mitos da Acessibilidade WebMitos da Acessibilidade Web
Mitos da Acessibilidade Webcodebits
 
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 Freerunnercodebits
 
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
 
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 Freerunnercodebits
 
Exploring XMPP
Exploring XMPPExploring XMPP
Exploring XMPPcodebits
 
Sapo BUS Hands-On
Sapo BUS Hands-OnSapo BUS Hands-On
Sapo BUS Hands-Oncodebits
 
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 sequencercodebits
 
Making the Chumby
Making the ChumbyMaking the Chumby
Making the Chumbycodebits
 
Globs - Gestão de Glossários
Globs - Gestão de GlossáriosGlobs - Gestão de Glossários
Globs - Gestão de Glossárioscodebits
 
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çõescodebits
 
Alto Desempenho com Java
Alto Desempenho com JavaAlto Desempenho com Java
Alto Desempenho com Javacodebits
 
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 2008codebits
 
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 Formigascodebits
 

Mais de codebits (20)

Gis SAPO Hands On
Gis SAPO Hands OnGis SAPO Hands On
Gis SAPO Hands On
 
Aplicações Web TV no Meo
Aplicações Web TV no MeoAplicações Web TV no Meo
Aplicações Web TV no Meo
 
Forms Usability 101
Forms Usability 101Forms Usability 101
Forms Usability 101
 
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
 
XMPP Hands-On
XMPP Hands-OnXMPP Hands-On
XMPP Hands-On
 
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
 
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...
 
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
 
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
 

Último

Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 

Último (20)

Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 

Sapo GIS 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;); } }