SlideShare una empresa de Scribd logo
1 de 4
Descargar para leer sin conexión
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;);
          }
   }

Más contenido relacionado

Destacado

Aplicações Web TV no Meo
Aplicações Web TV no MeoAplicações Web TV no Meo
Aplicações Web TV no Meo
codebits
 
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
 
Forms Usability 101
Forms Usability 101Forms Usability 101
Forms Usability 101
codebits
 
Future of Real-Time
Future of Real-TimeFuture of Real-Time
Future of Real-Time
jeff squires
 
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
 
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
 

Destacado (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
 

Similar a Gis SAPO Hands On

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
 
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
 

Similar 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
 

Más 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
 
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 XMPP
codebits
 
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
 
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 Perl
codebits
 

Más 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

Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Último (20)

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
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 

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