Class SpatialArgsParser
Parses a string that usually looks like "OPERATION(SHAPE)" into a SpatialArgs
object. The set of operations supported are defined in SpatialOperation, such
as "Intersects" being a common one. The shape portion is defined by WKT Spatial4n.Core.IO.WktShapeParser,
but it can be overridden/customized via ParseShape(String, SpatialContext).
There are some optional name-value pair parameters that follow the closing parenthesis. Example:
Intersects(ENVELOPE(-10,-8,22,20)) distErrPct=0.025
In the future it would be good to support something at least semi-standardized like a
variant of
[E]CQL.
This is a Lucene.NET EXPERIMENTAL API, use at your own risk
Inheritance
System.Object
SpatialArgsParser
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Assembly: Lucene.Net.Spatial.dll
Syntax
public class SpatialArgsParser
Fields
|
Improve this Doc
View Source
DIST_ERR
Declaration
public const string DIST_ERR = "distErr"
Field Value
Type |
Description |
System.String |
|
|
Improve this Doc
View Source
DIST_ERR_PCT
Declaration
public const string DIST_ERR_PCT = "distErrPct"
Field Value
Type |
Description |
System.String |
|
Methods
|
Improve this Doc
View Source
NewSpatialArgs(SpatialOperation, IShape)
Declaration
protected virtual SpatialArgs NewSpatialArgs(SpatialOperation op, IShape shape)
Parameters
Returns
|
Improve this Doc
View Source
Parse(String, SpatialContext)
Parses a string such as "Intersects(ENVELOPE(-10,-8,22,20)) distErrPct=0.025".
Declaration
public virtual SpatialArgs Parse(string v, SpatialContext ctx)
Parameters
Type |
Name |
Description |
System.String |
v |
The string to parse. Mandatory.
|
Spatial4n.Core.Context.SpatialContext |
ctx |
The spatial context. Mandatory.
|
Returns
Exceptions
Type |
Condition |
System.ArgumentException |
if the parameters don't make sense or an add-on parameter is unknown
|
Spatial4n.Core.Exceptions.ParseException |
If there is a problem parsing the string
|
Spatial4n.Core.Exceptions.InvalidShapeException |
When the coordinates are invalid for the shape
|
|
Improve this Doc
View Source
ParseMap(String)
Parses "a=b c=d f" (whitespace separated) into name-value pairs. If there
is no '=' as in 'f' above then it's short for f=f.
Declaration
protected static IDictionary<string, string> ParseMap(string body)
Parameters
Type |
Name |
Description |
System.String |
body |
|
Returns
Type |
Description |
System.Collections.Generic.IDictionary<System.String, System.String> |
|
|
Improve this Doc
View Source
ParseShape(String, SpatialContext)
Declaration
protected virtual IShape ParseShape(string str, SpatialContext ctx)
Parameters
Type |
Name |
Description |
System.String |
str |
|
Spatial4n.Core.Context.SpatialContext |
ctx |
|
Returns
Type |
Description |
Spatial4n.Core.Shapes.IShape |
|
|
Improve this Doc
View Source
ReadBool(String, Boolean)
Declaration
protected static bool ReadBool(string v, bool defaultValue)
Parameters
Type |
Name |
Description |
System.String |
v |
|
System.Boolean |
defaultValue |
|
Returns
Type |
Description |
System.Boolean |
|
|
Improve this Doc
View Source
ReadDouble(String)
Declaration
protected static double? ReadDouble(string v)
Parameters
Type |
Name |
Description |
System.String |
v |
|
Returns
Type |
Description |
System.Nullable<System.Double> |
|
|
Improve this Doc
View Source
ReadNameValuePairs(SpatialArgs, IDictionary<String, String>)
Declaration
protected virtual void ReadNameValuePairs(SpatialArgs args, IDictionary<string, string> nameValPairs)
Parameters
Type |
Name |
Description |
SpatialArgs |
args |
|
System.Collections.Generic.IDictionary<System.String, System.String> |
nameValPairs |
|
|
Improve this Doc
View Source
WriteSpatialArgs(SpatialArgs)
Writes a close approximation to the parsed input format.
Declaration
public static string WriteSpatialArgs(SpatialArgs args)
Parameters
Returns
Type |
Description |
System.String |
|