Geom::WellKnownText

The Geo::WellKnownText module contains a single function:

from-wkt

from-wkt takes a single Str parameter, and returns a single Geo::Geometry object corresponding to the wkt specification, or a Failure if the contents of the string cannot be interpreted as a Geometry object.

The conversion is case-insensitive, and optional whitespace may be included in various places. Thus the following strings will all produce the same object:

    PointZ(123 456 789)
    Point Z (123 456 789)
    Point Z(123 456 789)
    pointz (123 456 789)

Geo::WellKnownText::Grammar

The Geo::WellKnownText::Grammar module contains a single grammar Geo::WellKnownText::Grammar::WKT.

This is the same grammar used by the Geo::WellKnownText module, but it can be used separately to parse WKT strings.

The general usage would be

    my $results = Geo::WellKnownText::Grammar::WKT.parse($string, actions => My::Actions);

The actions used by Geo::WellKnownText::from-wkt are available in Geo::WellKnownText::WKT-Actions, but in that case you might as well use from-wkt described above.

The actions class will need to include the following methods (36 in total):

Geometry type | Method | Available Parameters
Point[Z][M] | point[z][m] | $<value> ā€” an array containing the values for x, y, z and m as appropriate
LineString[Z][M] | linestring[z][m]-text | $<point[z][m]> ā€” an array of whatever the relevant point method passed to make.
LinearRing[Z][M] | linearring[z][m]-text | $<point[z][m]> ā€” and array of whatever the relevant point method passed to make.
Polygon[Z][M] | polygon[z][m]-text | $<linearring[z][m]-text ā€” an array of whatever the appropriate linearring-text method passed to make.
PolyhedralSurface[Z][M] | polyhedralsurface[z][m]-text | $<polygon[z][m]-text ā€” an array of whatever the appropriate polygon-text method passed to make.
MultiPoint[Z][M] | multipoint[z][m]-text | $<point[z][m]> ā€” an array of whatever the relevant point method passed to make.
MultiLineString[Z][M] | multilinestring[z][m]-text | $<linestring[z][m]-text> ā€” an array of whatever the relevant linestring-text method passed to make.
MultiPolygon[Z][M] | multipolygon[z][m]-text | $<polygon[z][m]-text ā€” an array of whatever the appropriate polygon-text method passed to make.
GeometryCollection[Z][M] | geometrycollection[z][m]-tagged-text | $<geometry[z][m]-tagged-text> ā€” an array of whatever the relevant geometry-text method passed to make.

Geo::WellKnownText v0.1.0

blah blah blah

Authors

  • Kevin Pye

License

Artistic-2.0

Dependencies

Test Dependencies

Provides

  • Geo::WellKnownText
  • Geo::WellKnownText::Grammar

The Camelia image is copyright 2009 by Larry Wall. "Raku" is trademark of the Yet Another Society. All rights reserved.