public class SpatialContextFactory extends Object
SpatialContext based on configuration data. Call
makeSpatialContext(java.util.Map, ClassLoader) to construct one via String name-value
pairs. To construct one via code then create a factory instance, set the fields, then call
newSpatialContext().
The following keys are looked up in the args map:
SpatialContext.isGeo() ShapeFactory.DistanceCalculatorENVELOPE(xMin, xMax, yMax, yMin) -- see SpatialContext.getWorldBounds()SpatialContext.isNormWrapLongitude()ShapeReader class namesShapeWriter class namesBinaryCodec| Modifier and Type | Field and Description |
|---|---|
protected Map<String,String> |
args
|
Class<? extends BinaryCodec> |
binaryCodecClass |
protected ClassLoader |
classLoader
|
DistanceCalculator |
distCalc |
boolean |
geo |
boolean |
hasFormatConfig |
boolean |
normWrapLongitude |
List<Class<? extends ShapeReader>> |
readers |
Class<? extends ShapeFactory> |
shapeFactoryClass |
Rectangle |
worldBounds |
List<Class<? extends ShapeWriter>> |
writers |
| Constructor and Description |
|---|
SpatialContextFactory() |
| Modifier and Type | Method and Description |
|---|---|
void |
addReaderIfNoggitExists(Class<? extends ShapeReader> reader) |
protected void |
checkDefaultFormats()
If no formats were defined in the config, this will make sure GeoJSON and WKT are registered
|
protected void |
init(Map<String,String> args,
ClassLoader classLoader) |
protected void |
initCalculator() |
protected void |
initField(String name)
Gets
name from args and populates a field by the same name with the value. |
protected void |
initFormats()
Check args for 'readers' and 'writers'.
|
protected void |
initWorldBounds() |
BinaryCodec |
makeBinaryCodec(SpatialContext ctx) |
SupportedFormats |
makeFormats(SpatialContext ctx) |
ShapeFactory |
makeShapeFactory(SpatialContext ctx) |
static SpatialContext |
makeSpatialContext(Map<String,String> args,
ClassLoader classLoader)
Creates a new
SpatialContext based on configuration in
args. |
SpatialContext |
newSpatialContext()
Subclasses should simply construct the instance from the initialized configuration.
|
protected ClassLoader classLoader
public boolean geo
public DistanceCalculator distCalc
public Rectangle worldBounds
public boolean normWrapLongitude
public Class<? extends ShapeFactory> shapeFactoryClass
public Class<? extends BinaryCodec> binaryCodecClass
public final List<Class<? extends ShapeReader>> readers
public final List<Class<? extends ShapeWriter>> writers
public boolean hasFormatConfig
public static SpatialContext makeSpatialContext(Map<String,String> args, ClassLoader classLoader)
SpatialContext based on configuration in
args. See the class definition for what keys are looked up
in it.
The factory class is looked up via "spatialContextFactory" in args
then falling back to a Java system property (with initial caps). If neither are specified
then SpatialContextFactory is chosen.args - Non-null map of name-value pairs.classLoader - Optional, except when a class name is provided to an
argument.protected void init(Map<String,String> args, ClassLoader classLoader)
protected void initField(String name)
name from args and populates a field by the same name with the value.protected void initCalculator()
protected void initFormats()
public SupportedFormats makeFormats(SpatialContext ctx)
protected void checkDefaultFormats()
public void addReaderIfNoggitExists(Class<? extends ShapeReader> reader)
protected void initWorldBounds()
public SpatialContext newSpatialContext()
public ShapeFactory makeShapeFactory(SpatialContext ctx)
public BinaryCodec makeBinaryCodec(SpatialContext ctx)
Copyright © 2020 LocationTech. All rights reserved.