Skip to content
Permalink
Browse files

Unit tests for reomve duplicates by attribute

  • Loading branch information
nyalldawson committed Oct 31, 2018
1 parent 4e9da6f commit 4dd3e211e2d7a36cacde03c7e7e06c5ed5560f5d
@@ -0,0 +1,68 @@
<?xml version="1.0" encoding="utf-8" ?>
<ogr:FeatureCollection
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://ogr.maptools.org/ duplicate_attributes.xsd"
xmlns:ogr="http://ogr.maptools.org/"
xmlns:gml="http://www.opengis.net/gml">
<gml:boundedBy>
<gml:Box>
<gml:coord><gml:X>-18</gml:X><gml:Y>-14</gml:Y></gml:coord>
<gml:coord><gml:X>-16</gml:X><gml:Y>-12</gml:Y></gml:coord>
</gml:Box>
</gml:boundedBy>

<gml:featureMember>
<ogr:duplicate_attributes fid="duplicate_attributes.0">
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>-18,-12</gml:coordinates></gml:Point></ogr:geometryProperty>
<ogr:num_field1>1</ogr:num_field1>
<ogr:num_field2 xsi:nil="true"/>
<ogr:text_field>val1</ogr:text_field>
<ogr:text_field2>val2</ogr:text_field2>
</ogr:duplicate_attributes>
</gml:featureMember>
<gml:featureMember>
<ogr:duplicate_attributes fid="duplicate_attributes.1">
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>-17,-12</gml:coordinates></gml:Point></ogr:geometryProperty>
<ogr:num_field1 xsi:nil="true"/>
<ogr:num_field2>2</ogr:num_field2>
<ogr:text_field>val1</ogr:text_field>
<ogr:text_field2 xsi:nil="true"/>
</ogr:duplicate_attributes>
</gml:featureMember>
<gml:featureMember>
<ogr:duplicate_attributes fid="duplicate_attributes.2">
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>-17,-13</gml:coordinates></gml:Point></ogr:geometryProperty>
<ogr:num_field1>3</ogr:num_field1>
<ogr:num_field2>1</ogr:num_field2>
<ogr:text_field>val2</ogr:text_field>
<ogr:text_field2>val1</ogr:text_field2>
</ogr:duplicate_attributes>
</gml:featureMember>
<gml:featureMember>
<ogr:duplicate_attributes fid="duplicate_attributes.3">
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>-17,-14</gml:coordinates></gml:Point></ogr:geometryProperty>
<ogr:num_field1>99</ogr:num_field1>
<ogr:num_field2>2</ogr:num_field2>
<ogr:text_field>val2</ogr:text_field>
<ogr:text_field2>1</ogr:text_field2>
</ogr:duplicate_attributes>
</gml:featureMember>
<gml:featureMember>
<ogr:duplicate_attributes fid="duplicate_attributes.4">
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>-18,-13</gml:coordinates></gml:Point></ogr:geometryProperty>
<ogr:num_field1>99</ogr:num_field1>
<ogr:num_field2>2</ogr:num_field2>
<ogr:text_field>val2</ogr:text_field>
<ogr:text_field2>1</ogr:text_field2>
</ogr:duplicate_attributes>
</gml:featureMember>
<gml:featureMember>
<ogr:duplicate_attributes fid="duplicate_attributes.5">
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>-16,-14</gml:coordinates></gml:Point></ogr:geometryProperty>
<ogr:num_field1>7</ogr:num_field1>
<ogr:num_field2>2</ogr:num_field2>
<ogr:text_field>VAL1</ogr:text_field>
<ogr:text_field2>VAL2</ogr:text_field2>
</ogr:duplicate_attributes>
</gml:featureMember>
</ogr:FeatureCollection>
@@ -0,0 +1,51 @@
<?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="duplicate_attributes" type="ogr:duplicate_attributes_Type" substitutionGroup="gml:_Feature"/>
<xs:complexType name="duplicate_attributes_Type">
<xs:complexContent>
<xs:extension base="gml:AbstractFeatureType">
<xs:sequence>
<xs:element name="geometryProperty" type="gml:PointPropertyType" nillable="true" minOccurs="0" maxOccurs="1"/>
<xs:element name="num_field1" nillable="true" minOccurs="0" maxOccurs="1">
<xs:simpleType>
<xs:restriction base="xs:integer">
<xs:totalDigits value="10"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="num_field2" nillable="true" minOccurs="0" maxOccurs="1">
<xs:simpleType>
<xs:restriction base="xs:integer">
<xs:totalDigits value="10"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="text_field" nillable="true" minOccurs="0" maxOccurs="1">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="30"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="text_field2" nillable="true" minOccurs="0" maxOccurs="1">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="30"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
</xs:schema>
@@ -0,0 +1,59 @@
<?xml version="1.0" encoding="utf-8" ?>
<ogr:FeatureCollection
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://ogr.maptools.org/ remove_duplicates1.xsd"
xmlns:ogr="http://ogr.maptools.org/"
xmlns:gml="http://www.opengis.net/gml">
<gml:boundedBy>
<gml:Box>
<gml:coord><gml:X>-18</gml:X><gml:Y>-14</gml:Y></gml:coord>
<gml:coord><gml:X>-16</gml:X><gml:Y>-12</gml:Y></gml:coord>
</gml:Box>
</gml:boundedBy>

