Skip to content

ProjectionConverter

Namespace: ThinkGeo.Core

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

public class ProjectionConverter

Inheritance Object → ProjectionConverter

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.

Properties

DecimalDegreeBoundary

public RectangleShape DecimalDegreeBoundary { get; set; }

Property Value

RectangleShape

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

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

IsOpen

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

public bool IsOpen { get; protected set; }

Property Value

Boolean

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.

CanConvertRasterToExternalProjection

public bool CanConvertRasterToExternalProjection { get; protected set; }

Property Value

Boolean

InternalProjectionUnit

public GeographyUnit InternalProjectionUnit { get; }

Property Value

GeographyUnit

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(String, String)

public ProjectionConverter(string internalProjString, string externalProjString)

Parameters

internalProjString String

externalProjString String

ProjectionConverter(Int32, Int32)

public ProjectionConverter(int internalSrid, int externalSrid)

Parameters

internalSrid Int32

externalSrid Int32

ProjectionConverter(String, Int32)

public ProjectionConverter(string internalProjString, int externalSrid)

Parameters

internalProjString String

externalSrid Int32

ProjectionConverter(Int32, String)

public ProjectionConverter(int internalSridString, string externalProjString)

Parameters

internalSridString Int32

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.

Methods

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, RectangleShape)

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

Parameters

fromProjString String

toProjString String

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

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.

ConvertToExternalProjection(GeoImage, RectangleShape, RectangleShape, Int32, Int32)

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

Parameters

image GeoImage

imageExtent RectangleShape

targetExtent RectangleShape

width Int32

height Int32

Returns

RasterProjectionResult

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

ConvertToExternalProjectionCore(GeoImage, RectangleShape, RectangleShape, Int32, Int32)

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

Parameters

image GeoImage

imageExtent RectangleShape

targetExtent RectangleShape

width Int32

height Int32

Returns

RasterProjectionResult

OpenCore()

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

protected 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.

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 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.

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(IEnumerable<Feature>)

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

Parameters

features IEnumerable<Feature>

Returns

Collection<Feature>

UpdateToExternalProjection(Feature)

internal void UpdateToExternalProjection(Feature feature)

Parameters

feature Feature

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 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.

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.

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(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(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 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.

UpdateToInternalProjection(Feature)

internal void UpdateToInternalProjection(Feature feature)

Parameters

feature Feature

Convert(Int32, Int32, PointShape)

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

Parameters

fromSrid Int32

toSrid Int32

sourcePoint PointShape

Returns

PointShape

Convert(Int32, Int32, Feature)

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

Parameters

fromSrid Int32

toSrid Int32

feature Feature

Returns

Feature

Convert(Int32, Int32, RectangleShape)

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

Parameters

fromSrid Int32

toSrid Int32

rectangleShape RectangleShape

Returns

RectangleShape

Convert(Int32, Int32, IEnumerable<Feature>)

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

Parameters

fromSrid Int32

toSrid Int32

features IEnumerable<Feature>

Returns

IEnumerable<Feature>

Convert(Int32, Int32, IEnumerable<Vertex>)

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

Parameters

fromSrid Int32

toSrid Int32

vertices IEnumerable<Vertex>

Returns

IEnumerable<Vertex>

Convert(Int32, Int32, Double, Double)

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

Parameters

fromSrid Int32

toSrid Int32

x Double

y Double

Returns

Vertex

Convert(Int32, String, PointShape)

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

Parameters

fromSrid Int32

toProjString String

sourcePoint PointShape

Returns

PointShape

Convert(Int32, String, Feature)

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

Parameters

fromSrid Int32

toProjString String

feature Feature

Returns

Feature

Convert(Int32, String, RectangleShape)

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

Parameters

fromSrid Int32

toProjString String

rectangleShape RectangleShape

Returns

RectangleShape

Convert(Int32, String, IEnumerable<Feature>)

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

Parameters

fromSrid Int32

toProjString String

features IEnumerable<Feature>

Returns

IEnumerable<Feature>

Convert(Int32, String, IEnumerable<Vertex>)

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

Parameters

fromSrid Int32

toProjString String

vertices IEnumerable<Vertex>

Returns

IEnumerable<Vertex>

Convert(Int32, String, Double, Double)

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

Parameters

fromSrid Int32

toProjString String

x Double

y Double

Returns

Vertex

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, Feature)

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

Parameters

fromProjection Projection

toProjection Projection

feature Feature

Returns

Feature

Convert(Projection, Projection, RectangleShape)

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

Parameters

fromProjection Projection

toProjection Projection

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(String, Int32, PointShape)

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

Parameters

fromProjString String

toSrid Int32

sourcePoint PointShape

Returns

PointShape

Convert(String, Int32, Feature)

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

Parameters

fromProjString String

toSrid Int32

feature Feature

Returns

Feature

Convert(String, Int32, RectangleShape)

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

Parameters

fromProjString String

toSrid Int32

rectangleShape RectangleShape

Returns

RectangleShape

Convert(String, Int32, IEnumerable<Feature>)

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

Parameters

fromProjString String

toSrid Int32

features IEnumerable<Feature>

Returns

IEnumerable<Feature>

Convert(String, Int32, IEnumerable<Vertex>)

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

Parameters

fromProjString String

toSrid Int32

vertices IEnumerable<Vertex>

Returns

IEnumerable<Vertex>

Convert(String, Int32, Double, Double)

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

Parameters

fromProjString String

toSrid Int32

x Double

y Double

Returns

Vertex

Convert(String, String, PointShape)

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

Parameters

fromProjString String

toProjString String

sourcePoint PointShape

Returns

PointShape