Table of Contents

Class ProjectionConverter

Namespace
ThinkGeo.Core
Assembly
ThinkGeo.Core.dll

This class represents a projection that you wish to apply to a FeatureSource.

public class ProjectionConverter
Inheritance
ProjectionConverter
Derived
Inherited Members

Remarks

This class is abstract and designed to be inherited to create your own projection. The derived projection classes are typically used on a FeatureSource or Layer. It is used to project coordinates from one projection to another and back again. It is important to note that you need to implement the projection both ways.

Constructors

ProjectionConverter()

This is the default constructor for this class.

public ProjectionConverter()

Remarks

This conctructor pass nothing. After this cconstructor , you should set the InternalProjectionParametersString property and ExternalProjectionParametersString property before open to use.

ProjectionConverter(int, int)

public ProjectionConverter(int internalSrid, int externalSrid)

Parameters

internalSrid int
externalSrid int

ProjectionConverter(int, string)

public ProjectionConverter(int internalSridString, string externalProjString)

Parameters

internalSridString int
externalProjString string

ProjectionConverter(string, int)

public ProjectionConverter(string internalProjString, int externalSrid)

Parameters

internalProjString string
externalSrid int

ProjectionConverter(string, string)

public ProjectionConverter(string internalProjString, string externalProjString)

Parameters

internalProjString string
externalProjString string

ProjectionConverter(Projection, Projection)

This is a constructor for the class.

public ProjectionConverter(Projection internalProjection, Projection externalProjection)

Parameters

internalProjection Projection

This parameter is the projection parameters describing the data.

externalProjection Projection

This parameter is the projection parameters describing the projection you want to go to.

Remarks

This constructor allows you to pass in Proj4 text parameters for the to and from projection. The parameters typically look like "+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs" You should use this constructor when you know the parameters. If you know the SRID directly you can use the other constructor that takes the SRID.

Properties

CanConvertRasterToExternalProjection

public bool CanConvertRasterToExternalProjection { get; protected set; }

Property Value

bool

DecimalDegreeBoundary

public RectangleShape DecimalDegreeBoundary { get; set; }

Property Value

RectangleShape

ExternalProjection

Gets or sets the Proj4 text parameter for the to projection. This parameter typically look like "+proj=utm +zone=33 +ellps=WGS84 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs".

public Projection ExternalProjection { get; set; }

Property Value

Projection

InternalProjection

Gets or sets the Proj4 text parameter for the from projection. This parameter typically look like "+Proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs".

public Projection InternalProjection { get; set; }

Property Value

Projection

InternalProjectionUnit

public virtual GeographyUnit InternalProjectionUnit { get; }

Property Value

GeographyUnit

IsOpen

This property gets the state of the projection (whether it is opened or closed).

public bool IsOpen { get; protected set; }

Property Value

bool

Remarks

This method will reflect whether the projection is opened or closed. It is set in the concrete methods Open and Close, so if you inherit from this class and override OpenCore or CloseCore, you will not need to be concerned with setting this property.

Methods

Close()

This method closes the projection and gets it ready for serialization if necessary.

public void Close()

Remarks

This method closes the projection and gets it ready for serialization if necessary.

As this is a concrete public method that wraps a Core method, we reserve the right to add events and other logic to pre- or post-process data returned by the Core version of the method. In this way, we leave our framework open on our end, but also allow you the developer to extend our logic to suit your needs. If you have questions about this, please contact our support team as we would be happy to work with you on extending our framework.

CloseCore()

This method closes the projection and gets it ready for serialization if necessary.

protected virtual void CloseCore()

Remarks

As this is the core version of the Close method, it is intended to be overridden in an inherited version of the class. When overriding, you will be responsible freeing any state you have maintained and getting the class ready for serialization if necessary. Note that the object may be opened again, so you want to make sure you can open and close the object multiple times without any ill effects.

Convert(int, int, IEnumerable<Feature>)

public static IEnumerable<Feature> Convert(int fromSrid, int toSrid, IEnumerable<Feature> features)

Parameters

fromSrid int
toSrid int
features IEnumerable<Feature>

Returns

IEnumerable<Feature>

Convert(int, int, IEnumerable<Vertex>)

public static IEnumerable<Vertex> Convert(int fromSrid, int toSrid, IEnumerable<Vertex> vertices)

