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.mapred.MapReduceBase implements org.apache.hadoop.mapred.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 |
---|---|
void |
configure(org.apache.hadoop.mapred.JobConf conf) |
protected abstract W |
getOutValue(RecordInfo matchingRecordInfo)
Given a RecordInfo instance representing a record that previously matched a hierarchy entry, returns the output value
|
void |
map(org.apache.hadoop.io.Text key, RTreeWritable value, org.apache.hadoop.mapred.OutputCollector<org.apache.hadoop.io.Text,W> output, org.apache.hadoop.mapred.Reporter reporter) |
protected void |
mapHierarchicalResults(java.lang.String featureId, int level, W outValue, org.apache.hadoop.mapred.OutputCollector<org.apache.hadoop.io.Text,W> output, org.apache.hadoop.mapred.Reporter reporter) |
protected org.apache.hadoop.io.Text outKey
protected SpatialOperationConfig spatialOpConf
protected HierarchyInfo hierInfo
protected boolean searchMultiLevels
protected int maxLevel
protected int minLevel
public void configure(org.apache.hadoop.mapred.JobConf conf)
configure
in interface org.apache.hadoop.mapred.JobConfigurable
configure
in class org.apache.hadoop.mapred.MapReduceBase
public void map(org.apache.hadoop.io.Text key, RTreeWritable value, org.apache.hadoop.mapred.OutputCollector<org.apache.hadoop.io.Text,W> output, org.apache.hadoop.mapred.Reporter reporter) throws java.io.IOException
map
in interface org.apache.hadoop.mapred.Mapper<org.apache.hadoop.io.Text,RTreeWritable,org.apache.hadoop.io.Text,W>
java.io.IOException
protected abstract W getOutValue(RecordInfo matchingRecordInfo)
matchingRecordInfo
- an instance of RecordInfo