NoRyb
NoRyb

Reputation: 1544

OpenLayers 3: 3D WKT-Point

I have some SqlGeometries in my SQL-Database which represent points and include a Z-Coordinate.

As soon as I use ol.format.WKT().readFeature('POINT (1 2 3)', { ... }) I get the following error:

Error: Unexpected `445.332` at position 29 in `POINT (600000.631 200000.848 445.332)`
   at ol.format.WKT.Parser.prototype.parsePointText_ (http://localhost:33464/app/lib/openLayers/ol-debug.js:94728:3)
   at ol.format.WKT.Parser.prototype.parseGeometry_ (http://localhost:33464/app/lib/openLayers/ol-debug.js:94687:7)
   at ol.format.WKT.Parser.prototype.parse (http://localhost:33464/app/lib/openLayers/ol-debug.js:94663:3)
   at ol.format.WKT.prototype.parse_ (http://localhost:33464/app/lib/openLayers/ol-debug.js:94287:3)
   at ol.format.WKT.prototype.readGeometryFromText (http://localhost:33464/app/lib/openLayers/ol-debug.js:94368:3)
   at ol.format.WKT.prototype.readFeatureFromText (http://localhost:33464/app/lib/openLayers/ol-debug.js:94307:3)
   at ol.format.TextFeature.prototype.readFeature (http://localhost:33464/app/lib/openLayers/ol-debug.js:84053:3)

Now I don't mind that OpenLayers is not able to handle 3D coordinates but can I somehow tell it to just ignore the 3rd value instead of raising an error?

Upvotes: 2

Views: 858

Answers (1)

CindyB
CindyB

Reputation: 11

You have to use POINTZ() instead of POINT() because it's in 3D.

Upvotes: 0

Related Questions