K
- The type of the internalInputFormat's keysV
- The type of the internalInputFormat's valuesW
- The type of the output valuepublic abstract class AbstractSpatialHierarchicalMapper<K,V,W> extends org.apache.hadoop.mapreduce.Mapper<org.apache.hadoop.io.Text,RTreeWritable,org.apache.hadoop.io.Text,W>
Base mapper class used to catalog records into hierarchy layers. Records are cataloged using a spatial operation between the record's geometry and the geometries of the hierarchical entities.
The input data is always expected to be a spatial index as generated by SpatialIndexingMapper
The output key is a combination of a hierarchy layer's name and one of the id of one of the hierarchy level's entities. The value must be defined by the implementing class
The search always starts from the bottom level of the hierarchy, that is, the maximum hierarchy level. As matches are found, the counts are propagated to the parents in upper levels. By default, only the bottom level entries are searched in the spatial index, however, by setting to true the parameter ConfigParams.HIERARCHY_SEARCH_MULTIPLE_LEVELS
it is possible to continue searching in upper hierarchies until all the elements in the index are cataloged.
Expected configuration:
ConfigParams.HIERARCHY_INFO_CLASS
ConfigParams.HIERARCHY_LOAD_MIN_LEVEL
- optionalConfigParams.HIERARCHY_LOAD_MAX_LEVEL
- optionalConfigParams.HIERARCHY_SEARCH_MULTIPLE_LEVELS
- optionalConfigParams.SPATIAL_OPERATION
ConfigParams.SRID
ConfigParams.SPATIAL_TOLERANCE
- optionalConfigParams.GEODETIC
Modifier and Type | Field and Description |
---|---|
protected HierarchyInfo |
hierInfo |
protected int |
maxLevel |
protected int |
minLevel |
protected org.apache.hadoop.io.Text |
outKey |
protected boolean |
searchMultiLevels |
protected SpatialOperationConfig |
spatialOpConf |
Constructor and Description |
---|
AbstractSpatialHierarchicalMapper() |
Modifier and Type | Method and Description |
---|---|
protected abstract W |
getOutValue(RecordInfo matchingRecordInfo)
Given a RecordInfo instance representing a record that previously matched a hierarchy entry, returns the output value
|
protected void |
map(org.apache.hadoop.io.Text key, RTreeWritable value, org.apache.hadoop.mapreduce.Mapper.Context context) |
protected void |
mapHierarchicalResults(java.lang.String featureId, int level, W outValue, org.apache.hadoop.mapreduce.Mapper.Context context) |
void |
setup(org.apache.hadoop.mapreduce.Mapper.Context context) |
protected org.apache.hadoop.io.Text outKey
protected SpatialOperationConfig spatialOpConf
protected HierarchyInfo hierInfo
protected boolean searchMultiLevels
protected int maxLevel
protected int minLevel
public void setup(org.apache.hadoop.mapreduce.Mapper.Context context) throws java.io.IOException, java.lang.InterruptedException
setup
in class org.apache.hadoop.mapreduce.Mapper<org.apache.hadoop.io.Text,RTreeWritable,org.apache.hadoop.io.Text,W>
java.io.IOException
java.lang.InterruptedException
protected void map(org.apache.hadoop.io.Text key, RTreeWritable value, org.apache.hadoop.mapreduce.Mapper.Context context) throws java.io.IOException, java.lang.InterruptedException
map
in class org.apache.hadoop.mapreduce.Mapper<org.apache.hadoop.io.Text,RTreeWritable,org.apache.hadoop.io.Text,W>
java.io.IOException
java.lang.InterruptedException
protected abstract W getOutValue(RecordInfo matchingRecordInfo)
matchingRecordInfo
- an instance of RecordInfoprotected void mapHierarchicalResults(java.lang.String featureId, int level, W outValue, org.apache.hadoop.mapreduce.Mapper.Context context) throws java.io.IOException, java.lang.InterruptedException
java.io.IOException
java.lang.InterruptedException