SlideShare a Scribd company logo
NGSI: geoqueries and Carto
integration
Fermín Galán Márquez, Francisco Romero Bueno
Data Chapter Team
fermin.galanmarquez@telefonica.com,
francisco.romerobueno@telefonica.com
Geospatial features
1
• Orion Context Broker geospatial features
• Entities may have a location
• Queries/subscriptions may use the location as
search criteria
• Historical context persistence geospatial features
• Entities location is progressed to geo-enabled
persistence backends through Cygnus tool
• Carto is the main persistence backend used by
Cygnus when dealing with geo-located entities
• Cloud-based service
• Visualizations, analysis and widgets can be
added to maps
Geo-locating an entity
2
Point location
POST /v2/entities
{
"id": "E",
"type": "T",
"location": {
"type": "geo:json",
"value": {
"type": "Polygon",
"coordinates": [ [ [2, 1], [4, 3], [5, -1], [2, 1] ] ]
} } }
POST /v2/entities
{
"id": "E",
"type": "T",
"location": {
"type": "geo:polygon",
"value": [ "2, 2", "8, 7", "-1, 4", "2, 2"]
}
}
POST /v2/entities
{
"id": "E",
"type": "T",
"location": {
"type": "geo:box",
"value": [ "2, 2", "8, 7" ]
}
}
POST /v2/entities
{
"id": "E",
"type": "T",
"location": {
"type": "geo:point",
"value": "40.41,-3.69"
}
}
POST /v2/entities
{
"id": "E",
"type": "T",
"location": {
"type": "geo:line",
"value": [ "2, 2", "8, 7" ]
}
}
Line location
(e.g. a street)
Box location
(e.g. a squared building)
Polygon location
(e.g. a city district)
GeoJSON geometry (full flexibility)
Important remark regarding coords order
3
POST /v2/entities
{
"id": "E",
"type": "T",
"location": {
"type": "geo:point",
"value": "40.41,-3.69"
}
}
POST /v2/entities
{
"id": "E",
"type": "T",
"location": {
"type": "geo:json",
"value": {
"type": "Point“,
"value": "-3.69, 40.41"
}
}
same location
geo:json uses long-lat, while other formas use lat-long
Cygnus is able to swap coordinates when persisting data!
Geospatial queries at Context Broker
4
• They can be used both in synchronous (GET
/v2/entities) and asynchronous (subscriptions) queries
• Queries are based on a spatial relationship and a
geometry
• Spatial relationships:
• near (max and min distance)
• coveredBy
• intersects
• equal
• disjoint
• Geometries
• point
• line
• box
• polygon
Persistence of geo-locates entities in Carto
through Cygnus
5
• Cygnus is able to create 3 (4) kind of persistence:
• Raw historic
• A table is created for each entity. It contains the history
regarding the position (and any other attribute) of the entity
• Raw snapshot
• A single table handles the last position (ant the last value of
any other attribute) of the entity
• Distance historic
• A table is created for each entity. It contains already
processed distance-based analytics
• Total distance and time
• Last stage distance, time and speed
• Maximum and minimum distance, time and speed
• Average distance, time and speed, and variance
• (Distance snapshot - roadmap)
Demo setup
6
Orion Context
Broker
@ FIWARE Lab
NGSIv2 API
context information:
Malaga buses & streets
Cygnus
(using Carto
connector)
@ FIWARE Lab
carto.com
geo-located collections
notifications
callstoCartoAPI
Carto API
& dashboard
Service: sc_malaga
Subservice: /roads
7
Demo time!
Thank you!
http://fiware.org
Follow @FIWARE on Twitter
Demo 1 (basic queries) script
9
• Prep:
• Run the script to update bus lines each 5s
• Steps
• Show Malaga maps with the bus moving around the
city
• Do a ?type=bus query, then pick an specific bus
and do several queries to see how location is
shown and how it changes from time to time
• Stop the script in a moment in which some buses
are inside and some outside the center district. Now
the buses got halted on the web page
• Pick a point and do near-to queries in progressive
distance, to see how more buses get grabbed
• Do a polygon query for center district
Demo 2 (advanced queries) script
10
• Pre
• Use
https://drive.google.com/open?id=1jr5qnBQVTfXnD2EBG_
_XR2Vk-dc&usp=sharing
• Scripts:
• https://gist.github.com/fgalan/2143bff997ed039555ae8d0e
afaa6b5f
• Steps
• Do a ?type=street query and show how location is
modeled in some of them
• Query 1: streets close to a given point (e.g. bus stop), 10
meters to 150 m
• Query 2: streets that cross a given street
• Query 3: streets that don't cross a given street
• Query 4: streets fully inside Malaga center district
• Query 5: streets partially inside Malaga center district
• Query 5: streets outside Malaga center district

More Related Content

PPTX
FIWARE NGSI: Managing Context Information at Large Scale
PPTX
Orion Context Broker 2020-03-25
PPTX
FIWARE: Managing Context Information at large scale
PPTX
NGSIv2 Overview for Developers That Already Know NGSIv1
PPTX
orioncontextbroker-20180615
PPTX
Cosmos, Big Data GE implementation in FIWARE
PPTX
Introduction to FIWARE Cloud & Context Broker
PPTX
Orion Context Broker webminar 2014-04-01
FIWARE NGSI: Managing Context Information at Large Scale
Orion Context Broker 2020-03-25
FIWARE: Managing Context Information at large scale
NGSIv2 Overview for Developers That Already Know NGSIv1
orioncontextbroker-20180615
Cosmos, Big Data GE implementation in FIWARE
Introduction to FIWARE Cloud & Context Broker
Orion Context Broker webminar 2014-04-01

What's hot (20)

PDF
FIWARE Context Broker
PDF
REST APIs for the Internet of Things
PPTX
Orion Context Broker
PPTX
Orion Context Broker 20210602
PDF
Meetups - A realtime distributed monitoring application (Android)
PDF
A Modular Open Source Platform for IoT
PDF
IoT Toolkit and the Smart Object API Tutorial Introduction
PDF
Iot Toolkit and the Smart Object API - Architecture for Interoperability
PDF
Moving 150 TB of data resiliently on Kafka With Quorum Controller on Kubernet...
PPTX
KEDA Overview
PDF
Event-driven Applications with Kafka, Micronaut, and AWS Lambda | Dave Klein,...
PDF
Consul and Consul Pusher
PDF
Demystifying Event-Driven Architectures with Apache Kafka | Bogdan Sucaciu, P...
PDF
Service discovery in mesos miguel, Angel Guillen
PDF
Clocker Now and Next
PDF
18th Athens Big Data Meetup - 2nd Talk - Run Spark and Flink Jobs on Kubernetes
PDF
Improve monitoring and observability for kubernetes with oss tools
PDF
Iottoolkit osiot
PPTX
Kubernetes your next application server
PDF
Object models for interoperability
FIWARE Context Broker
REST APIs for the Internet of Things
Orion Context Broker
Orion Context Broker 20210602
Meetups - A realtime distributed monitoring application (Android)
A Modular Open Source Platform for IoT
IoT Toolkit and the Smart Object API Tutorial Introduction
Iot Toolkit and the Smart Object API - Architecture for Interoperability
Moving 150 TB of data resiliently on Kafka With Quorum Controller on Kubernet...
KEDA Overview
Event-driven Applications with Kafka, Micronaut, and AWS Lambda | Dave Klein,...
Consul and Consul Pusher
Demystifying Event-Driven Architectures with Apache Kafka | Bogdan Sucaciu, P...
Service discovery in mesos miguel, Angel Guillen
Clocker Now and Next
18th Athens Big Data Meetup - 2nd Talk - Run Spark and Flink Jobs on Kubernetes
Improve monitoring and observability for kubernetes with oss tools
Iottoolkit osiot
Kubernetes your next application server
Object models for interoperability
Ad

Similar to NGSI: Geoqueries & Carto integration (20)

PPTX
Day 6 - PostGIS
PDF
The road to remote debugger
PDF
Lucene solr 4 spatial extended deep dive
PDF
Geolocation and Mapping
PPT
Efficient Query Processing in Geographic Web Search Engines
PPTX
Analyzing and mapping space-time data
PDF
Lighthouse: Large-scale graph pattern matching on Giraph
PDF
Lighthouse: Large-scale graph pattern matching on Giraph
PDF
Integrating PostGIS in Web Applications
PDF
Gis capabilities on Big Data Systems
PPT
Geoservices Activities at EDINA
PPTX
What are customers building with new Bing Maps capabilities
PDF
Location Analytics - Real-Time Geofencing using Kafka
PPTX
Object extraction from satellite imagery using deep learning
PDF
Real-Time Processing of Spatial Data Using Kafka Streams, Ian Feeney & Roman ...
PDF
Graphs, Graphs everywhere - Lucene powered relation exploration
PPTX
Going Mobile with HTML5
PDF
NRE 423 3 Parts of ArcToolBox Presentation.pdf
PPTX
Working with space time data - esri uc 2018
PDF
Accumulo Summit 2016: GeoMesa: Using Accumulo for Optimized Spatio-Temporal P...
Day 6 - PostGIS
The road to remote debugger
Lucene solr 4 spatial extended deep dive
Geolocation and Mapping
Efficient Query Processing in Geographic Web Search Engines
Analyzing and mapping space-time data
Lighthouse: Large-scale graph pattern matching on Giraph
Lighthouse: Large-scale graph pattern matching on Giraph
Integrating PostGIS in Web Applications
Gis capabilities on Big Data Systems
Geoservices Activities at EDINA
What are customers building with new Bing Maps capabilities
Location Analytics - Real-Time Geofencing using Kafka
Object extraction from satellite imagery using deep learning
Real-Time Processing of Spatial Data Using Kafka Streams, Ian Feeney & Roman ...
Graphs, Graphs everywhere - Lucene powered relation exploration
Going Mobile with HTML5
NRE 423 3 Parts of ArcToolBox Presentation.pdf
Working with space time data - esri uc 2018
Accumulo Summit 2016: GeoMesa: Using Accumulo for Optimized Spatio-Temporal P...
Ad

More from FIWARE (20)

PPTX
Behm_Herne_NeMo_akt.pptx
PDF
Katharina Hogrebe Herne Digital Days.pdf
PPTX
Christoph Mertens_IDSA_Introduction to Data Spaces.pptx
PPTX
Behm_Herne_NeMo.pptx
PPTX
Evangelists + iHubs Promo Slides.pptx
PPTX
Lukas Künzel Smart City Operating System.pptx
PPTX
Pierre Golz Der Transformationsprozess im Konzern Stadt.pptx
PPTX
Dennis Wendland_The i4Trust Collaboration Programme.pptx
PPTX
Ulrich Ahle_FIWARE.pptx
PPTX
Aleksandar Vrglevski _FIWARE DACH_OSIH.pptx
PDF
Water Quality - Lukas Kuenzel.pdf
PPTX
Cameron Brooks_FGS23_FIWARE Summit_Keynote_Cameron.pptx
PPTX
FiWareSummit.msGIS-Data-to-Value.2023.06.12.pptx
PPTX
Boris Otto_FGS2023_Opening- EU Innovations from Data_PUB_V1_BOt.pptx
PPTX
Bjoern de Vidts_FGS23_Opening_athumi - bjord de vidts - personal data spaces....
PDF
Abdulrahman Ibrahim_FGS23 Opening - Abdulrahman Ibrahim.pdf
PDF
FGS2023_Opening_Red Hat Keynote Andrea Battaglia.pdf
PPTX
HTAG_Skalierung_Plattform_lokal_final_versand.pptx
PPTX
WE_LoRaWAN _ IoT.pptx
PPTX
EU Opp_Clara Pezuela - German chapter.pptx
Behm_Herne_NeMo_akt.pptx
Katharina Hogrebe Herne Digital Days.pdf
Christoph Mertens_IDSA_Introduction to Data Spaces.pptx
Behm_Herne_NeMo.pptx
Evangelists + iHubs Promo Slides.pptx
Lukas Künzel Smart City Operating System.pptx
Pierre Golz Der Transformationsprozess im Konzern Stadt.pptx
Dennis Wendland_The i4Trust Collaboration Programme.pptx
Ulrich Ahle_FIWARE.pptx
Aleksandar Vrglevski _FIWARE DACH_OSIH.pptx
Water Quality - Lukas Kuenzel.pdf
Cameron Brooks_FGS23_FIWARE Summit_Keynote_Cameron.pptx
FiWareSummit.msGIS-Data-to-Value.2023.06.12.pptx
Boris Otto_FGS2023_Opening- EU Innovations from Data_PUB_V1_BOt.pptx
Bjoern de Vidts_FGS23_Opening_athumi - bjord de vidts - personal data spaces....
Abdulrahman Ibrahim_FGS23 Opening - Abdulrahman Ibrahim.pdf
FGS2023_Opening_Red Hat Keynote Andrea Battaglia.pdf
HTAG_Skalierung_Plattform_lokal_final_versand.pptx
WE_LoRaWAN _ IoT.pptx
EU Opp_Clara Pezuela - German chapter.pptx

Recently uploaded (20)

PDF
Automated vs Manual WooCommerce to Shopify Migration_ Pros & Cons.pdf
PPTX
Introduction about ICD -10 and ICD11 on 5.8.25.pptx
PPTX
Job_Card_System_Styled_lorem_ipsum_.pptx
PDF
The Internet -By the Numbers, Sri Lanka Edition
PDF
Vigrab.top – Online Tool for Downloading and Converting Social Media Videos a...
PDF
Best Practices for Testing and Debugging Shopify Third-Party API Integrations...
PPTX
Funds Management Learning Material for Beg
PDF
WebRTC in SignalWire - troubleshooting media negotiation
PPTX
artificial intelligence overview of it and more
PDF
Unit-1 introduction to cyber security discuss about how to secure a system
PDF
Sims 4 Historia para lo sims 4 para jugar
DOCX
Unit-3 cyber security network security of internet system
PPTX
Module 1 - Cyber Law and Ethics 101.pptx
PDF
Slides PDF The World Game (s) Eco Economic Epochs.pdf
PDF
SASE Traffic Flow - ZTNA Connector-1.pdf
PPT
Design_with_Watersergyerge45hrbgre4top (1).ppt
PPTX
Introduction to Information and Communication Technology
PDF
An introduction to the IFRS (ISSB) Stndards.pdf
PPTX
QR Codes Qr codecodecodecodecocodedecodecode
PPTX
Slides PPTX World Game (s) Eco Economic Epochs.pptx
Automated vs Manual WooCommerce to Shopify Migration_ Pros & Cons.pdf
Introduction about ICD -10 and ICD11 on 5.8.25.pptx
Job_Card_System_Styled_lorem_ipsum_.pptx
The Internet -By the Numbers, Sri Lanka Edition
Vigrab.top – Online Tool for Downloading and Converting Social Media Videos a...
Best Practices for Testing and Debugging Shopify Third-Party API Integrations...
Funds Management Learning Material for Beg
WebRTC in SignalWire - troubleshooting media negotiation
artificial intelligence overview of it and more
Unit-1 introduction to cyber security discuss about how to secure a system
Sims 4 Historia para lo sims 4 para jugar
Unit-3 cyber security network security of internet system
Module 1 - Cyber Law and Ethics 101.pptx
Slides PDF The World Game (s) Eco Economic Epochs.pdf
SASE Traffic Flow - ZTNA Connector-1.pdf
Design_with_Watersergyerge45hrbgre4top (1).ppt
Introduction to Information and Communication Technology
An introduction to the IFRS (ISSB) Stndards.pdf
QR Codes Qr codecodecodecodecocodedecodecode
Slides PPTX World Game (s) Eco Economic Epochs.pptx

NGSI: Geoqueries & Carto integration

  • 1. NGSI: geoqueries and Carto integration Fermín Galán Márquez, Francisco Romero Bueno Data Chapter Team fermin.galanmarquez@telefonica.com, francisco.romerobueno@telefonica.com
  • 2. Geospatial features 1 • Orion Context Broker geospatial features • Entities may have a location • Queries/subscriptions may use the location as search criteria • Historical context persistence geospatial features • Entities location is progressed to geo-enabled persistence backends through Cygnus tool • Carto is the main persistence backend used by Cygnus when dealing with geo-located entities • Cloud-based service • Visualizations, analysis and widgets can be added to maps
  • 3. Geo-locating an entity 2 Point location POST /v2/entities { "id": "E", "type": "T", "location": { "type": "geo:json", "value": { "type": "Polygon", "coordinates": [ [ [2, 1], [4, 3], [5, -1], [2, 1] ] ] } } } POST /v2/entities { "id": "E", "type": "T", "location": { "type": "geo:polygon", "value": [ "2, 2", "8, 7", "-1, 4", "2, 2"] } } POST /v2/entities { "id": "E", "type": "T", "location": { "type": "geo:box", "value": [ "2, 2", "8, 7" ] } } POST /v2/entities { "id": "E", "type": "T", "location": { "type": "geo:point", "value": "40.41,-3.69" } } POST /v2/entities { "id": "E", "type": "T", "location": { "type": "geo:line", "value": [ "2, 2", "8, 7" ] } } Line location (e.g. a street) Box location (e.g. a squared building) Polygon location (e.g. a city district) GeoJSON geometry (full flexibility)
  • 4. Important remark regarding coords order 3 POST /v2/entities { "id": "E", "type": "T", "location": { "type": "geo:point", "value": "40.41,-3.69" } } POST /v2/entities { "id": "E", "type": "T", "location": { "type": "geo:json", "value": { "type": "Point“, "value": "-3.69, 40.41" } } same location geo:json uses long-lat, while other formas use lat-long Cygnus is able to swap coordinates when persisting data!
  • 5. Geospatial queries at Context Broker 4 • They can be used both in synchronous (GET /v2/entities) and asynchronous (subscriptions) queries • Queries are based on a spatial relationship and a geometry • Spatial relationships: • near (max and min distance) • coveredBy • intersects • equal • disjoint • Geometries • point • line • box • polygon
  • 6. Persistence of geo-locates entities in Carto through Cygnus 5 • Cygnus is able to create 3 (4) kind of persistence: • Raw historic • A table is created for each entity. It contains the history regarding the position (and any other attribute) of the entity • Raw snapshot • A single table handles the last position (ant the last value of any other attribute) of the entity • Distance historic • A table is created for each entity. It contains already processed distance-based analytics • Total distance and time • Last stage distance, time and speed • Maximum and minimum distance, time and speed • Average distance, time and speed, and variance • (Distance snapshot - roadmap)
  • 7. Demo setup 6 Orion Context Broker @ FIWARE Lab NGSIv2 API context information: Malaga buses & streets Cygnus (using Carto connector) @ FIWARE Lab carto.com geo-located collections notifications callstoCartoAPI Carto API & dashboard Service: sc_malaga Subservice: /roads
  • 10. Demo 1 (basic queries) script 9 • Prep: • Run the script to update bus lines each 5s • Steps • Show Malaga maps with the bus moving around the city • Do a ?type=bus query, then pick an specific bus and do several queries to see how location is shown and how it changes from time to time • Stop the script in a moment in which some buses are inside and some outside the center district. Now the buses got halted on the web page • Pick a point and do near-to queries in progressive distance, to see how more buses get grabbed • Do a polygon query for center district
  • 11. Demo 2 (advanced queries) script 10 • Pre • Use https://drive.google.com/open?id=1jr5qnBQVTfXnD2EBG_ _XR2Vk-dc&usp=sharing • Scripts: • https://gist.github.com/fgalan/2143bff997ed039555ae8d0e afaa6b5f • Steps • Do a ?type=street query and show how location is modeled in some of them • Query 1: streets close to a given point (e.g. bus stop), 10 meters to 150 m • Query 2: streets that cross a given street • Query 3: streets that don't cross a given street • Query 4: streets fully inside Malaga center district • Query 5: streets partially inside Malaga center district • Query 5: streets outside Malaga center district