Parameters

fromSrid int
toSrid int
vertices IEnumerable<Vertex>

Returns

IEnumerable<Vertex>

Convert(int, int, double, double)

public static Vertex Convert(int fromSrid, int toSrid, double x, double y)

Parameters

fromSrid int
toSrid int
x double
y double

Returns

Vertex

Convert(int, int, Feature)

public static Feature Convert(int fromSrid, int toSrid, Feature feature)

Parameters

fromSrid int
toSrid int
feature Feature

Returns

Feature

Convert(int, int, PointShape)

public static PointShape Convert(int fromSrid, int toSrid, PointShape sourcePoint)

Parameters

fromSrid int
toSrid int
sourcePoint PointShape

Returns

PointShape

Convert(int, int, RectangleShape)

public static RectangleShape Convert(int fromSrid, int toSrid, RectangleShape rectangleShape)

Parameters

fromSrid int
toSrid int
rectangleShape RectangleShape

Returns

RectangleShape

Convert(int, string, IEnumerable<Feature>)

public static IEnumerable<Feature> Convert(int fromSrid, string toProjString, IEnumerable<Feature> features)

Parameters

fromSrid int
toProjString string
features IEnumerable<Feature>

Returns

IEnumerable<Feature>

Convert(int, string, IEnumerable<Vertex>)

public static IEnumerable<Vertex> Convert(int fromSrid, string toProjString, IEnumerable<Vertex> vertices)

Parameters

fromSrid int
toProjString string
vertices IEnumerable<Vertex>

Returns

IEnumerable<Vertex>

Convert(int, string, double, double)

public static Vertex Convert(int fromSrid, string toProjString, double x, double y)

Parameters

fromSrid int
toProjString string
x double
y double

Returns

Vertex

Convert(int, string, Feature)

public static Feature Convert(int fromSrid, string toProjString, Feature feature)

Parameters

fromSrid int
toProjString string
feature Feature

Returns

Feature

Convert(int, string, PointShape)

public static PointShape Convert(int fromSrid, string toProjString, PointShape sourcePoint)

Parameters

fromSrid int
toProjString string
sourcePoint PointShape

Returns

PointShape

Convert(int, string, RectangleShape)

public static RectangleShape Convert(int fromSrid, string toProjString, RectangleShape rectangleShape)

Parameters

fromSrid int
toProjString string
rectangleShape RectangleShape

Returns

RectangleShape

Convert(string, int, IEnumerable<Feature>)

public static IEnumerable<Feature> Convert(string fromProjString, int toSrid, IEnumerable<Feature> features)

Parameters

fromProjString string
toSrid int
features IEnumerable<Feature>

Returns

IEnumerable<Feature>

Convert(string, int, IEnumerable<Vertex>)

public static IEnumerable<Vertex> Convert(string fromProjString, int toSrid, IEnumerable<Vertex> vertices)

Parameters

fromProjString string
toSrid int
vertices IEnumerable<Vertex>

Returns

IEnumerable<Vertex>

Convert(string, int, double, double)

public static Vertex Convert(string fromProjString, int toSrid, double x, double y)

Parameters

fromProjString string
toSrid int
x double
y double

Returns

Vertex

Convert(string, int, Feature)

public static Feature Convert(string fromProjString, int toSrid, Feature feature)

Parameters

fromProjString string
toSrid int
feature Feature

Returns

Feature

Convert(string, int, PointShape)

public static PointShape Convert(string fromProjString, int toSrid, PointShape sourcePoint)

Parameters

fromProjString string
toSrid int
sourcePoint PointShape

Returns

PointShape

Convert(string, int, RectangleShape)

public static RectangleShape Convert(string fromProjString, int toSrid, RectangleShape rectangleShape)

Parameters

fromProjString string
toSrid int
rectangleShape RectangleShape

Returns

RectangleShape

Convert(string, string, IEnumerable<Feature>)

public static IEnumerable<Feature> Convert(string fromProjString, string toProjString, IEnumerable<Feature> features)

Parameters

fromProjString string
toProjString string
features IEnumerable<Feature>

Returns

IEnumerable<Feature>

Convert(string, string, IEnumerable<Vertex>)

