[FEATURE] Reworked processing 'Join by location' alg

Improvements:
- transparently handle different source/join CRS
- added option to create output feature for EVERY joined
feature (i.e. 1 to many type join)
- added option to select joined fields to take
- optimised performance of algorithm

The previous option to create a summary of joined features has been
removed, and will be moved to a separate 'Join by location (summary)'
algorithm.
This commit is contained in:
Nyall Dawson 2017-09-13 08:01:56 +10:00
parent 5614df4b6e
commit 458e994d39
15 changed files with 1037 additions and 173 deletions

View File

@ -150,6 +150,7 @@ from .Smooth import Smooth
from .SnapGeometries import SnapGeometriesToLayer
from .SpatialiteExecuteSQL import SpatialiteExecuteSQL
from .SpatialIndex import SpatialIndex
from .SpatialJoin import SpatialJoin
from .SplitWithLines import SplitWithLines
from .StatisticsByCategories import StatisticsByCategories
from .SumLines import SumLines
@ -166,7 +167,6 @@ from .VectorSplit import VectorSplit
from .VoronoiPolygons import VoronoiPolygons
from .ZonalStatistics import ZonalStatistics
# from .SpatialJoin import SpatialJoin
pluginPath = os.path.normpath(os.path.join(
os.path.split(os.path.dirname(__file__))[0], os.pardir))
@ -180,9 +180,6 @@ class QGISAlgorithmProvider(QgsProcessingProvider):
self.externalAlgs = []
def getAlgs(self):
# algs = [
# SpatialJoin(),
# ]
algs = [AddTableField(),
Aggregate(),
Aspect(),
@ -293,6 +290,7 @@ class QGISAlgorithmProvider(QgsProcessingProvider):
SnapGeometriesToLayer(),
SpatialiteExecuteSQL(),
SpatialIndex(),
SpatialJoin(),
SplitWithLines(),
StatisticsByCategories(),
SumLines(),

View File

@ -31,28 +31,31 @@ __revision__ = '$Format:%H$'
import os
from qgis.PyQt.QtGui import QIcon
from qgis.PyQt.QtCore import QVariant
from qgis.core import QgsFields, QgsField, QgsFeatureSink, QgsFeature, QgsGeometry, NULL, QgsWkbTypes, QgsProcessingUtils
from qgis.core import (QgsFields,
QgsFeatureSink,
QgsFeatureRequest,
QgsGeometry,
QgsProcessing,
QgsProcessingParameterBoolean,
QgsProcessingParameterFeatureSource,
QgsProcessingParameterEnum,
QgsProcessingParameterField,
QgsProcessingParameterFeatureSink)
from processing.algs.qgis.QgisAlgorithm import QgisAlgorithm
from processing.core.parameters import ParameterVector
from processing.core.parameters import ParameterNumber
from processing.core.parameters import ParameterSelection
from processing.core.parameters import ParameterString
from processing.core.outputs import OutputVector
from processing.tools import vector
pluginPath = os.path.split(os.path.split(os.path.dirname(__file__))[0])[0]
class SpatialJoin(QgisAlgorithm):
TARGET = "TARGET"
INPUT = "INPUT"
JOIN = "JOIN"
PREDICATE = "PREDICATE"
SUMMARY = "SUMMARY"
STATS = "STATS"
KEEP = "KEEP"
JOIN_FIELDS = "JOIN_FIELDS"
METHOD = "METHOD"
DISCARD_NONMATCHING = "DISCARD_NONMATCHING"
OUTPUT = "OUTPUT"
def icon(self):
@ -74,32 +77,40 @@ class SpatialJoin(QgisAlgorithm):
('within', self.tr('within')),
('crosses', self.tr('crosses')))
self.summarys = [
self.tr('Take attributes of the first located feature'),
self.tr('Take summary of intersecting features')
self.reversed_predicates = {'intersects': 'intersects',
'contains': 'within',
'isEqual': 'isEqual',
'touches': 'touches',
'overlaps': 'overlaps',
'within': 'contains',
'crosses': 'crosses'}
self.methods = [
self.tr('Create separate feature for each located feature'),
self.tr('Take attributes of the first located feature only')
]
self.keeps = [
self.tr('Only keep matching records'),
self.tr('Keep all records (including non-matching target records)')
]
self.addParameter(ParameterVector(self.TARGET,
self.tr('Target vector layer')))
self.addParameter(ParameterVector(self.JOIN,
self.tr('Join vector layer')))
self.addParameter(ParameterSelection(self.PREDICATE,
self.tr('Geometric predicate'),
self.predicates,
multiple=True))
self.addParameter(ParameterSelection(self.SUMMARY,
self.tr('Attribute summary'), self.summarys))
self.addParameter(ParameterString(self.STATS,
self.tr('Statistics for summary (comma separated)'),
'sum,mean,min,max,median', optional=True))
self.addParameter(ParameterSelection(self.KEEP,
self.tr('Joined table'), self.keeps))
self.addOutput(OutputVector(self.OUTPUT, self.tr('Joined layer')))
self.addParameter(QgsProcessingParameterFeatureSource(self.INPUT,
self.tr('Input layer'),
[QgsProcessing.TypeVectorAnyGeometry]))
self.addParameter(QgsProcessingParameterFeatureSource(self.JOIN,
self.tr('Join layer'),
[QgsProcessing.TypeVectorAnyGeometry]))
self.addParameter(QgsProcessingParameterEnum(self.PREDICATE,
self.tr('Geometric predicate'),
options=[p[1] for p in self.predicates],
allowMultiple=True, defaultValue=[0]))
self.addParameter(QgsProcessingParameterField(self.JOIN_FIELDS,
self.tr('Fields to add (leave empty to use all fields)'),
parentLayerParameterName=self.JOIN,
allowMultiple=True, optional=True))
self.addParameter(QgsProcessingParameterEnum(self.METHOD,
self.tr('Join type'), self.methods))
self.addParameter(QgsProcessingParameterBoolean(self.DISCARD_NONMATCHING,
self.tr('Discard records which could not be joined'),
defaultValue=False))
self.addParameter(QgsProcessingParameterFeatureSink(self.OUTPUT,
self.tr('Joined layer')))
def name(self):
return 'joinattributesbylocation'
@ -107,155 +118,97 @@ class SpatialJoin(QgisAlgorithm):
def displayName(self):
return self.tr('Join attributes by location')
def tags(self):
return self.tr("join,intersects,intersecting,touching,within,contains,overlaps,relation,spatial").split(',')
def processAlgorithm(self, parameters, context, feedback):
target = QgsProcessingUtils.mapLayerFromString(self.getParameterValue(self.TARGET), context)
join = QgsProcessingUtils.mapLayerFromString(self.getParameterValue(self.JOIN), context)
predicates = self.getParameterValue(self.PREDICATE)
source = self.parameterAsSource(parameters, self.INPUT, context)
join_source = self.parameterAsSource(parameters, self.JOIN, context)
join_fields = self.parameterAsFields(parameters, self.JOIN_FIELDS, context)
method = self.parameterAsEnum(parameters, self.METHOD, context)
discard_nomatch = self.parameterAsBool(parameters, self.DISCARD_NONMATCHING, context)
summary = self.getParameterValue(self.SUMMARY) == 1
keep = self.getParameterValue(self.KEEP) == 1
sumList = self.getParameterValue(self.STATS).lower().split(',')
targetFields = target.fields()
joinFields = join.fields()
fieldList = QgsFields()
if not summary:
joinFields = vector.testForUniqueness(targetFields, joinFields)
seq = list(range(len(targetFields) + len(joinFields)))
targetFields.extend(joinFields)
targetFields = dict(list(zip(seq, targetFields)))
source_fields = source.fields()
fields_to_join = QgsFields()
join_field_indexes = []
if not join_fields:
fields_to_join = join_source.fields()
join_field_indexes = [i for i in range(len(fields_to_join))]
else:
numFields = {}
for j in range(len(joinFields)):
if joinFields[j].type() in [QVariant.Int, QVariant.Double, QVariant.LongLong, QVariant.UInt, QVariant.ULongLong]:
numFields[j] = []
for i in sumList:
field = QgsField(i + str(joinFields[j].name()), QVariant.Double, '', 24, 16)
fieldList.append(field)
field = QgsField('count', QVariant.Double, '', 24, 16)
fieldList.append(field)
joinFields = vector.testForUniqueness(targetFields, fieldList)
targetFields.extend(fieldList)
seq = list(range(len(targetFields)))
targetFields = dict(list(zip(seq, targetFields)))
for f in join_fields:
idx = join_source.fields().lookupField(f)
join_field_indexes.append(idx)
if idx >= 0:
fields_to_join.append(join_source.fields().at(idx))
fields = QgsFields()
for f in list(targetFields.values()):
fields.append(f)
out_fields = vector.combineFields(source_fields, fields_to_join)
writer = self.getOutputFromName(self.OUTPUT).getVectorWriter(fields, target.wkbType(), target.crs(), context)
(sink, dest_id) = self.parameterAsSink(parameters, self.OUTPUT, context,
out_fields, source.wkbType(), source.sourceCrs())
outFeat = QgsFeature()
inFeatB = QgsFeature()
inGeom = QgsGeometry()
# do the join
index = QgsProcessingUtils.createSpatialIndex(join, context)
# build a list of 'reversed' predicates, because in this function
# we actually test the reverse of what the user wants (allowing us
# to prepare geometries and optimise the algorithm)
predicates = [self.reversed_predicates[self.predicates[i][0]] for i in
self.parameterAsEnums(parameters, self.PREDICATE, context)]
mapP2 = dict()
features = QgsProcessingUtils.getFeatures(join, context)
for f in features:
mapP2[f.id()] = QgsFeature(f)
remaining = set()
if not discard_nomatch:
remaining = set(source.allFeatureIds())
features = QgsProcessingUtils.getFeatures(target, context)
total = 100.0 / target.featureCount() if target.featureCount() else 0
for c, f in enumerate(features):
atMap1 = f.attributes()
outFeat.setGeometry(f.geometry())
inGeom = f.geometry()
none = True
joinList = []
if inGeom.type() == QgsWkbTypes.PointGeometry:
bbox = inGeom.buffer(10, 2).boundingBox()
else:
bbox = inGeom.boundingBox()
joinList = index.intersects(bbox)
if len(joinList) > 0:
count = 0
for i in joinList:
inFeatB = mapP2[i]
inGeomB = inFeatB.geometry()
added_set = set()
res = False
for predicate in predicates:
res = getattr(inGeom, predicate)(inGeomB)
if res:
break
request = QgsFeatureRequest().setSubsetOfAttributes(join_field_indexes).setDestinationCrs(source.sourceCrs())
features = join_source.getFeatures(request)
total = 100.0 / join_source.featureCount() if join_source.featureCount() else 0
if res:
count = count + 1
none = False
atMap2 = inFeatB.attributes()
if not summary:
atMap = atMap1
atMap2 = atMap2
atMap.extend(atMap2)
atMap = dict(list(zip(seq, atMap)))
break
else:
for j in list(numFields.keys()):
numFields[j].append(atMap2[j])
for current, f in enumerate(features):
if feedback.isCanceled():
break
if summary and not none:
atMap = atMap1
for j in list(numFields.keys()):
for k in sumList:
if k == 'sum':
atMap.append(sum(self._filterNull(numFields[j])))
elif k == 'mean':
try:
nn_count = sum(1 for _ in self._filterNull(numFields[j]))
atMap.append(sum(self._filterNull(numFields[j])) / nn_count)
except ZeroDivisionError:
atMap.append(NULL)
elif k == 'min':
try:
atMap.append(min(self._filterNull(numFields[j])))
except ValueError:
atMap.append(NULL)
elif k == 'median':
atMap.append(self._median(numFields[j]))
else:
try:
atMap.append(max(self._filterNull(numFields[j])))
except ValueError:
atMap.append(NULL)
if not f.hasGeometry():
continue
numFields[j] = []
atMap.append(count)
atMap = dict(list(zip(seq, atMap)))
if none:
outFeat.setAttributes(atMap1)
else:
outFeat.setAttributes(list(atMap.values()))
bbox = f.geometry().boundingBox()
engine = None
if keep:
writer.addFeature(outFeat, QgsFeatureSink.FastInsert)
else:
if not none:
writer.addFeature(outFeat, QgsFeatureSink.FastInsert)
request = QgsFeatureRequest().setFilterRect(bbox)
for test_feat in source.getFeatures(request):
if feedback.isCanceled():
break
if method == 1 and test_feat.id() in added_set:
# already added this feature, and user has opted to only output first match
continue
feedback.setProgress(int(c * total))
del writer
join_attributes = []
for a in join_field_indexes:
join_attributes.append(f.attributes()[a])
def _filterNull(self, values):
"""Takes an iterator of values and returns a new iterator
returning the same values but skipping any NULL values"""
return (v for v in values if v != NULL)
if engine is None:
engine = QgsGeometry.createGeometryEngine(f.geometry().geometry())
engine.prepareGeometry()
def _median(self, data):
count = len(data)
if count == 1:
return data[0]
data.sort()
for predicate in predicates:
if getattr(engine, predicate)(test_feat.geometry().geometry()):
added_set.add(test_feat.id())
median = 0
if count > 1:
if (count % 2) == 0:
median = 0.5 * ((data[count / 2 - 1]) + (data[count / 2]))
else:
median = data[(count + 1) / 2 - 1]
# join attributes and add
attributes = test_feat.attributes()
attributes.extend(join_attributes)
output_feature = test_feat
output_feature.setAttributes(attributes)
sink.addFeature(output_feature, QgsFeatureSink.FastInsert)
break
return median
feedback.setProgress(int(current * total))
if not discard_nomatch:
remaining = remaining.difference(added_set)
for f in source.getFeatures(QgsFeatureRequest().setFilterFids(list(remaining))):
if feedback.isCanceled():
break
sink.addFeature(f, QgsFeatureSink.FastInsert)
return {self.OUTPUT: dest_id}

View File

@ -0,0 +1,48 @@
<GMLFeatureClassList>
<GMLFeatureClass>
<Name>join_by_location_intersect</Name>
<ElementPath>join_by_location_intersect</ElementPath>
<!--POLYGON-->
<GeometryType>3</GeometryType>
<SRSName>EPSG:4326</SRSName>
<DatasetSpecificInfo>
<FeatureCount>10</FeatureCount>
<ExtentXMin>-1.00000</ExtentXMin>
<ExtentXMax>10.00000</ExtentXMax>
<ExtentYMin>-3.00000</ExtentYMin>
<ExtentYMax>6.00000</ExtentYMax>
</DatasetSpecificInfo>
<PropertyDefn>
<Name>name</Name>
<ElementPath>name</ElementPath>
<Type>String</Type>
<Width>5</Width>
</PropertyDefn>
<PropertyDefn>
<Name>intval</Name>
<ElementPath>intval</ElementPath>
<Type>Integer</Type>
</PropertyDefn>
<PropertyDefn>
<Name>floatval</Name>
<ElementPath>floatval</ElementPath>
<Type>Real</Type>
</PropertyDefn>
<PropertyDefn>
<Name>fid_2</Name>
<ElementPath>fid_2</ElementPath>
<Type>String</Type>
<Width>8</Width>
</PropertyDefn>
<PropertyDefn>
<Name>id</Name>
<ElementPath>id</ElementPath>
<Type>Integer</Type>
</PropertyDefn>
<PropertyDefn>
<Name>id2</Name>
<ElementPath>id2</ElementPath>
<Type>Integer</Type>
</PropertyDefn>
</GMLFeatureClass>
</GMLFeatureClassList>

View File

@ -0,0 +1,111 @@
<?xml version="1.0" encoding="utf-8" ?>
<ogr:FeatureCollection
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=""
xmlns:ogr="http://ogr.maptools.org/"
xmlns:gml="http://www.opengis.net/gml">
<gml:boundedBy>
<gml:Box>
<gml:coord><gml:X>-1</gml:X><gml:Y>-3</gml:Y></gml:coord>
<gml:coord><gml:X>10</gml:X><gml:Y>6</gml:Y></gml:coord>
</gml:Box>
</gml:boundedBy>
<gml:featureMember>
<ogr:join_by_location_intersect fid="polys.0">
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>-1,-1 -1,3 3,3 3,2 2,2 2,-1 -1,-1</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
<ogr:name>aaaaa</ogr:name>
<ogr:intval>33</ogr:intval>
<ogr:floatval>44.123456</ogr:floatval>
<ogr:fid_2>points.0</ogr:fid_2>
<ogr:id>1</ogr:id>
<ogr:id2>2</ogr:id2>
</ogr:join_by_location_intersect>
</gml:featureMember>
<gml:featureMember>
<ogr:join_by_location_intersect fid="polys.0">
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>-1,-1 -1,3 3,3 3,2 2,2 2,-1 -1,-1</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
<ogr:name>aaaaa</ogr:name>
<ogr:intval>33</ogr:intval>
<ogr:floatval>44.123456</ogr:floatval>
<ogr:fid_2>points.1</ogr:fid_2>
<ogr:id>2</ogr:id>
<ogr:id2>1</ogr:id2>
</ogr:join_by_location_intersect>
</gml:featureMember>
<gml:featureMember>
<ogr:join_by_location_intersect fid="polys.0">
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>-1,-1 -1,3 3,3 3,2 2,2 2,-1 -1,-1</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
<ogr:name>aaaaa</ogr:name>
<ogr:intval>33</ogr:intval>
<ogr:floatval>44.123456</ogr:floatval>
<ogr:fid_2>points.2</ogr:fid_2>
<ogr:id>3</ogr:id>
<ogr:id2>0</ogr:id2>
</ogr:join_by_location_intersect>
</gml:featureMember>
<gml:featureMember>
<ogr:join_by_location_intersect fid="polys.5">
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>3,2 6,1 6,-3 2,-1 2,2 3,2</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
<ogr:name>elim</ogr:name>
<ogr:intval>2</ogr:intval>
<ogr:floatval>3.33</ogr:floatval>
<ogr:fid_2>points.2</ogr:fid_2>
<ogr:id>3</ogr:id>
<ogr:id2>0</ogr:id2>
</ogr:join_by_location_intersect>
</gml:featureMember>
<gml:featureMember>
<ogr:join_by_location_intersect fid="polys.5">
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>3,2 6,1 6,-3 2,-1 2,2 3,2</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
<ogr:name>elim</ogr:name>
<ogr:intval>2</ogr:intval>
<ogr:floatval>3.33</ogr:floatval>
<ogr:fid_2>points.4</ogr:fid_2>
<ogr:id>5</ogr:id>
<ogr:id2>1</ogr:id2>
</ogr:join_by_location_intersect>
</gml:featureMember>
<gml:featureMember>
<ogr:join_by_location_intersect fid="polys.3">
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>6,1 10,1 10,-3 6,-3 6,1</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs><gml:innerBoundaryIs><gml:LinearRing><gml:coordinates>7,0 7,-2 9,-2 9,0 7,0</gml:coordinates></gml:LinearRing></gml:innerBoundaryIs></gml:Polygon></ogr:geometryProperty>
<ogr:name>ASDF</ogr:name>
<ogr:intval>0</ogr:intval>
<ogr:fid_2>points.7</ogr:fid_2>
<ogr:id>8</ogr:id>
<ogr:id2>0</ogr:id2>
</ogr:join_by_location_intersect>
</gml:featureMember>
<gml:featureMember>
<ogr:join_by_location_intersect fid="polys.0">
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>-1,-1 -1,3 3,3 3,2 2,2 2,-1 -1,-1</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
<ogr:name>aaaaa</ogr:name>
<ogr:intval>33</ogr:intval>
<ogr:floatval>44.123456</ogr:floatval>
<ogr:fid_2>points.8</ogr:fid_2>
<ogr:id>9</ogr:id>
<ogr:id2>0</ogr:id2>
</ogr:join_by_location_intersect>
</gml:featureMember>
<gml:featureMember>
<ogr:join_by_location_intersect fid="polys.2">
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>2,5 2,6 3,6 3,5 2,5</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
<ogr:name>bbaaa</ogr:name>
<ogr:floatval>0.123</ogr:floatval>
</ogr:join_by_location_intersect>
</gml:featureMember>
<gml:featureMember>
<ogr:join_by_location_intersect fid="polys.1">
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>5,5 6,4 4,4 5,5</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
<ogr:name>Aaaaa</ogr:name>
<ogr:intval>-33</ogr:intval>
<ogr:floatval>0</ogr:floatval>
</ogr:join_by_location_intersect>
</gml:featureMember>
<gml:featureMember>
<ogr:join_by_location_intersect fid="polys.4">
<ogr:intval>120</ogr:intval>
<ogr:floatval>-100291.43213</ogr:floatval>
</ogr:join_by_location_intersect>
</gml:featureMember>
</ogr:FeatureCollection>

View File

@ -0,0 +1,48 @@
<GMLFeatureClassList>
<GMLFeatureClass>
<Name>join_by_location_intersect_discardnomatch</Name>
<ElementPath>join_by_location_intersect_discardnomatch</ElementPath>
<!--POLYGON-->
<GeometryType>3</GeometryType>
<SRSName>EPSG:4326</SRSName>
<DatasetSpecificInfo>
<FeatureCount>7</FeatureCount>
<ExtentXMin>-1.00000</ExtentXMin>
<ExtentXMax>10.00000</ExtentXMax>
<ExtentYMin>-3.00000</ExtentYMin>
<ExtentYMax>3.00000</ExtentYMax>
</DatasetSpecificInfo>
<PropertyDefn>
<Name>name</Name>
<ElementPath>name</ElementPath>
<Type>String</Type>
<Width>5</Width>
</PropertyDefn>
<PropertyDefn>
<Name>intval</Name>
<ElementPath>intval</ElementPath>
<Type>Integer</Type>
</PropertyDefn>
<PropertyDefn>
<Name>floatval</Name>
<ElementPath>floatval</ElementPath>
<Type>Real</Type>
</PropertyDefn>
<PropertyDefn>
<Name>fid_2</Name>
<ElementPath>fid_2</ElementPath>
<Type>String</Type>
<Width>8</Width>
</PropertyDefn>
<PropertyDefn>
<Name>id</Name>
<ElementPath>id</ElementPath>
<Type>Integer</Type>
</PropertyDefn>
<PropertyDefn>
<Name>id2</Name>
<ElementPath>id2</ElementPath>
<Type>Integer</Type>
</PropertyDefn>
</GMLFeatureClass>
</GMLFeatureClassList>

View File

@ -0,0 +1,90 @@
<?xml version="1.0" encoding="utf-8" ?>
<ogr:FeatureCollection
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=""
xmlns:ogr="http://ogr.maptools.org/"
xmlns:gml="http://www.opengis.net/gml">
<gml:boundedBy>
<gml:Box>
<gml:coord><gml:X>-1</gml:X><gml:Y>-3</gml:Y></gml:coord>
<gml:coord><gml:X>10</gml:X><gml:Y>3</gml:Y></gml:coord>
</gml:Box>
</gml:boundedBy>
<gml:featureMember>
<ogr:join_by_location_intersect_discardnomatch fid="polys.0">
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>-1,-1 -1,3 3,3 3,2 2,2 2,-1 -1,-1</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
<ogr:name>aaaaa</ogr:name>
<ogr:intval>33</ogr:intval>
<ogr:floatval>44.123456</ogr:floatval>
<ogr:fid_2>points.0</ogr:fid_2>
<ogr:id>1</ogr:id>
<ogr:id2>2</ogr:id2>
</ogr:join_by_location_intersect_discardnomatch>
</gml:featureMember>
<gml:featureMember>
<ogr:join_by_location_intersect_discardnomatch fid="polys.0">
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>-1,-1 -1,3 3,3 3,2 2,2 2,-1 -1,-1</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
<ogr:name>aaaaa</ogr:name>
<ogr:intval>33</ogr:intval>
<ogr:floatval>44.123456</ogr:floatval>
<ogr:fid_2>points.1</ogr:fid_2>
<ogr:id>2</ogr:id>
<ogr:id2>1</ogr:id2>
</ogr:join_by_location_intersect_discardnomatch>
</gml:featureMember>
<gml:featureMember>
<ogr:join_by_location_intersect_discardnomatch fid="polys.0">
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>-1,-1 -1,3 3,3 3,2 2,2 2,-1 -1,-1</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
<ogr:name>aaaaa</ogr:name>
<ogr:intval>33</ogr:intval>
<ogr:floatval>44.123456</ogr:floatval>
<ogr:fid_2>points.2</ogr:fid_2>
<ogr:id>3</ogr:id>
<ogr:id2>0</ogr:id2>
</ogr:join_by_location_intersect_discardnomatch>
</gml:featureMember>
<gml:featureMember>
<ogr:join_by_location_intersect_discardnomatch fid="polys.5">
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>3,2 6,1 6,-3 2,-1 2,2 3,2</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
<ogr:name>elim</ogr:name>
<ogr:intval>2</ogr:intval>
<ogr:floatval>3.33</ogr:floatval>
<ogr:fid_2>points.2</ogr:fid_2>
<ogr:id>3</ogr:id>
<ogr:id2>0</ogr:id2>
</ogr:join_by_location_intersect_discardnomatch>
</gml:featureMember>
<gml:featureMember>
<ogr:join_by_location_intersect_discardnomatch fid="polys.5">
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>3,2 6,1 6,-3 2,-1 2,2 3,2</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
<ogr:name>elim</ogr:name>
<ogr:intval>2</ogr:intval>
<ogr:floatval>3.33</ogr:floatval>
<ogr:fid_2>points.4</ogr:fid_2>
<ogr:id>5</ogr:id>
<ogr:id2>1</ogr:id2>
</ogr:join_by_location_intersect_discardnomatch>
</gml:featureMember>
<gml:featureMember>
<ogr:join_by_location_intersect_discardnomatch fid="polys.3">
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>6,1 10,1 10,-3 6,-3 6,1</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs><gml:innerBoundaryIs><gml:LinearRing><gml:coordinates>7,0 7,-2 9,-2 9,0 7,0</gml:coordinates></gml:LinearRing></gml:innerBoundaryIs></gml:Polygon></ogr:geometryProperty>
<ogr:name>ASDF</ogr:name>
<ogr:intval>0</ogr:intval>
<ogr:fid_2>points.7</ogr:fid_2>
<ogr:id>8</ogr:id>
<ogr:id2>0</ogr:id2>
</ogr:join_by_location_intersect_discardnomatch>
</gml:featureMember>
<gml:featureMember>
<ogr:join_by_location_intersect_discardnomatch fid="polys.0">
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>-1,-1 -1,3 3,3 3,2 2,2 2,-1 -1,-1</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
<ogr:name>aaaaa</ogr:name>
<ogr:intval>33</ogr:intval>
<ogr:floatval>44.123456</ogr:floatval>
<ogr:fid_2>points.8</ogr:fid_2>
<ogr:id>9</ogr:id>
<ogr:id2>0</ogr:id2>
</ogr:join_by_location_intersect_discardnomatch>
</gml:featureMember>
</ogr:FeatureCollection>

View File

@ -0,0 +1,48 @@
<GMLFeatureClassList>
<GMLFeatureClass>
<Name>join_by_location_intersect_first_only</Name>
<ElementPath>join_by_location_intersect_first_only</ElementPath>
<!--POLYGON-->
<GeometryType>3</GeometryType>
<SRSName>EPSG:4326</SRSName>
<DatasetSpecificInfo>
<FeatureCount>6</FeatureCount>
<ExtentXMin>-1.00000</ExtentXMin>
<ExtentXMax>10.00000</ExtentXMax>
<ExtentYMin>-3.00000</ExtentYMin>
<ExtentYMax>6.00000</ExtentYMax>
</DatasetSpecificInfo>
<PropertyDefn>
<Name>name</Name>
<ElementPath>name</ElementPath>
<Type>String</Type>
<Width>5</Width>
</PropertyDefn>
<PropertyDefn>
<Name>intval</Name>
<ElementPath>intval</ElementPath>
<Type>Integer</Type>
</PropertyDefn>
<PropertyDefn>
<Name>floatval</Name>
<ElementPath>floatval</ElementPath>
<Type>Real</Type>
</PropertyDefn>
<PropertyDefn>
<Name>fid_2</Name>
<ElementPath>fid_2</ElementPath>
<Type>String</Type>
<Width>8</Width>
</PropertyDefn>
<PropertyDefn>
<Name>id</Name>
<ElementPath>id</ElementPath>
<Type>Integer</Type>
</PropertyDefn>
<PropertyDefn>
<Name>id2</Name>
<ElementPath>id2</ElementPath>
<Type>Integer</Type>
</PropertyDefn>
</GMLFeatureClass>
</GMLFeatureClassList>

View File

@ -0,0 +1,67 @@
<?xml version="1.0" encoding="utf-8" ?>
<ogr:FeatureCollection
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=""
xmlns:ogr="http://ogr.maptools.org/"
xmlns:gml="http://www.opengis.net/gml">
<gml:boundedBy>
<gml:Box>
<gml:coord><gml:X>-1</gml:X><gml:Y>-3</gml:Y></gml:coord>
<gml:coord><gml:X>10</gml:X><gml:Y>6</gml:Y></gml:coord>
</gml:Box>
</gml:boundedBy>
<gml:featureMember>
<ogr:join_by_location_intersect_first_only fid="polys.0">
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>-1,-1 -1,3 3,3 3,2 2,2 2,-1 -1,-1</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
<ogr:name>aaaaa</ogr:name>
<ogr:intval>33</ogr:intval>
<ogr:floatval>44.123456</ogr:floatval>
<ogr:fid_2>points.0</ogr:fid_2>
<ogr:id>1</ogr:id>
<ogr:id2>2</ogr:id2>
</ogr:join_by_location_intersect_first_only>
</gml:featureMember>
<gml:featureMember>
<ogr:join_by_location_intersect_first_only fid="polys.5">
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>3,2 6,1 6,-3 2,-1 2,2 3,2</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
<ogr:name>elim</ogr:name>
<ogr:intval>2</ogr:intval>
<ogr:floatval>3.33</ogr:floatval>
<ogr:fid_2>points.2</ogr:fid_2>
<ogr:id>3</ogr:id>
<ogr:id2>0</ogr:id2>
</ogr:join_by_location_intersect_first_only>
</gml:featureMember>
<gml:featureMember>
<ogr:join_by_location_intersect_first_only fid="polys.3">
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>6,1 10,1 10,-3 6,-3 6,1</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs><gml:innerBoundaryIs><gml:LinearRing><gml:coordinates>7,0 7,-2 9,-2 9,0 7,0</gml:coordinates></gml:LinearRing></gml:innerBoundaryIs></gml:Polygon></ogr:geometryProperty>
<ogr:name>ASDF</ogr:name>
<ogr:intval>0</ogr:intval>
<ogr:fid_2>points.7</ogr:fid_2>
<ogr:id>8</ogr:id>
<ogr:id2>0</ogr:id2>
</ogr:join_by_location_intersect_first_only>
</gml:featureMember>
<gml:featureMember>
<ogr:join_by_location_intersect_first_only fid="polys.1">
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>5,5 6,4 4,4 5,5</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
<ogr:name>Aaaaa</ogr:name>
<ogr:intval>-33</ogr:intval>
<ogr:floatval>0</ogr:floatval>
</ogr:join_by_location_intersect_first_only>
</gml:featureMember>
<gml:featureMember>
<ogr:join_by_location_intersect_first_only fid="polys.2">
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>2,5 2,6 3,6 3,5 2,5</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
<ogr:name>bbaaa</ogr:name>
<ogr:floatval>0.123</ogr:floatval>
</ogr:join_by_location_intersect_first_only>
</gml:featureMember>
<gml:featureMember>
<ogr:join_by_location_intersect_first_only fid="polys.4">
<ogr:intval>120</ogr:intval>
<ogr:floatval>-100291.43213</ogr:floatval>
</ogr:join_by_location_intersect_first_only>
</gml:featureMember>
</ogr:FeatureCollection>

View File

@ -0,0 +1,48 @@
<GMLFeatureClassList>
<GMLFeatureClass>
<Name>join_by_location_intersect_first_only_discardnomatch</Name>
<ElementPath>join_by_location_intersect_first_only_discardnomatch</ElementPath>
<!--POLYGON-->
<GeometryType>3</GeometryType>
<SRSName>EPSG:4326</SRSName>
<DatasetSpecificInfo>
<FeatureCount>3</FeatureCount>
<ExtentXMin>-1.00000</ExtentXMin>
<ExtentXMax>10.00000</ExtentXMax>
<ExtentYMin>-3.00000</ExtentYMin>
<ExtentYMax>3.00000</ExtentYMax>
</DatasetSpecificInfo>
<PropertyDefn>
<Name>name</Name>
<ElementPath>name</ElementPath>
<Type>String</Type>
<Width>5</Width>
</PropertyDefn>
<PropertyDefn>
<Name>intval</Name>
<ElementPath>intval</ElementPath>
<Type>Integer</Type>
</PropertyDefn>
<PropertyDefn>
<Name>floatval</Name>
<ElementPath>floatval</ElementPath>
<Type>Real</Type>
</PropertyDefn>
<PropertyDefn>
<Name>fid_2</Name>
<ElementPath>fid_2</ElementPath>
<Type>String</Type>
<Width>8</Width>
</PropertyDefn>
<PropertyDefn>
<Name>id</Name>
<ElementPath>id</ElementPath>
<Type>Integer</Type>
</PropertyDefn>
<PropertyDefn>
<Name>id2</Name>
<ElementPath>id2</ElementPath>
<Type>Integer</Type>
</PropertyDefn>
</GMLFeatureClass>
</GMLFeatureClassList>

View File

@ -0,0 +1,46 @@
<?xml version="1.0" encoding="utf-8" ?>
<ogr:FeatureCollection
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=""
xmlns:ogr="http://ogr.maptools.org/"
xmlns:gml="http://www.opengis.net/gml">
<gml:boundedBy>
<gml:Box>
<gml:coord><gml:X>-1</gml:X><gml:Y>-3</gml:Y></gml:coord>
<gml:coord><gml:X>10</gml:X><gml:Y>3</gml:Y></gml:coord>
</gml:Box>
</gml:boundedBy>
<gml:featureMember>
<ogr:join_by_location_intersect_first_only_discardnomatch fid="polys.0">
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>-1,-1 -1,3 3,3 3,2 2,2 2,-1 -1,-1</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
<ogr:name>aaaaa</ogr:name>
<ogr:intval>33</ogr:intval>
<ogr:floatval>44.123456</ogr:floatval>
<ogr:fid_2>points.0</ogr:fid_2>
<ogr:id>1</ogr:id>
<ogr:id2>2</ogr:id2>
</ogr:join_by_location_intersect_first_only_discardnomatch>
</gml:featureMember>
<gml:featureMember>
<ogr:join_by_location_intersect_first_only_discardnomatch fid="polys.5">
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>3,2 6,1 6,-3 2,-1 2,2 3,2</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
<ogr:name>elim</ogr:name>
<ogr:intval>2</ogr:intval>
<ogr:floatval>3.33</ogr:floatval>
<ogr:fid_2>points.2</ogr:fid_2>
<ogr:id>3</ogr:id>
<ogr:id2>0</ogr:id2>
</ogr:join_by_location_intersect_first_only_discardnomatch>
</gml:featureMember>
<gml:featureMember>
<ogr:join_by_location_intersect_first_only_discardnomatch fid="polys.3">
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>6,1 10,1 10,-3 6,-3 6,1</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs><gml:innerBoundaryIs><gml:LinearRing><gml:coordinates>7,0 7,-2 9,-2 9,0 7,0</gml:coordinates></gml:LinearRing></gml:innerBoundaryIs></gml:Polygon></ogr:geometryProperty>
<ogr:name>ASDF</ogr:name>
<ogr:intval>0</ogr:intval>
<ogr:fid_2>points.7</ogr:fid_2>
<ogr:id>8</ogr:id>
<ogr:id2>0</ogr:id2>
</ogr:join_by_location_intersect_first_only_discardnomatch>
</gml:featureMember>
</ogr:FeatureCollection>

View File

@ -0,0 +1,37 @@
<GMLFeatureClassList>
<GMLFeatureClass>
<Name>join_by_location_intersect_subset_fields</Name>
<ElementPath>join_by_location_intersect_subset_fields</ElementPath>
<!--POLYGON-->
<GeometryType>3</GeometryType>
<SRSName>EPSG:4326</SRSName>
<DatasetSpecificInfo>
<FeatureCount>10</FeatureCount>
<ExtentXMin>-1.00000</ExtentXMin>
<ExtentXMax>10.00000</ExtentXMax>
<ExtentYMin>-3.00000</ExtentYMin>
<ExtentYMax>6.00000</ExtentYMax>
</DatasetSpecificInfo>
<PropertyDefn>
<Name>name</Name>
<ElementPath>name</ElementPath>
<Type>String</Type>
<Width>5</Width>
</PropertyDefn>
<PropertyDefn>
<Name>intval</Name>
<ElementPath>intval</ElementPath>
<Type>Integer</Type>
</PropertyDefn>
<PropertyDefn>
<Name>floatval</Name>
<ElementPath>floatval</ElementPath>
<Type>Real</Type>
</PropertyDefn>
<PropertyDefn>
<Name>id</Name>
<ElementPath>id</ElementPath>
<Type>Integer</Type>
</PropertyDefn>
</GMLFeatureClass>
</GMLFeatureClassList>

View File

@ -0,0 +1,97 @@
<?xml version="1.0" encoding="utf-8" ?>
<ogr:FeatureCollection
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=""
xmlns:ogr="http://ogr.maptools.org/"
xmlns:gml="http://www.opengis.net/gml">
<gml:boundedBy>
<gml:Box>
<gml:coord><gml:X>-1</gml:X><gml:Y>-3</gml:Y></gml:coord>
<gml:coord><gml:X>10</gml:X><gml:Y>6</gml:Y></gml:coord>
</gml:Box>
</gml:boundedBy>
<gml:featureMember>
<ogr:join_by_location_intersect_subset_fields fid="polys.0">
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>-1,-1 -1,3 3,3 3,2 2,2 2,-1 -1,-1</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
<ogr:name>aaaaa</ogr:name>
<ogr:intval>33</ogr:intval>
<ogr:floatval>44.123456</ogr:floatval>
<ogr:id>1</ogr:id>
</ogr:join_by_location_intersect_subset_fields>
</gml:featureMember>
<gml:featureMember>
<ogr:join_by_location_intersect_subset_fields fid="polys.0">
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>-1,-1 -1,3 3,3 3,2 2,2 2,-1 -1,-1</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
<ogr:name>aaaaa</ogr:name>
<ogr:intval>33</ogr:intval>
<ogr:floatval>44.123456</ogr:floatval>
<ogr:id>2</ogr:id>
</ogr:join_by_location_intersect_subset_fields>
</gml:featureMember>
<gml:featureMember>
<ogr:join_by_location_intersect_subset_fields fid="polys.0">
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>-1,-1 -1,3 3,3 3,2 2,2 2,-1 -1,-1</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
<ogr:name>aaaaa</ogr:name>
<ogr:intval>33</ogr:intval>
<ogr:floatval>44.123456</ogr:floatval>
<ogr:id>3</ogr:id>
</ogr:join_by_location_intersect_subset_fields>
</gml:featureMember>
<gml:featureMember>
<ogr:join_by_location_intersect_subset_fields fid="polys.5">
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>3,2 6,1 6,-3 2,-1 2,2 3,2</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
<ogr:name>elim</ogr:name>
<ogr:intval>2</ogr:intval>
<ogr:floatval>3.33</ogr:floatval>
<ogr:id>3</ogr:id>
</ogr:join_by_location_intersect_subset_fields>
</gml:featureMember>
<gml:featureMember>
<ogr:join_by_location_intersect_subset_fields fid="polys.5">
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>3,2 6,1 6,-3 2,-1 2,2 3,2</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
<ogr:name>elim</ogr:name>
<ogr:intval>2</ogr:intval>
<ogr:floatval>3.33</ogr:floatval>
<ogr:id>5</ogr:id>
</ogr:join_by_location_intersect_subset_fields>
</gml:featureMember>
<gml:featureMember>
<ogr:join_by_location_intersect_subset_fields fid="polys.3">
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>6,1 10,1 10,-3 6,-3 6,1</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs><gml:innerBoundaryIs><gml:LinearRing><gml:coordinates>7,0 7,-2 9,-2 9,0 7,0</gml:coordinates></gml:LinearRing></gml:innerBoundaryIs></gml:Polygon></ogr:geometryProperty>
<ogr:name>ASDF</ogr:name>
<ogr:intval>0</ogr:intval>
<ogr:id>8</ogr:id>
</ogr:join_by_location_intersect_subset_fields>
</gml:featureMember>
<gml:featureMember>
<ogr:join_by_location_intersect_subset_fields fid="polys.0">
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>-1,-1 -1,3 3,3 3,2 2,2 2,-1 -1,-1</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
<ogr:name>aaaaa</ogr:name>
<ogr:intval>33</ogr:intval>
<ogr:floatval>44.123456</ogr:floatval>
<ogr:id>9</ogr:id>
</ogr:join_by_location_intersect_subset_fields>
</gml:featureMember>
<gml:featureMember>
<ogr:join_by_location_intersect_subset_fields fid="polys.1">
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>5,5 6,4 4,4 5,5</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
<ogr:name>Aaaaa</ogr:name>
<ogr:intval>-33</ogr:intval>
<ogr:floatval>0</ogr:floatval>
</ogr:join_by_location_intersect_subset_fields>
</gml:featureMember>
<gml:featureMember>
<ogr:join_by_location_intersect_subset_fields fid="polys.2">
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>2,5 2,6 3,6 3,5 2,5</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
<ogr:name>bbaaa</ogr:name>
<ogr:floatval>0.123</ogr:floatval>
</ogr:join_by_location_intersect_subset_fields>
</gml:featureMember>
<gml:featureMember>
<ogr:join_by_location_intersect_subset_fields fid="polys.4">
<ogr:intval>120</ogr:intval>
<ogr:floatval>-100291.43213</ogr:floatval>
</ogr:join_by_location_intersect_subset_fields>
</gml:featureMember>
</ogr:FeatureCollection>

View File

@ -0,0 +1,48 @@
<GMLFeatureClassList>
<GMLFeatureClass>
<Name>join_by_location_touches</Name>
<ElementPath>join_by_location_touches</ElementPath>
<!--POLYGON-->
<GeometryType>3</GeometryType>
<SRSName>EPSG:4326</SRSName>
<DatasetSpecificInfo>
<FeatureCount>5</FeatureCount>
<ExtentXMin>-1.00000</ExtentXMin>
<ExtentXMax>10.00000</ExtentXMax>
<ExtentYMin>-3.00000</ExtentYMin>
<ExtentYMax>3.00000</ExtentYMax>
</DatasetSpecificInfo>
<PropertyDefn>
<Name>name</Name>
<ElementPath>name</ElementPath>
<Type>String</Type>
<Width>5</Width>
</PropertyDefn>
<PropertyDefn>
<Name>intval</Name>
<ElementPath>intval</ElementPath>
<Type>Integer</Type>
</PropertyDefn>
<PropertyDefn>
<Name>floatval</Name>
<ElementPath>floatval</ElementPath>
<Type>Real</Type>
</PropertyDefn>
<PropertyDefn>
<Name>fid_2</Name>
<ElementPath>fid_2</ElementPath>
<Type>String</Type>
<Width>8</Width>
</PropertyDefn>
<PropertyDefn>
<Name>id</Name>
<ElementPath>id</ElementPath>
<Type>Integer</Type>
</PropertyDefn>
<PropertyDefn>
<Name>id2</Name>
<ElementPath>id2</ElementPath>
<Type>Integer</Type>
</PropertyDefn>
</GMLFeatureClass>
</GMLFeatureClassList>

View File

@ -0,0 +1,68 @@
<?xml version="1.0" encoding="utf-8" ?>
<ogr:FeatureCollection
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=""
xmlns:ogr="http://ogr.maptools.org/"
xmlns:gml="http://www.opengis.net/gml">
<gml:boundedBy>
<gml:Box>
<gml:coord><gml:X>-1</gml:X><gml:Y>-3</gml:Y></gml:coord>
<gml:coord><gml:X>10</gml:X><gml:Y>3</gml:Y></gml:coord>
</gml:Box>
</gml:boundedBy>
<gml:featureMember>
<ogr:join_by_location_touches fid="polys.0">
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>-1,-1 -1,3 3,3 3,2 2,2 2,-1 -1,-1</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
<ogr:name>aaaaa</ogr:name>
<ogr:intval>33</ogr:intval>
<ogr:floatval>44.123456</ogr:floatval>
<ogr:fid_2>points.1</ogr:fid_2>
<ogr:id>2</ogr:id>
<ogr:id2>1</ogr:id2>
</ogr:join_by_location_touches>
</gml:featureMember>
<gml:featureMember>
<ogr:join_by_location_touches fid="polys.0">
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>-1,-1 -1,3 3,3 3,2 2,2 2,-1 -1,-1</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
<ogr:name>aaaaa</ogr:name>
<ogr:intval>33</ogr:intval>
<ogr:floatval>44.123456</ogr:floatval>
<ogr:fid_2>points.2</ogr:fid_2>
<ogr:id>3</ogr:id>
<ogr:id2>0</ogr:id2>
</ogr:join_by_location_touches>
</gml:featureMember>
<gml:featureMember>
<ogr:join_by_location_touches fid="polys.5">
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>3,2 6,1 6,-3 2,-1 2,2 3,2</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
<ogr:name>elim</ogr:name>
<ogr:intval>2</ogr:intval>
<ogr:floatval>3.33</ogr:floatval>
<ogr:fid_2>points.2</ogr:fid_2>
<ogr:id>3</ogr:id>
<ogr:id2>0</ogr:id2>
</ogr:join_by_location_touches>
</gml:featureMember>
<gml:featureMember>
<ogr:join_by_location_touches fid="polys.3">
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>6,1 10,1 10,-3 6,-3 6,1</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs><gml:innerBoundaryIs><gml:LinearRing><gml:coordinates>7,0 7,-2 9,-2 9,0 7,0</gml:coordinates></gml:LinearRing></gml:innerBoundaryIs></gml:Polygon></ogr:geometryProperty>
<ogr:name>ASDF</ogr:name>
<ogr:intval>0</ogr:intval>
<ogr:fid_2>points.7</ogr:fid_2>
<ogr:id>8</ogr:id>
<ogr:id2>0</ogr:id2>
</ogr:join_by_location_touches>
</gml:featureMember>
<gml:featureMember>
<ogr:join_by_location_touches fid="polys.0">
<ogr:geometryProperty><gml:Polygon srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>-1,-1 -1,3 3,3 3,2 2,2 2,-1 -1,-1</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
<ogr:name>aaaaa</ogr:name>
<ogr:intval>33</ogr:intval>
<ogr:floatval>44.123456</ogr:floatval>
<ogr:fid_2>points.8</ogr:fid_2>
<ogr:id>9</ogr:id>
<ogr:id2>0</ogr:id2>
</ogr:join_by_location_touches>
</gml:featureMember>
</ogr:FeatureCollection>

View File

@ -3623,4 +3623,161 @@ tests:
pk: date
compare:
fields:
fid: skip
fid: skip
- algorithm: qgis:joinattributesbylocation
name: Join by location (intersects)
params:
DISCARD_NONMATCHING: false
INPUT:
name: polys.gml
type: vector
JOIN:
name: custom/points.shp
type: vector
METHOD: 0
PREDICATE:
- 0
results:
OUTPUT:
name: expected/join_by_location_intersect.gml
type: vector
pk:
- name
- id
- id2
compare:
fields:
fid: skip
fid_2: skip
- algorithm: qgis:joinattributesbylocation
name: Join by location (intersects), discard no match
params:
DISCARD_NONMATCHING: true
INPUT:
name: polys.gml
type: vector
JOIN:
name: custom/points.shp
type: vector
METHOD: 0
PREDICATE:
- 0
results:
OUTPUT:
name: expected/join_by_location_intersect_discardnomatch.gml
type: vector
pk:
- name
- id
- id2
compare:
fields:
fid: skip
fid_2: skip
- algorithm: qgis:joinattributesbylocation
name: Join by location (intersects), first match only
params:
DISCARD_NONMATCHING: false
INPUT:
name: polys.gml
type: vector
JOIN:
name: custom/points.shp
type: vector
METHOD: 1
PREDICATE:
- 0
results:
OUTPUT:
name: expected/join_by_location_intersect_first_only.gml
type: vector
pk:
- name
compare:
fields:
fid: skip
fid_2: skip
id: skip # cant check these - order of match is not predictable
id2: skip
- algorithm: qgis:joinattributesbylocation
name: Join by location (intersects), first match only, discard no match
params:
DISCARD_NONMATCHING: true
INPUT:
name: expected/join_by_location_intersect_first_only.gml
type: vector
JOIN:
name: custom/points.shp
type: vector
METHOD: 1
PREDICATE:
- 0
results:
OUTPUT:
name: expected/join_by_location_intersect_first_only_discardnomatch.gml
type: vector
pk:
- name
compare:
fields:
fid: skip
fid_2: skip
id: skip # cant check these - order of match is not predictable
id2: skip
- algorithm: qgis:joinattributesbylocation
name: Join by location (intersects), subset of fields
params:
DISCARD_NONMATCHING: false
INPUT:
name: polys.gml
type: vector
JOIN:
name: custom/points.shp
type: vector
JOIN_FIELDS:
- id
METHOD: 0
PREDICATE:
- 0
results:
OUTPUT:
name: expected/join_by_location_intersect_subset_fields.gml
type: vector
pk:
- name
- id
compare:
fields:
fid: skip
fid_2: skip
- algorithm: qgis:joinattributesbylocation
name: Join by location (touches)
params:
DISCARD_NONMATCHING: true
INPUT:
name: polys.gml
type: vector
JOIN:
name: custom/points.shp
type: vector
METHOD: 0
PREDICATE:
- 3
results:
OUTPUT:
name: expected/join_by_location_touches.gml
type: vector
pk:
- name
- id
- id2
compare:
fields:
fid: skip
fid_2: skip