Skip to content

Commit

Permalink
When preparing partial GFS, use Name element for feature match in cas…
Browse files Browse the repository at this point in the history
…e ElementPath element is not present in complete GFS
  • Loading branch information
fsteggink committed Oct 22, 2018
1 parent 463ae06 commit a400087
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions stetlcomponents/gfspreparationfilter.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,22 @@ class GfsPreparationFilter(Filter):
<xsl:apply-templates select="@* | node()" />
</xsl:copy>
</xsl:if>
<xsl:if test="not(ElementPath) and Name/text()='%s'">
<xsl:copy>
<xsl:apply-templates select="@* | node()" />
</xsl:copy>
</xsl:if>
"""

TEST_FEATURECOUNT = """
<xsl:if test="../ElementPath/text()='%s'">
<!-- Add feature count -->
<FeatureCount>%d</FeatureCount>
</xsl:if>
<xsl:if test="not(../ElementPath) and ../Name/text()='%s'">
<!-- Add feature count -->
<FeatureCount>%d</FeatureCount>
</xsl:if>
"""

# Start attribute config meta
Expand Down Expand Up @@ -160,8 +169,8 @@ def parse_ogrinfo_output(self, output_ogrinfo):
return feature_counts

def prepare_xslt_template(self, feature_counts):
elemtypes = [self.TEST_ELEMTYPE % key for key in feature_counts.iterkeys()]
featurecounts = [self.TEST_FEATURECOUNT % item for item in feature_counts.iteritems()]
elemtypes = [self.TEST_ELEMTYPE % (key, key) for key in feature_counts.iterkeys()]
featurecounts = [self.TEST_FEATURECOUNT % (key, value, key, value) for key, value in feature_counts.iteritems()]

subst_dict = {}
subst_dict['elemtypes'] = ''.join(elemtypes)
Expand Down

0 comments on commit a400087

Please sign in to comment.