-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#35 provide code + example + doc for Output Splitting
- Loading branch information
Showing
16 changed files
with
975 additions
and
579 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
Transform plain XML cities XML to valid GML. | ||
Author: Just van den Broecke, Just Objects B.V. | ||
--> | ||
<xsl:stylesheet version="1.0" | ||
xmlns:ogr="http://ogr.maptools.org/" | ||
xmlns:gml="http://www.opengis.net/gml" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" | ||
> | ||
<xsl:output method="xml" omit-xml-declaration="no" indent="yes"/> | ||
<xsl:strip-space elements="*"/> | ||
|
||
<xsl:template match="/"> | ||
<ogr:FeatureCollection | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xmlns:ogr="http://ogr.maptools.org/" | ||
xmlns:gml="http://www.opengis.net/gml" | ||
xsi:schemaLocation="http://ogr.maptools.org/ ../gmlcities.xsd http://www.opengis.net/gml http://schemas.opengis.net/gml/2.1.2/feature.xsd" | ||
> | ||
<gml:boundedBy> | ||
<gml:Box> | ||
<gml:coord><gml:X>-180.0</gml:X><gml:Y>-90.0</gml:Y></gml:coord> | ||
<gml:coord><gml:X>180.0</gml:X><gml:Y>90.0</gml:Y></gml:coord> | ||
</gml:Box> | ||
</gml:boundedBy> | ||
<!-- Loop through all cities. --> | ||
<xsl:apply-templates/> | ||
</ogr:FeatureCollection> | ||
</xsl:template> | ||
|
||
<!-- Make each city an ogr:featureMember. --> | ||
<xsl:template match="city"> | ||
<gml:featureMember> | ||
<ogr:City> | ||
<ogr:name> | ||
<xsl:value-of select="name"/> | ||
</ogr:name> | ||
<ogr:geometry> | ||
<gml:Point srsName="urn:ogc:def:crs:EPSG:4326"> | ||
<gml:coordinates><xsl:value-of select="lat"/>,<xsl:value-of select="lon"/></gml:coordinates> | ||
</gml:Point> | ||
</ogr:geometry> | ||
</ogr:City> | ||
</gml:featureMember> | ||
</xsl:template> | ||
</xsl:stylesheet> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Transform input xml to valid GML file using an XSLT filter and pass to multiple outputs. | ||
|
||
[etl] | ||
chains = input_xml_file|transformer_xslt |output_file + output_std | ||
|
||
[input_xml_file] | ||
class = inputs.fileinput.XmlFileInput | ||
file_path = input/cities.xml | ||
|
||
[transformer_xslt] | ||
class = filters.xsltfilter.XsltFilter | ||
script = cities2gml.xsl | ||
|
||
[output_file] | ||
class = outputs.fileoutput.FileOutput | ||
file_path = output/gmlcities.gml | ||
|
||
[output_std] | ||
class = outputs.standardoutput.StandardOutput |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/bin/sh | ||
# | ||
# Shortcut to call Stetl main.py with etl config. | ||
# | ||
# Author: Just van den Broecke | ||
# | ||
stetl -c etl.cfg | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<xs:schema targetNamespace="http://ogr.maptools.org/" xmlns:ogr="http://ogr.maptools.org/" | ||
xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:gml="http://www.opengis.net/gml" | ||
elementFormDefault="qualified" version="1.0"> | ||
<xs:import namespace="http://www.opengis.net/gml" | ||
schemaLocation="http://schemas.opengis.net/gml/2.1.2/feature.xsd"/> | ||
<xs:element name="FeatureCollection" type="ogr:FeatureCollectionType" substitutionGroup="gml:_FeatureCollection"/> | ||
<xs:complexType name="FeatureCollectionType"> | ||
<xs:complexContent> | ||
<xs:extension base="gml:AbstractFeatureCollectionType"> | ||
<xs:attribute name="lockId" type="xs:string" use="optional"/> | ||
<xs:attribute name="scope" type="xs:string" use="optional"/> | ||
</xs:extension> | ||
</xs:complexContent> | ||
</xs:complexType> | ||
<xs:element name="City" type="ogr:City_Type" substitutionGroup="gml:_Feature"/> | ||
<xs:complexType name="City_Type"> | ||
<xs:complexContent> | ||
<xs:extension base="gml:AbstractFeatureType"> | ||
<xs:sequence> | ||
<xs:element name="name" nillable="false" minOccurs="1" maxOccurs="1"> | ||
<xs:simpleType> | ||
<xs:restriction base="xs:string"> | ||
<xs:maxLength value="42"/> | ||
</xs:restriction> | ||
</xs:simpleType> | ||
</xs:element> | ||
<xs:element name="geometry" type="gml:PointPropertyType" nillable="false" minOccurs="1" maxOccurs="1"/> | ||
</xs:sequence> | ||
</xs:extension> | ||
</xs:complexContent> | ||
</xs:complexType> | ||
</xs:schema> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?xml version='1.0' encoding='utf-8'?> | ||
<cities> | ||
<city> | ||
<name>Amsterdam</name> | ||
<lat>52.4</lat> | ||
<lon>4.9</lon> | ||
</city> | ||
<city> | ||
<name>Bonn</name> | ||
<lat>50.7</lat> | ||
<lon>7.1</lon> | ||
</city> | ||
<city> | ||
<name>Rome</name> | ||
<lat>41.9</lat> | ||
<lon>12.5</lon> | ||
</city> | ||
</cities> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?xml version='1.0' encoding='utf-8'?> | ||
<ogr:FeatureCollection xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ogr="http://ogr.maptools.org/" xmlns:gml="http://www.opengis.net/gml" xsi:schemaLocation="http://ogr.maptools.org/ ../gmlcities.xsd http://www.opengis.net/gml http://schemas.opengis.net/gml/2.1.2/feature.xsd"> | ||
<gml:boundedBy> | ||
<gml:Box> | ||
<gml:coord> | ||
<gml:X>-180.0</gml:X> | ||
<gml:Y>-90.0</gml:Y> | ||
</gml:coord> | ||
<gml:coord> | ||
<gml:X>180.0</gml:X> | ||
<gml:Y>90.0</gml:Y> | ||
</gml:coord> | ||
</gml:Box> | ||
</gml:boundedBy> | ||
<gml:featureMember> | ||
<ogr:City> | ||
<ogr:name>Amsterdam</ogr:name> | ||
<ogr:geometry> | ||
<gml:Point srsName="urn:ogc:def:crs:EPSG:4326"> | ||
<gml:coordinates>52.4,4.9</gml:coordinates> | ||
</gml:Point> | ||
</ogr:geometry> | ||
</ogr:City> | ||
</gml:featureMember> | ||
<gml:featureMember> | ||
<ogr:City> | ||
<ogr:name>Bonn</ogr:name> | ||
<ogr:geometry> | ||
<gml:Point srsName="urn:ogc:def:crs:EPSG:4326"> | ||
<gml:coordinates>50.7,7.1</gml:coordinates> | ||
</gml:Point> | ||
</ogr:geometry> | ||
</ogr:City> | ||
</gml:featureMember> | ||
<gml:featureMember> | ||
<ogr:City> | ||
<ogr:name>Rome</ogr:name> | ||
<ogr:geometry> | ||
<gml:Point srsName="urn:ogc:def:crs:EPSG:4326"> | ||
<gml:coordinates>41.9,12.5</gml:coordinates> | ||
</gml:Point> | ||
</ogr:geometry> | ||
</ogr:City> | ||
</gml:featureMember> | ||
</ogr:FeatureCollection> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.