public static IEnumerable<Vertex> Convert(string fromProjString, string toProjString, IEnumerable<Vertex> vertices)

Parameters

fromProjString string
toProjString string
vertices IEnumerable<Vertex>

Returns

IEnumerable<Vertex>

Convert(string, string, double, double)

public static Vertex Convert(string fromProjString, string toProjString, double x, double y)

Parameters

fromProjString string
toProjString string
x double
y double

Returns

Vertex

Convert(string, string, Feature)

public static Feature Convert(string fromProjString, string toProjString, Feature feature)

Parameters

fromProjString string
toProjString string
feature Feature

Returns

Feature

Convert(string, string, PointShape)

public static PointShape Convert(string fromProjString, string toProjString, PointShape sourcePoint)

Parameters

fromProjString string
toProjString string
sourcePoint PointShape

Returns

PointShape

Convert(string, string, RectangleShape)

public static RectangleShape Convert(string fromProjString, string toProjString, RectangleShape rectangleShape)

Parameters

fromProjString string
toProjString string
rectangleShape RectangleShape

Returns

RectangleShape

Convert(Projection, Projection, IEnumerable<Feature>)

public static IEnumerable<Feature> Convert(Projection fromProjection, Projection toProjection, IEnumerable<Feature> features)

Parameters

fromProjection Projection
toProjection Projection
features IEnumerable<Feature>

Returns

IEnumerable<Feature>

Convert(Projection, Projection, IEnumerable<Vertex>)

public static IEnumerable<Vertex> Convert(Projection fromProjection, Projection toProjection, IEnumerable<Vertex> vertices)

Parameters

fromProjection Projection
toProjection Projection
vertices IEnumerable<Vertex>

Returns

IEnumerable<Vertex>

Convert(Projection, Projection, double, double)

public static Vertex Convert(Projection fromProjection, Projection toProjection, double x, double y)

Parameters

fromProjection Projection
toProjection Projection
x double
y double

Returns

Vertex

Convert(Projection, Projection, Feature)

public static Feature Convert(Projection fromProjection, Projection toProjection, Feature feature)

Parameters

fromProjection Projection
toProjection Projection
feature Feature

Returns

Feature

Convert(Projection, Projection, PointShape)

public static PointShape Convert(Projection fromProjection, Projection toProjection, PointShape sourcePoint)

Parameters

fromProjection Projection
toProjection Projection
sourcePoint PointShape

Returns

PointShape

Convert(Projection, Projection, RectangleShape)

public static RectangleShape Convert(Projection fromProjection, Projection toProjection, RectangleShape rectangleShape)

Parameters

fromProjection Projection
toProjection Projection
rectangleShape RectangleShape

Returns

RectangleShape

ConvertToExternalProjection(IEnumerable<Feature>)

public Collection<Feature> ConvertToExternalProjection(IEnumerable<Feature> features)

Parameters

features IEnumerable<Feature>

Returns

Collection<Feature>

ConvertToExternalProjection(IEnumerable<Vertex>)

This method returns projected vertices based on the coordinates passed in.

public Collection<Vertex> ConvertToExternalProjection(IEnumerable<Vertex> vertices)

Parameters

vertices IEnumerable<Vertex>

This parameter is the vertices that will be projected.

Returns

Collection<Vertex>

This method returns projected vertices based on the coordinates passed in.

Remarks

This method returns a projected vertex based on the coordinates passed in. You will need to override this method for the Projection class. Typically, you can call the projection utility library that has interfaces for dozens of different types of projections.

ConvertToExternalProjection(double, double)

This method returns a projected vertex based on the coordinates passed in.

public Vertex ConvertToExternalProjection(double x, double y)

Parameters

x double

This parameter is the X decimalDegreesValue of the point that will be projected.

y double

This parameter is the Y decimalDegreesValue of the point that will be projected.

Returns

Vertex

This method returns a projected vertex based on the coordinates passed in.

Remarks

This method returns a projected vertex based on the coordinates passed in.

As this is a concrete public method that wraps a Core method, we reserve the right to add events and other logic to pre- or post-process data returned by the Core version of the method. In this way, we leave our framework open on our end, but also allow you the developer to extend our logic to suit your needs. If you have questions about this, please contact our support team as we would be happy to work with you on extending our framework.