<gml:featureMember>
<ogr:remove_duplicates1 fid="duplicate_attributes.0">
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>-18,-12</gml:coordinates></gml:Point></ogr:geometryProperty>
<ogr:num_field1>1</ogr:num_field1>
<ogr:num_field2 xsi:nil="true"/>
<ogr:text_field>val1</ogr:text_field>
<ogr:text_field2>val2</ogr:text_field2>
</ogr:remove_duplicates1>
</gml:featureMember>
<gml:featureMember>
<ogr:remove_duplicates1 fid="duplicate_attributes.1">
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>-17,-12</gml:coordinates></gml:Point></ogr:geometryProperty>
<ogr:num_field1 xsi:nil="true"/>
<ogr:num_field2>2</ogr:num_field2>
<ogr:text_field>val1</ogr:text_field>
<ogr:text_field2 xsi:nil="true"/>
</ogr:remove_duplicates1>
</gml:featureMember>
<gml:featureMember>
<ogr:remove_duplicates1 fid="duplicate_attributes.2">
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>-17,-13</gml:coordinates></gml:Point></ogr:geometryProperty>
<ogr:num_field1>3</ogr:num_field1>
<ogr:num_field2>1</ogr:num_field2>
<ogr:text_field>val2</ogr:text_field>
<ogr:text_field2>val1</ogr:text_field2>
</ogr:remove_duplicates1>
</gml:featureMember>
<gml:featureMember>
<ogr:remove_duplicates1 fid="duplicate_attributes.3">
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>-17,-14</gml:coordinates></gml:Point></ogr:geometryProperty>
<ogr:num_field1>99</ogr:num_field1>
<ogr:num_field2>2</ogr:num_field2>
<ogr:text_field>val2</ogr:text_field>
<ogr:text_field2>1</ogr:text_field2>
</ogr:remove_duplicates1>
</gml:featureMember>
<gml:featureMember>
<ogr:remove_duplicates1 fid="duplicate_attributes.5">
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>-16,-14</gml:coordinates></gml:Point></ogr:geometryProperty>
<ogr:num_field1>7</ogr:num_field1>
<ogr:num_field2>2</ogr:num_field2>
<ogr:text_field>VAL1</ogr:text_field>
<ogr:text_field2>VAL2</ogr:text_field2>
</ogr:remove_duplicates1>
</gml:featureMember>
</ogr:FeatureCollection>
@@ -0,0 +1,51 @@
<?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="remove_duplicates1" type="ogr:remove_duplicates1_Type" substitutionGroup="gml:_Feature"/>
<xs:complexType name="remove_duplicates1_Type">
<xs:complexContent>
<xs:extension base="gml:AbstractFeatureType">
<xs:sequence>
<xs:element name="geometryProperty" type="gml:PointPropertyType" nillable="true" minOccurs="0" maxOccurs="1"/>
<xs:element name="num_field1" nillable="true" minOccurs="0" maxOccurs="1">
<xs:simpleType>
<xs:restriction base="xs:integer">
<xs:totalDigits value="10"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="num_field2" nillable="true" minOccurs="0" maxOccurs="1">
<xs:simpleType>
<xs:restriction base="xs:integer">
<xs:totalDigits value="10"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="text_field" nillable="true" minOccurs="0" maxOccurs="1">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="30"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="text_field2" nillable="true" minOccurs="0" maxOccurs="1">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="30"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
</xs:schema>
@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="utf-8" ?>
<ogr:FeatureCollection
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://ogr.maptools.org/ remove_duplicates2.xsd"
xmlns:ogr="http://ogr.maptools.org/"
xmlns:gml="http://www.opengis.net/gml">
<gml:boundedBy>
<gml:Box>
<gml:coord><gml:X>-18</gml:X><gml:Y>-13</gml:Y></gml:coord>
<gml:coord><gml:X>-17</gml:X><gml:Y>-12</gml:Y></gml:coord>
</gml:Box>
</gml:boundedBy>

