VirtualXPath-advanced
Not logged in

back to XmlBlob main page

Few advanced VirtualXPath examples

Now you are supposed to have acquired at least a basic level of understanding and knowledge about XPath.
It's time to quickly examine few specic cases specifically related to the GeoSpatial scenario.

SLD/SE styles

SELECT t.file_name, x.node
FROM xpath_styles AS x
JOIN styles AS t ON (t.pk_uid = x.pkid)
WHERE x.xpath_expr = '//dflt:LineSymbolizer'
GROUP BY t.file_name, x.node;
file_namenode
ferovie_se.xmldflt:LineSymbolizer
ferrovie_basic.xmldflt:LineSymbolizer

A query identifying all styles defining a LineSymbolyzer.
SELECT t.file_name, x.parent, x.node, x.value
FROM xpath_styles AS x
JOIN styles AS t ON (t.pk_uid = x.pkid)
WHERE x.xpath_expr = '//dflt:Label/ogc:PropertyName/text()'
GROUP BY t.file_name, x.node, x.value;
file_nameparentnodevalue
regioni_basic.xmldflt:Labelogc:PropertyNamenome_reg
regioni_se.xmldflt:Labelogc:PropertyNamenome_reg
stazioni_basic.xmldflt:Labelogc:PropertyNamename
stazioni_se.xmldflt:Labelogc:PropertyNamename

... a second query identifying the attribute/column names used to support Labeling.
SELECT t.file_name, x.parent, x.node, x.value
FROM xpath_styles AS x
JOIN styles AS t ON (t.pk_uid = x.pkid)
WHERE x.xpath_expr = '//dflt:Mark/dflt:WellKnownName/text()'
GROUP BY t.file_name, x.parent, x.node, x.value;
file_nameparentnodevalue
stazioni_basic.xmldflt:Markdflt:WellKnownNamecircle
stazioni_se.xmldflt:Markdflt:WellKnownNamecircle
stazioni_se.xmldflt:Markdflt:WellKnownNamestar

... yet another query reporting all marker shapes used as a PointSymbolizer.
SELECT value
FROM xpath_styles
WHERE xpath_expr = '//dflt:CssParameter[@name="fill"]/text()'
GROUP BY value;
value
#000000
#0000ff
#8F00FF
#DC143C
#FFFFFF
#d0d0d0
#d0d0ff
#d0ffd0
#ffd0d0
#ffffd0

... a further query enumerating all fill colors.
SELECT t.file_name, x.parent, x.node, x.value
FROM xpath_styles AS x
JOIN styles AS t ON (t.pk_uid = x.pkid)
WHERE x.xpath_expr = '//dflt:CssParameter[@name="stroke-width"]/text()'
GROUP BY t.file_name, x.parent, x.node, x.value;
file_nameparentnodevalue
ferovie_se.xmldflt:Strokedflt:CssParameter0.5
ferovie_se.xmldflt:Strokedflt:CssParameter1.5
ferovie_se.xmldflt:Strokedflt:CssParameter8
ferrovie_basic.xmldflt:Strokedflt:CssParameter1
regioni_basic.xmldflt:Strokedflt:CssParameter0.25
regioni_se.xmldflt:Strokedflt:CssParameter0.25
stazioni_se.xmldflt:Strokedflt:CssParameter1

And finally a last query showing all stroke widths used by LineSymbolizers.

Sensors

SELECT t.file_name, x.value
FROM xpath_sensors AS x
JOIN sensors AS t ON (t.pk_uid = x.pkid) 
WHERE xpath_expr = '//dflt:Term[@definition="urn:ogc:def:identifier:OGC:1.0:longName"]/dflt:value/text()';
file_namevalue
SensorML_Profile_for_Discovery_Example.xmlWeather station 123 on top of the IfGI building
SensorML_Profile_for_Discovery_Example.xmlOSIRIS Thermometer at weather station 123
sml-existing_keywords.xmlOSIRIS Thermometer at weather station 123
sml-gmet-intervention_on_land.xmlOSIRIS Thermometer at weather station 123
sml-gmet-none.xmlOSIRIS Thermometer at weather station 123
sml-no_keywords-boundedby.xmlOSIRIS Thermometer at weather station 123
sml-no_keywords-description.xmlOSIRIS Thermometer at weather station 123
sml-no_keywords-name.xmlOSIRIS Thermometer at weather station 123
sml-no_keywords-none2.xmlOSIRIS Thermometer at weather station 123

