[OSGeo-Discuss] Parsing well-known text
Even Rouault
even.rouault at spatialys.com
Wed Sep 2 02:41:40 PDT 2020
Pierre,
> I just added code to PerfectTIN to read the variable-length records of a LAS
> file. I found a WKT record in a square of West Virginia terrain, with no
> line feeds; I added line feeds and indentation and attached it. The other
> point clouds do not have variable-length records. I'd like to heed the WKT
> units when loading a point cloud, if there is a WKT.
>
> I'm also working on a program called Wolkenbase (not public yet) which will
> separate ground from non-ground in a point cloud. If you load a point cloud
> with no unit information, I'd like to add a WKT that indicates only the unit
> and nothing else. What would that look like?
As far as I know, you can't create a CRS WKT with just unit information. The most minimal
content that validates the WKT1 grammar would be something like:
LOCAL_CS["unspecified CRS",
LOCAL_DATUM["unspecified datum",2000],
UNIT["metre",1,
AUTHORITY["EPSG","9001"]],
AXIS["Easting",EAST],
AXIS["Northing",NORTH]]
> Do you have code to parse and manipulate WKT? The WKT is in a std::string.
Yes, PROJ >= 6 has support for parsing and creating WKT in several versions of the WKT
standard.
See proj_create_from_wkt() at https://proj.org/development/reference/functions.html, and
all other proj_XXXX getters.
For creation of WKT, you might need the more advanced functions of
https://github.com/OSGeo/PROJ/blob/master/src/proj_experimental.h , before exporting
with proj_as_wkt()
GDAL's OGRSpatialReference class showcases using number of the above mentionned PROJ
functions:
https://github.com/OSGeo/gdal/blob/master/gdal/ogr/ogrspatialreference.cpp
You may also look at PDAL that uses PROJ and/or GDAL underneath to deal with LAS CRS:
https://pdal.io/tutorial/las.html#spatial-reference-system
Even
--
Spatialys - Geospatial professional services
http://www.spatialys.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/discuss/attachments/20200902/9969c290/attachment.html>
More information about the Discuss
mailing list