ConvertToExternalProjection(BaseShape)

This method returns a projected BaseShape based on the baseShape passed in.

public BaseShape ConvertToExternalProjection(BaseShape baseShape)

Parameters

baseShape BaseShape

This parameter is the baseShape (in decimalDegreesValue) to be projected.

Returns

BaseShape

This method returns a projected baseShape for the passed-in BaseShape.

Remarks

This method returns a projected baseShape based on the BaseShape passed in.

As this is a concrete public method that wraps a Core method, we reserve the right to add events and other logic to pre- or post-process data returned by the Core version of the method. In this way, we leave our framework open on our end, but also allow you the developer to extend our logic to suit your needs. If you have questions about this, please contact our support team as we would be happy to work with you on extending our framework.

ConvertToExternalProjection(Feature)

This method returns a projected Feature based on the Feature passed in.

public Feature ConvertToExternalProjection(Feature feature)

Parameters

feature Feature

This parameter is the Feature that contains a BaseShape in decimalDegreesValue to be projected.

Returns

Feature

This method returns a projected Feature for the passed-in Feature.

Remarks

This method returns a projected Feature based on the Feature passed in.

As this is a concrete public method that wraps a Core method, we reserve the right to add events and other logic to pre- or post-process data returned by the Core version of the method. In this way, we leave our framework open on our end, but also allow you the developer to extend our logic to suit your needs. If you have questions about this, please contact our support team as we would be happy to work with you on extending our framework.

ConvertToExternalProjection(GeoImage, RectangleShape)

public RasterProjectionResult ConvertToExternalProjection(GeoImage image, RectangleShape imageExtent)

Parameters

image GeoImage
imageExtent RectangleShape

Returns

RasterProjectionResult

ConvertToExternalProjection(GeoImage, RectangleShape, RectangleShape)

public RasterProjectionResult ConvertToExternalProjection(GeoImage image, RectangleShape imageExtent, RectangleShape targetExtent)

Parameters

image GeoImage
imageExtent RectangleShape
targetExtent RectangleShape

Returns

RasterProjectionResult

ConvertToExternalProjection(GeoImage, RectangleShape, RectangleShape, int, int)

public RasterProjectionResult ConvertToExternalProjection(GeoImage image, RectangleShape imageExtent, RectangleShape targetExtent, int width, int height)

Parameters

image GeoImage
imageExtent RectangleShape
targetExtent RectangleShape
width int
height int

Returns

RasterProjectionResult

ConvertToExternalProjection(RectangleShape)

This method returns a projected rectangle based on the rectangle passed in.

public RectangleShape ConvertToExternalProjection(RectangleShape rectangleShape)

Parameters

rectangleShape RectangleShape

This parameter represents the rectangle you want to project.

Returns

RectangleShape

This method returns a projected rectangle based on the rectangle passed in.

Remarks

This method returns a projected rectangle based on the rectangle passed in.

ConvertToExternalProjectionCore(IEnumerable<Vertex>)

This method returns projected vertices based on the coordinates passed in.

protected virtual Collection<Vertex> ConvertToExternalProjectionCore(IEnumerable<Vertex> verticies)

Parameters

verticies IEnumerable<Vertex>

Returns

Collection<Vertex>

This method returns projected vertices based on the coordinates passed in.

Remarks

This method returns a projected vertex based on the coordinates passed in. You will need to override this method for the Projection class. Typically, you can call the projection utility library that has interfaces for dozens of different types of projections.

ConvertToExternalProjectionCore(GeoImage, RectangleShape, RectangleShape, int, int)

protected virtual RasterProjectionResult ConvertToExternalProjectionCore(GeoImage image, RectangleShape imageExtent, RectangleShape targetExtent, int width, int height)

Parameters

image GeoImage
imageExtent RectangleShape
targetExtent RectangleShape
width int
height int

Returns

RasterProjectionResult

ConvertToInternalProjection(IEnumerable<Vertex>)

This method returns de-projected vertices based on the coordinates passed in.

public Collection<Vertex> ConvertToInternalProjection(IEnumerable<Vertex> vertices)

Parameters

vertices IEnumerable<Vertex>

This parameter is the vertices that will be de-projected.

Returns

Collection<Vertex>

This method returns de-projected vertices based on the coordinates passed in.