Retrieving the sensors' long names.
SELECT t.file_name, x.value
FROM xpath_sensors AS x
JOIN sensors AS t ON (t.pk_uid = x.pkid) 
WHERE xpath_expr = '//dflt:Term[@definition="urn:ogc:def:classifier:OGC:1.0:sensorType"]/dflt:value/text()';
file_namevalue
SensorML_Profile_for_Discovery_Example.xmlweather station
SensorML_Profile_for_Discovery_Example.xmlthermometer
sml-existing_keywords.xmlthermometer
sml-gmet-intervention_on_land.xmlthermometer
sml-gmet-none.xmlthermometer
sml-no_keywords-boundedby.xmlthermometer
sml-no_keywords-description.xmlthermometer
sml-no_keywords-name.xmlthermometer
sml-no_keywords-none2.xmlthermometer

Extracting the sensors' types.
SELECT t.file_name, MakePointZ(x.value*1.0, y.value*1.0, z.value*1.0) AS Geometry
FROM sensors AS t
JOIN xpath_sensors AS x ON (t.pk_uid = x.pkid)
JOIN xpath_sensors AS y ON (t.pk_uid = y.pkid)
JOIN xpath_sensors AS z ON (t.pk_uid = z.pkid)
WHERE t.pk_uid = 1
  AND x.xpath_expr = '//swe:Position//swe:Quantity[@axisID="x"]//swe:value/text()'
  AND y.xpath_expr = '//swe:Position//swe:Quantity[@axisID="y"]//swe:value/text()'
  AND z.xpath_expr = '//swe:Position//swe:Quantity[@axisID="z"]//swe:value/text()';
file_nameGeometry
SensorML_Profile_for_Discovery_Example.xmlBLOB sz=68 GEOMETRY

Creating a Point Geometry corresponding to the sensor's position.

ISO Metadata / INSPIRE Metadata

SELECT t.file_name, x.value
FROM meta AS t
JOIN xpath_meta AS x ON (t.pk_uid = x.pkid)
WHERE x.xpath_expr = '//gmd:contact/gmd:CI_ResponsibleParty/gmd:organisationName/gco:CharacterString/text()';
file_namevalue
AreasOfOutstandingNaturalBeauty.xmlNatural England
IGNF_BDCARTOr_2-5.xmlIGN-F
IGNF_BDORTHOr_2-0.xmlInstitut Géographique National (IGN-F)
inspire-data-example.xmlSDI Unit, Institute for Environment & Sustainability, Joint Research
Centre
ISO-Coll_ESA-ERS_ORB_PRC_xS-I-en-formatted.xmlESA/ESRIN
metadata-9.xmlOffice International de l'eau

Identifying the responsible party.
SELECT t.file_name, x.value
FROM meta AS t
JOIN xpath_meta AS x ON (t.pk_uid = x.pkid)
WHERE x.xpath_expr = '//gmd:abstract/gco:CharacterString/text()';
file_namevalue
AreasOfOutstandingNaturalBeauty.xmlAONBs are designated areas where protection is afforded to protect and manage the areas for visitors and local residents.

