Bug 266366 - KmlcoordinateTagHandler can't handle space after comma in coordinates
Summary: KmlcoordinateTagHandler can't handle space after comma in coordinates
Status: RESOLVED FIXED
Alias: None
Product: marble
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: 1.1.0
Assignee: marble-bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-02-15 11:08 UTC by J Jones
Modified: 2012-11-24 11:28 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In: 1.5.0/KDE-4.10.0


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description J Jones 2011-02-15 11:08:32 UTC
Version:           unspecified (using KDE 4.4.5) 
OS:                Linux

In function
   GeoNode* KmlcoordinatesTagHandler::parse( GeoParser& parser )
in file 
   KmlcoordinateTagHandler .cpp

the line 53:
   QStringList  coordinatesLines = parser.readElementText().trimmed().split( QRegExp("\\s"), QString::SkipEmptyParts );

splits coordinates by spaces.
so <coordinates> -113.55, 52.5 </coordinates>
will be broken into two pairs because of the space in the middle

maybe a fancier QRegExpression? 

or a 

.replace(QRegExp("\\s*,\\s*"),",") thrown in there after the trimmed() in order to collapse spaces around commas?
as in:
QStringList  coordinatesLines = parser.readElementText().trimmed().replace(QRegExp("\\s*,\\s*"),",").split( QRegExp("\\s"), QString::SkipEmptyParts );


Reproducible: Always

Steps to Reproduce:
feed in a kml file with space around the commas in <coordinates>

Actual Results:  
bad kml points are skipped
(placemarks before and after in kml file are drawn though)

Expected Results:  
all placemarks drawn
Comment 1 Dennis Nienhüser 2012-11-24 11:28:30 UTC
Git commit af1fb70c7bdcc513c7e13a8d6ad417fe0853adf5 by Dennis Nienhüser.
Committed on 24/11/2012 at 12:23.
Pushed by nienhueser into branch 'master'.

Fix parsing coordinate strings that don't follow kml specs exactly.

Coordinates like '1, 2, 3 4 ,5, 6' are not valid coordinate strings
(should be '1,2,3 4,5,6') but can still be parsed.

Patch by Valery Kharitonov, thanks!
REVIEW: 103525
FIXED-IN: 1.5.0/KDE-4.10.0

M  +31   -2    src/lib/geodata/handlers/kml/KmlCoordinatesTagHandler.cpp

http://commits.kde.org/marble/af1fb70c7bdcc513c7e13a8d6ad417fe0853adf5