[postgis-users] WKT parsers

Mark Fredrickson mark.m.fredrickson at gmail.com
Sun May 20 19:59:56 PDT 2007


Thanks for the OpenLayers pointer. I had been reading through the
source, but didn't see those classes.

Paul wrote:
> I guess my answer could be phrased as a question: what are you going to
> do with the WKT once you parse it? Perhaps PostGIS needs another
> representation function (I'm sure we'll have an AsJSON soon enough...)

First, what I am doing? I've been working for the last week on a
geospatial package for the Drupal content management system[1], a PHP
CMS. I should be able to make an alpha release soon, with an
announcement on the postgis list (if anyone is interested they can
check out he source at [2]). The package defines an API for working
with geometries, and I've selected WKT as the markup format. As Regina
notes, WKT is useful in that it can be written to PostGIS directly:

> The only downside to the other formats aside from the WKB one is
> that PostGIS doesn't have comparable write back functions for those as we
> have for WKT (GeomFromText etc.).

I need WKT parsers for at least three purposes:

1. Checking the validity of user entered text: Right now, the only way
to get geo data into the system is directly entering WKT. Later, I
hope to provide other methods, but having a PHP level check for
correctness would be really helpful.

2. Database agnosticism: Most Drupal installs are on commodity MySQL
installs (boo! ;-). While these installs won't have the level of
precision of a PostGIS system, they should still have access to many
of the features by just storing the WKT as text. These installs will
have extra needs for checking correctness, etc.

3. Integration with JavaScript input/output methods: WKT is not the
most useful input format for humans. I'm working on some Google maps
(and later openlayers) integration to pick POINTS, LINESTRINGS, and
POLYGONS. Being able to generate WKT on the client side, and also
parsing WKT into gmaps/openlayers formats would be useful.

Cheers,

-Mark

[1] http://drupal.org/
[2] http://cvs.drupal.org/viewcvs/drupal/contributions/modules/geo/



More information about the postgis-users mailing list