The WKT specification allows both period and comma to be the decimal separator in floating-point numbers (section 7.2.1):

<decimal point> ::= <period> | <comma>

However, a comma could result in ambiguous WKT representations. In this example, the polygon is specified with five points, but the WKT could also be parsed as having three points:

POLYGON((0 0,0 1,1 1,1 0,0 0))

I'm assuming that nobody deliberately uses , as decimal separator, but is that really true?

Is there any reason to try to parse numbers in WKT with ,? Or shouly I assume that the specification is just buggy?

  • 2
    in some locales it is perfectly normal to use , as decimal separator. en.wikipedia.org/wiki/Decimal_mark
    – Ian Turton
    May 17, 2013 at 13:58
  • But why should WKT representations be locale sensitive?
    – CL.
    May 17, 2013 at 13:59
  • but why should they not?
    – Ian Turton
    May 17, 2013 at 14:01
  • Because you'd get ambiguities, as shown in the question.
    – CL.
    May 17, 2013 at 14:03
  • 1
    I think the interpretation of white space removes those ambiguities, from a parsing perspective.
    – L_Holcombe
    May 17, 2013 at 14:15

2 Answers 2


Because the coordinate pairs must be separated with a comma, and whitespace is treated as a separator between numbers in a coordinate pair, such ambiguities can be easily worked out by the parser.

(I personally think this is an example of something that could and should be internationally standardized - but then again, I'm also an American who has trouble with the metric system.)

POLYGON((0 0,0 1,1 1,1 0,0 0)) 

is not ambiguous, because the number of values for a point cannot be 3 (that would be POLYGON M or POLYGON Z).

That said, at least SpatiaLite doesn't support comma as a decimal separator. I didn't try other applications.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.