<gml:featureMember>
<ogr:remove_duplicates2 fid="duplicate_attributes.0">
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>-18,-12</gml:coordinates></gml:Point></ogr:geometryProperty>
<ogr:num_field1>1</ogr:num_field1>
<ogr:num_field2 xsi:nil="true"/>
<ogr:text_field>val1</ogr:text_field>
<ogr:text_field2>val2</ogr:text_field2>
</ogr:remove_duplicates2>
</gml:featureMember>
<gml:featureMember>
<ogr:remove_duplicates2 fid="duplicate_attributes.1">
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>-17,-12</gml:coordinates></gml:Point></ogr:geometryProperty>
<ogr:num_field1 xsi:nil="true"/>
<ogr:num_field2>2</ogr:num_field2>
<ogr:text_field>val1</ogr:text_field>
<ogr:text_field2 xsi:nil="true"/>
</ogr:remove_duplicates2>
</gml:featureMember>
<gml:featureMember>
<ogr:remove_duplicates2 fid="duplicate_attributes.2">
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>-17,-13</gml:coordinates></gml:Point></ogr:geometryProperty>
<ogr:num_field1>3</ogr:num_field1>
<ogr:num_field2>1</ogr:num_field2>
<ogr:text_field>val2</ogr:text_field>
<ogr:text_field2>val1</ogr:text_field2>
</ogr:remove_duplicates2>
</gml:featureMember>
</ogr:FeatureCollection>
@@ -0,0 +1,51 @@
<?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="remove_duplicates2" type="ogr:remove_duplicates2_Type" substitutionGroup="gml:_Feature"/>
<xs:complexType name="remove_duplicates2_Type">
<xs:complexContent>
<xs:extension base="gml:AbstractFeatureType">
<xs:sequence>
<xs:element name="geometryProperty" type="gml:PointPropertyType" nillable="true" minOccurs="0" maxOccurs="1"/>
<xs:element name="num_field1" nillable="true" minOccurs="0" maxOccurs="1">
<xs:simpleType>
<xs:restriction base="xs:integer">
<xs:totalDigits value="10"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="num_field2" nillable="true" minOccurs="0" maxOccurs="1">
<xs:simpleType>
<xs:restriction base="xs:integer">
<xs:totalDigits value="10"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="text_field" nillable="true" minOccurs="0" maxOccurs="1">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="30"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="text_field2" nillable="true" minOccurs="0" maxOccurs="1">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="30"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
</xs:schema>
@@ -0,0 +1,59 @@
<?xml version="1.0" encoding="utf-8" ?>
<ogr:FeatureCollection
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://ogr.maptools.org/ remove_duplicates3.xsd"
xmlns:ogr="http://ogr.maptools.org/"
xmlns:gml="http://www.opengis.net/gml">
<gml:boundedBy>
<gml:Box>
<gml:coord><gml:X>-18</gml:X><gml:Y>-14</gml:Y></gml:coord>
<gml:coord><gml:X>-16</gml:X><gml:Y>-12</gml:Y></gml:coord>
</gml:Box>
</gml:boundedBy>

<gml:featureMember>
<ogr:remove_duplicates3 fid="duplicate_attributes.0">
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>-18,-12</gml:coordinates></gml:Point></ogr:geometryProperty>
<ogr:num_field1>1</ogr:num_field1>
<ogr:num_field2 xsi:nil="true"/>
<ogr:text_field>val1</ogr:text_field>
<ogr:text_field2>val2</ogr:text_field2>
</ogr:remove_duplicates3>
</gml:featureMember>
<gml:featureMember>
<ogr:remove_duplicates3 fid="duplicate_attributes.1">
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>-17,-12</gml:coordinates></gml:Point></ogr:geometryProperty>
<ogr:num_field1 xsi:nil="true"/>
<ogr:num_field2>2</ogr:num_field2>
<ogr:text_field>val1</ogr:text_field>
<ogr:text_field2 xsi:nil="true"/>
</ogr:remove_duplicates3>
</gml:featureMember>
<gml:featureMember>
<ogr:remove_duplicates3 fid="duplicate_attributes.2">
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>-17,-13</gml:coordinates></gml:Point></ogr:geometryProperty>
<ogr:num_field1>3</ogr:num_field1>
<ogr:num_field2>1</ogr:num_field2>
<ogr:text_field>val2</ogr:text_field>
<ogr:text_field2>val1</ogr:text_field2>
</ogr:remove_duplicates3>
</gml:featureMember>
<gml:featureMember>
<ogr:remove_duplicates3 fid="duplicate_attributes.3">
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>-17,-14</gml:coordinates></gml:Point></ogr:geometryProperty>
<ogr:num_field1>99</ogr:num_field1>
<ogr:num_field2>2</ogr:num_field2>
<ogr:text_field>val2</ogr:text_field>
<ogr:text_field2>1</ogr:text_field2>
</ogr:remove_duplicates3>
</gml:featureMember>
<gml:featureMember>
<ogr:remove_duplicates3 fid="duplicate_attributes.5">
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>-16,-14</gml:coordinates></gml:Point></ogr:geometryProperty>
<ogr:num_field1>7</ogr:num_field1>
<ogr:num_field2>2</ogr:num_field2>
<ogr:text_field>VAL1</ogr:text_field>
<ogr:text_field2>VAL2</ogr:text_field2>
</ogr:remove_duplicates3>
</gml:featureMember>
</ogr:FeatureCollection>

0 comments on commit 4dd3e21

Please sign in to comment.
You can’t perform that action at this time.