Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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?

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

2 Answers

up vote 0 down vote accepted

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.)

share|improve this answer
add comment
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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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