By using this data you are accepting the Terms of Use for Natural England’s Information and Data as published at:
http://www.naturalengland.org.uk/copyright.
If you wish to use the data for commercial purposes you should contact Natural England's Enquiry Service, tel: 0845 600 3078, email: enquiries@naturalengland.org.uk.
IGNF_BDCARTOr_2-5.xmlLa BD CARTO(r) est une base de données vectorielles décrivant sur l'ensemble du territoire français l'information cartographique aux échelles départementales et régionales.
IGNF_BDORTHOr_2-0.xmlLe produit BD ORTHO® V2 est une collection de mosaïques d'orthophotographies numériques en couleurs ou en Infra Rouge couleurs, rectifiées dans la projection adaptée au territoire couvert.
inspire-data-example.xmlIMAGE2000 product 1 individual orthorectified scenes. IMAGE2000 was
produced from ETM+ Landsat 7 satellite data and provides a consistent European coverage of individual
orthorectified scenes in national map projection systems. The year 2000 was targeted as reference year, but a
deviation of maximum 1-year was allowed to obtain a full coverage of Europe, which involves approximately 450
Landsat TM Frames. Where Landsat 7 data were not available, Landsat 5 data have been used instead. The spatial
resolution is 25 metres for multispectral and 12.5 metres for panchromatic imagery.
ISO-Coll_ESA-ERS_ORB_PRC_xS-I-en-formatted.xmlThe Precise RAnge and Range-Rate Equipment (PRARE) (more info here ) is a highly accurate microwave ranging system aboard the European Remote Sensing Satellites ERS-1 (more info here and here ) and ERS-2 (more info here and here ). The applications of PRARE are: * precise satellite orbit determination (e.g. of altimeter and geodynamic satellites) * earth gravity fieldrecovery * precise point positioning (tectonics) * earth rotationparameter determination and measurement of the ionospheric totalelectron content (TEC) From this collection you may order products of the following types: - ERS-1/2 Precise Orbit Product (ERS.ORB.PRC)
metadata-9.xmlLe chaînage est réalisé automatiquement sur les cours d'eau codés de la BDCarthage.
La méthode a été définie par le Groupe Information Géographique sur l'Eau (GIGE) du SIE.

Quand un chaînage à jour existe dans un bassin sur la version de Carthage en cours, celui-ci est
réutilisé.

Extracting the abstracts.
SELECT t.file_name, x.value
FROM meta AS t
JOIN xpath_meta AS x ON (t.pk_uid = x.pkid)
WHERE x.xpath_expr = '//gmd:MD_Keywords/gmd:keyword/gco:CharacterString/text()';
file_namevalue
AreasOfOutstandingNaturalBeauty.xmlProtected sites
AreasOfOutstandingNaturalBeauty.xmlenvironment
IGNF_BDCARTOr_2-5.xmlISO 19139 ; IGN-F
IGNF_BDCARTOr_2-5.xmlBDCARTO
......
inspire-data-example.xmlLand cover
ISO-Coll_ESA-ERS_ORB_PRC_xS-I-en-formatted.xmlexisting
ISO-Coll_ESA-ERS_ORB_PRC_xS-I-en-formatted.xmlGeology
ISO-Coll_ESA-ERS_ORB_PRC_xS-I-en-formatted.xmlLand cover
ISO-Coll_ESA-ERS_ORB_PRC_xS-I-en-formatted.xmlSpectral/Engineering
ISO-Coll_ESA-ERS_ORB_PRC_xS-I-en-formatted.xmlPlatform Characteristics
......
ISO-Coll_ESA-ERS_ORB_PRC_xS-I-en-formatted.xmlSatellite Orbits

Identifying the keyworks.
SELECT t.file_name, x.value
FROM meta AS t
JOIN xpath_meta AS x ON (t.pk_uid = x.pkid)
WHERE x.xpath_expr = '//gmd:MD_Constraints/gmd:useLimitation/gco:CharacterString/text()';
file_namevalue
AreasOfOutstandingNaturalBeauty.xmlUse limitation
IGNF_BDORTHOr_2-0.xmlBase de donnée soumise aux conditions générales d'utilisation des fichiers IGN
inspire-data-example.xmlno conditions apply
ISO-Coll_ESA-ERS_ORB_PRC_xS-I-en-formatted.xmlhttp://earth.esa.int/dataproducts/accessingeodata/

Querying legal restrictions or use limitations.
SELECT t.file_name, x.value
FROM meta AS t
JOIN xpath_meta AS x ON (t.pk_uid = x.pkid)
WHERE x.xpath_expr = '//gmd:spatialResolution/gmd:MD_Resolution/gmd:distance/gco:Distance/text()';
file_namevalue
AreasOfOutstandingNaturalBeauty.xml1
IGNF_BDCARTOr_2-5.xml15.00
IGNF_BDORTHOr_2-0.xml0.50
inspire-data-example.xml25.0

Inquirying the spatial resolution.

back to XmlBlob main page