17 #include <grass/gis.h>
20 static struct Cell_head
window;
21 static double square_meters;
22 static int projection;
24 static double units_to_meters_squared = 0.0;
28 static double north_value;
30 static double (*darea0) (double);
56 switch (projection =
window.proj) {
68 north_value = darea0(north =
window.north);
74 square_meters *= (factor * factor);
75 return (factor > 0.0);
93 register double south_value;
94 register double cell_area;
96 if (projection != PROJECTION_LL)
100 north_value = darea0(north =
window.north - row *
window.ns_res);
102 south_value = darea0(north -=
window.ns_res);
103 cell_area = north_value - south_value;
106 north_value = south_value;
135 units_to_meters_squared = factor * factor;
138 units_to_meters_squared = 1.0;
169 if (projection == PROJECTION_LL)
double G_darea0_on_sphere(double lat)
Calculates integral for area between two latitudes.
int G_begin_zone_area_on_sphere(double r, double s)
Initialize calculations for sphere.
double G_area_of_polygon(const double *x, const double *y, int n)
Area in square meters of polygon.
int G_get_set_window(struct Cell_head *window)
Get the current working window.
double G_area_of_cell_at_row(int row)
Cell area in specified row.
int G_get_ellipsoid_parameters(double *a, double *e2)
get ellipsoid parameters
double G_planimetric_polygon_area(const double *x, const double *y, int n)
Calculates planimetric polygon area.
double G_darea0_on_ellipsoid(double lat)
Calculate integral for area between two latitudes.
int G_begin_zone_area_on_ellipsoid(double a, double e2, double s)
Begin area calculations for ellipsoid.
int G_begin_polygon_area_calculations(void)
Begin polygon area calculations.
int G_begin_cell_area_calculations(void)
Begin cell area calculations.
int G_begin_ellipsoid_polygon_area(double a, double e2)
Begin area calculations.
double G_ellipsoid_polygon_area(const double *lon, const double *lat, int n)
Area of lat-long polygon.
double G_database_units_to_meters_factor(void)
conversion to meters
int G_projection(void)
query cartographic projection