Remarks

This method returns a de-projected vertex based on the coordinates passed in. The de-projection is important because, inside of the FeatureSource, you will in many cases go to and from various projections.

ConvertToInternalProjection(double, double)

This method returns a de-projected vertex based on the coordinates passed in.

public Vertex ConvertToInternalProjection(double x, double y)

Parameters

x double

This parameter is the X decimalDegreesValue of the point that will be de-projected.

y double

This parameter is the Y decimalDegreesValue of the point that will be de-projected.

Returns

Vertex

This method returns a de-projected vertex based on the coordinates passed in.

Remarks

This method returns a de-projected vertex based on the coordinates passed in.

As this is a concrete public method that wraps a Core method, we reserve the right to add events and other logic to pre- or post-process data returned by the Core version of the method. In this way, we leave our framework open on our end, but also allow you the developer to extend our logic to suit your needs. If you have questions about this, please contact our support team as we would be happy to work with you on extending our framework.

ConvertToInternalProjection(BaseShape)

This method returns a de-projected BaseShape based on the BaseShape passed in.

public BaseShape ConvertToInternalProjection(BaseShape baseShape)

Parameters

baseShape BaseShape

This parameter is the baseShape (in decimalDegreesValue) to be de-projected.

Returns

BaseShape

This method returns a de-projected BaseShape for the passed in BaseShape.

Remarks

This method returns a de-projected BaseShape based on the BaseShape passed in.

As this is a concrete public method that wraps a Core method, we reserve the right to add events and other logic to pre- or post-process data returned by the Core version of the method. In this way, we leave our framework open on our end, but also allow you the developer to extend our logic to suit your needs. If you have questions about this, please contact our support team as we would be happy to work with you on extending our framework.

ConvertToInternalProjection(Feature)

This method returns a de-projected Feature based on the Feature passed in.

public Feature ConvertToInternalProjection(Feature feature)

Parameters

feature Feature

This parameter is the Feature that contains a BaseShape in decimalDegreesValue to be de-projected.

Returns

Feature

This method returns a de-projected Feature for the passed-in Feature.

Remarks

This method returns a de-projected Feature based on the Feature passed in.

As this is a concrete public method that wraps a Core method, we reserve the right to add events and other logic to pre- or post-process data returned by the Core version of the method. In this way, we leave our framework open on our end, but also allow you the developer to extend our logic to suit your needs. If you have questions about this, please contact our support team as we would be happy to work with you on extending our framework.

ConvertToInternalProjection(RectangleShape)

This method returns a de-projected rectangle based on the rectangle passed in.

public RectangleShape ConvertToInternalProjection(RectangleShape rectangleShape)

Parameters

rectangleShape RectangleShape

This parameter represents the rectangle you want to de-project.

Returns

RectangleShape

This method returns a de-projected rectangle based on the rectangle passed in.

Remarks

This method returns a de-projected rectangle based on the rectangle passed in.

ConvertToInternalProjectionCore(IEnumerable<Vertex>)

This method returns de-projected vertices based on the coordinates passed in.

protected virtual Collection<Vertex> ConvertToInternalProjectionCore(IEnumerable<Vertex> verticies)

Parameters

verticies IEnumerable<Vertex>

Returns

Collection<Vertex>

This method returns de-projected vertices based on the coordinates passed in.

Remarks

This method returns a de-projected vertex based on the coordinates passed in. You will need to override this method for the Projection class. Typically, you can call the projection utility library that has interfaces for dozens of different types of projections. The de-projection is important because, inside of the FeatureSource, you will in many cases go to and from various projections.

Open()

This method opens the projection and gets it ready to use.

public void Open()

Remarks

This method opens the projection and gets it ready to use.

As this is a concrete public method that wraps a Core method, we reserve the right to add events and other logic to pre- or post-process data returned by the Core version of the method. In this way, we leave our framework open on our end, but also allow you the developer to extend our logic to suit your needs. If you have questions about this, please contact our support team as we would be happy to work with you on extending our framework.

OpenCore()

This method opens the projection and gets it ready to use.

protected virtual void OpenCore()

Remarks

As this is the core version of the Open method, it is intended to be overridden in an inherited version of the class. When overriding, you will be responsible for getting the projection classes' state ready for doing projections.