Class SpatialContext
This is a facade to most of Spatial4n, holding things like IDistanceCalculator, WktShapeParser, and acting as a factory for the IShapes.
If you want a typical geodetic context, just reference GEO. Otherwise, You should either create and configure a SpatialContextFactory and then call NewSpatialContext(), OR, call MakeSpatialContext(IDictionary<String, String>) to do this via configuration data.
Thread-safe & immutable.Inheritance
Inherited Members
Assembly: Spatial4n.dll
Syntax
[Serializable]
public class SpatialContext
Constructors
Name | Description |
---|---|
SpatialContext(SpatialContextFactory) | Called by NewSpatialContext(). |
SpatialContext(Boolean) | |
SpatialContext(Boolean, IDistanceCalculator, IRectangle) | Consider using SpatialContextFactory instead. |
Fields
Name | Description |
---|---|
GEO | A popular default SpatialContext implementation for geospatial. |
Properties
Name | Description |
---|---|
BinaryCodec | |
DistCalc | |
IsGeo | Is the mathematical world model based on a sphere, or is it a flat plane? The word "geodetic" or "geodesic" is sometimes used to refer to the former, and the latter is sometimes referred to as "Euclidean" or "cartesian". |
IsNormWrapLongitude | If true then NormX(Double) will wrap longitudes outside of the standard geodetic boundary into it. Example: 181 will become -179. |
WktShapeParser | The WktShapeParser used by ReadShapeFromWkt(String). |
WorldBounds | The extent of x & y coordinates should fit within the return'ed rectangle. Do NOT invoke Reset(Double, Double, Double, Double) on this return type. |
Methods
Name | Description |
---|---|
CalcDistance(IPoint, IPoint) | Convenience that uses DistCalc |
CalcDistance(IPoint, Double, Double) | Convenience that uses DistCalc |
MakeBufferedLineString(IList<IPoint>, Double) | Constructs a buffered line string. It's an ordered sequence of connected vertexes, with a buffer distance along the line in all directions. There is no official shape/interface for it so we just return IShape. |
MakeCircle(IPoint, Double) | Construct a circle. The units of "distance" should be the same as x & y. |
MakeCircle(Double, Double, Double) | Construct a circle. The units of "distance" should be the same as x & y. |
MakeCollection(IList<IShape>) | Construct a ShapeCollection, analogous to an OGC GeometryCollection. |
MakeLineString(IList<IPoint>) | Constructs a line string. It's an ordered sequence of connected vertexes. There is no official shape/interface for it yet so we just return IShape. |
MakePoint(Double, Double) | Construct a point. |
MakeRectangle(IPoint, IPoint) | Construct a rectangle. |
MakeRectangle(Double, Double, Double, Double) | Construct a rectangle. If just one longitude is on the dateline (+/- 180) then potentially adjust its sign to ensure the rectangle does not cross the dateline. |
NormX(Double) | Normalize the 'x' dimension. Might reduce precision or wrap it to be within the bounds. This is called by WktShapeParser before creating a shape. |
NormY(Double) | Normalize the 'y' dimension. Might reduce precision or wrap it to be within the bounds. This is called by WktShapeParser before creating a shape. |
ReadShape(String) | Reads the shape from a String using the old/deprecated LegacyShapeReadWriterFormat. Instead you should use standard WKT via ReadShapeFromWkt(String). This method falls back on WKT if it's not in the legacy format. |
ReadShapeFromWkt(String) | Reads a shape from the string formatted in WKT. See WktShapeParser. |
ToString() | |
ToString(IShape) | Writes the shape to a String using the old/deprecated LegacyShapeReadWriterFormat. The NTS based subclass will write it to WKT if the legacy format doesn't support that shape. Spatial4n in the near future won't support writing shapes to strings. |
VerifyX(Double) | Ensure fits in WorldBounds. It's called by any shape factory method that gets an 'x' dimension. |
VerifyY(Double) | Ensure fits in WorldBounds. It's called by any shape factory method that gets a 'y' dimension. |