GeocProjection

GeocProjection — Povides conversion services between 'geo' coordinates and 'user' coordinates.

Synopsis

                    GeocProjectionPrivate;
                    GeocProjectionClassPrivate;
                    GeocProjection;
gboolean            geoc_projection_g2w                 (GeocProjection *projection,
                                                         double lon,
                                                         double lat,
                                                         double *wx,
                                                         double *wy);
gboolean            geoc_projection_w2g                 (GeocProjection *projection,
                                                         double wx,
                                                         double wy,
                                                         double *lon,
                                                         double *lat);
const GList*        geoc_projection_get_available_projections
                                                        (void);

Object Hierarchy

  GObject
   +----GeocProjection

Properties

  "cylindrical"              gboolean              : Read
  "geoproj"                  gpointer              : Read / Write
  "hemisphere"               gboolean              : Read
  "projstring"               gchar*                : Read / Write
  "reference"                gpointer              : Read / Write
  "reflat"                   gdouble               : Read / Write
  "reflon"                   gdouble               : Read / Write
  "rotation"                 gpointer              : Read / Write
  "rotdeg"                   gdouble               : Read / Write

Description

The GeocProjection object is a GObject wrapper around the tkgeomap geography and geoProj native code. It provides conversion services between 'geo' and 'user' coordinates. For the most part, this object should be sufficient for doing basic coordinate conversion; however, for more complex operations the tkgeomap native code should be used.

Several components of the tkgeomap project have been included in this project, but they have not been documented here because they are well documented by the tkgeomap project. Man pages for these components are available at this project's homepage.

The below example uses GeocProjection to convert cursor position to longitude and latitude:

double ux, uy, lon, lat;
ux = event->motion.x;
uy = event->motion.y;
cairo_matrix_transform_point(inverse_matrix, &ux, &uy);
geo_projection_w2g(projection, ux, uy, &lon, &lat);

Details

GeocProjectionPrivate

typedef struct _GeocProjectionPrivate GeocProjectionPrivate;


GeocProjectionClassPrivate

typedef struct _GeocProjectionClassPrivate GeocProjectionClassPrivate;


GeocProjection

typedef struct _GeocProjection GeocProjection;


geoc_projection_g2w ()

gboolean            geoc_projection_g2w                 (GeocProjection *projection,
                                                         double lon,
                                                         double lat,
                                                         double *wx,
                                                         double *wy);

This procedure converts geographic coordinates to canvas world coordinates based on the current projection, reference, and rotation.

projection :

lon :

Geocgraphic longitude in degrees.

lat :

Geocgraphic latitude in degrees.

wx :

Canvas world coordinates returned.

wy :

Canvas world coordinates returned.

Returns :

False if the geo point cannot be displayed by this projection.

geoc_projection_w2g ()

gboolean            geoc_projection_w2g                 (GeocProjection *projection,
                                                         double wx,
                                                         double wy,
                                                         double *lon,
                                                         double *lat);

This procedure converts canvas world coordinates coordinates to geographic coordinates based on the current projection, reference, and rotation.

projection :

wx :

Canvas world coordinates returned.

wy :

Canvas world coordinates returned.

lon :

Geocgraphic longitude in degrees.

lat :

Geocgraphic latitude in degrees.

Returns :

True only if there is a valid geoc-point for this world point.

geoc_projection_get_available_projections ()

const GList*        geoc_projection_get_available_projections
                                                        (void);

This procedure returns a reference to the head of the linked list containing all of the available projection name strings. It can be used to fill the fields of a combo box.

Returns :

GList containing the available projection name strings.

Property Details

The "cylindrical" property

  "cylindrical"              gboolean              : Read

Is this ia cylindrical projection.

Default value: TRUE


The "geoproj" property

  "geoproj"                  gpointer              : Read / Write

The type of projection.


The "hemisphere" property

  "hemisphere"               gboolean              : Read

Is this a hemisphere projection.

Default value: TRUE


The "projstring" property

  "projstring"               gchar*                : Read / Write

Use this from a combo box.

Default value: "Mercator"


The "reference" property

  "reference"                gpointer              : Read / Write

Center of the projection.


The "reflat" property

  "reflat"                   gdouble               : Read / Write

Latitude of reference point.

Allowed values: [-90,90]

Default value: 0


The "reflon" property

  "reflon"                   gdouble               : Read / Write

Longitude of reference point.

Allowed values: [-360,360]

Default value: 0


The "rotation" property

  "rotation"                 gpointer              : Read / Write

Rotation of the map.


The "rotdeg" property

  "rotdeg"                   gdouble               : Read / Write

Rotation in degrees.

Allowed values: [0,360]

Default value: 0