Index: pages/geopoly.in ================================================================== --- pages/geopoly.in +++ pages/geopoly.in @@ -8,11 +8,11 @@ The Geopoly module is an alternative interface to the [R-Tree extension] that uses the [http://geojson.org | GeoJSON] notation ([https://tools.ietf.org/html/rfc7946 | RFC-7946]) to describe two-dimensional polygons. Geopoly includes functions for detecting when one polygon is contained within or overlaps with another, for computing the -area enclosed by a polygon, for doing linear trasformations of polygons, +area enclosed by a polygon, for doing linear transformations of polygons, for rendering polygons as [https://en.wikipedia.org/wiki/Scalable_Vector_Graphics | SVG], and other similar operations.

@@ -49,11 +49,11 @@ of the polygon and the area to the left is inside the polygon. In other words, the net rotation of the vertexes is counter-clockwise.

For example, the following JSON describes an isosceles triangle, sitting -on the X access and with an area of 0.5: +on the X axis and with an area of 0.5: [[0,0],[1,0],[0.5,1],[0,0]] @@ -117,11 +117,11 @@ overlaps the polygon in the \$query_polygon parameter. The geopoly_within() function works similarly, but only returns rows for which the _shape is completely contained within \$query_polygon.

-Querys (and also DELETE and UPDATE statements) in which the WHERE +Queries (and also DELETE and UPDATE statements) in which the WHERE clause contains a bare geopoly_overlap() or geopoly_within() function make use of the underly R*Tree data structures for a fast lookup that only has to examine a subset of the rows in the table. The number of rows examines depends, of course, on the size of the \$query_polygon. Large \$query_polygons will normally need to look at more rows than small @@ -148,11 +148,11 @@ true if there is any overlap between P1 and P2, or it returns false if P1 and P2 completely disjoint. If either P1 or P2 is not a polygon, this routine returns NULL.

-The geopoly_overlap(P1,p2) function is special in that the geopoly virtual +The geopoly_overlap(P1,P2) function is special in that the geopoly virtual table knows how to use R*Tree indexes to optimize queries in which the WHERE clause uses geopoly_overlap() as a boolean function. Only the geopoly_overlap(P1,P2) and geopoly_within(P1,P2) functions have this capability. @@ -164,11 +164,11 @@ true if P2 is completely contained within P1, or it returns false if any part of P2 is outside of P1. If P1 and P2 are the same polygon, this routine returns true. If either P1 or P2 is not a polygon, this routine returns NULL.

-The geopoly_within(P1,p2) function is special in that the geopoly virtual +The geopoly_within(P1,P2) function is special in that the geopoly virtual table knows how to use R*Tree indexes to optimize queries in which the WHERE clause uses geopoly_within() as a boolean function. Only the geopoly_within(P1,P2) and geopoly_overlap(P1,P2) functions have this capability. @@ -190,11 +190,11 @@ hd_fragment gjson geopoly_json

## The geopoly_json(P) Function

If P is a polygon, then geopoly_json(P) returns the GeoJSON representation -of that polygon as a TEPT string. +of that polygon as a TEXT string. If P is not a polygon, geopoly_json(P) returns NULL. hd_fragment gsvg geopoly_svg

## The geopoly_svg(P,...) Function

@@ -222,12 +222,12 @@ hd_fragment gbbox geopoly_bbox

## The geopoly_bbox(P) Function

-If P is a polygon, then geopoly_bbox(P) returns the a new polygon that is -the smallest rectangle completely enclosing P. +If P is a polygon, then geopoly_bbox(P) returns a new polygon that is +the smallest (axis-aligned) rectangle completely enclosing P. If P is not a polygon, geopoly_bbox(P) returns NULL. hd_fragment gpoint geopoly_constains_point

## The geopoly_contains_point(P,X,Y) Function

@@ -239,11 +239,11 @@ hd_fragment xform geopoly_xform

## The geopoly_xform(P,A,B,C,D,E,F) Function

The geopoly_xform(P,A,B,C,D,E,F) returns a new polygon that is a -linear transformation of the polygon P and where the transformation +affine transformation of the polygon P and where the transformation is defined by values A,B,C,D,E,F. If P is not a valid polygon, this routine returns NULL.

The transformation converts each vertex of the polygon according to the @@ -278,17 +278,17 @@

## Binary Encoding of Polygons

Geopoly stores all polygons internally using a binary format. A binary -polygon consists of a 4-byte header following by an array coordinate -pairs which each dimension of each coordinate is of 32-byte floating point +polygon consists of a 4-byte header following by an array of coordinate +pairs in which each dimension of each coordinate is of 32-byte floating point number.

The first byte of the header is a flag byte. The least significant bit -of the flag byte determines whether the coordinate pairs the follow the +of the flag byte determines whether the coordinate pairs that follow the header are stored big-endian or little-endian. A value of 0 for the least significant bit means big-endian and a value of 1 means little endian. Other bits of the first byte in the header are reserved for future expansion.