Registered Member
|
I want to add more information to my gpx file such as : flag="yes".
so insteaf of: <trkpt lon="34.76601" lat="32.07308" /> I write: <trkpt lon="34.76601" lat="32.07308" flag="YES"/> the function "MarbleModel::addGeoDataFile" works with it perfectly - it presents the track on the map, but I'd really like somehow to access the 'flag' info. since all track points are stored in GeoDataObject object, I was wondering if I can access from it , the 'flag' info. maybe somehow - given a location from the gpx file I can get the original text that gave me this location? thanks |
KDE Developer
|
The change (additional flag tag) is not allowed for gpx files. Custom data can only be added via the extensions tag. Marble (currently) does not extract that information.
You'll get much more flexibility if you use .kml files instead of .gpx. Note that you can convert existing .gpx files to .kml. KML offers much more elements and one of the existing ones might be all you need. If not, you can use the ExtendedData field. Marble extracts it and makes it available to you as well. We have a KML Guide to get started with links to further documentation. |
Registered Member
|
Thank you for you reply . It is very helpful. How can I use the ExtendedData field? is it posible to add this feild to each point? for example: <trkpt lon="34.76602" lat="32.07308"> <ExtendedData> <Data name="string"> <displayName>...</displayName> <value>...</value> </Data> </ExtendedData> <trkpt lon="34.76589999" lat="32.07278"/> <ExtendedData> <Data name="string"> <displayName>...</displayName> <value>...</value> </Data> </ExtendedData> and how can I access this information? also - I couldn't add a kml through MarbleModel::addGeoDataFile. is there some other way to add it? I tried to use marbleModel->bookmarkManager()->loadFile("filePath.kml") - but it returns false - which indicates that the file wasn't loaded properly ( the file is OK - tried it in other places) |
Registered Member
|
I read more about the kml parser. I used : GeoDataParser parser( GeoData_KML ); QFile file( filePath); file.open( QIODevice::ReadOnly ); if ( !parser.read( &file ) ) { qDebug( "Could not parse file!" ); return; } GeoDataDocument* document = dynamic_cast<GeoDataDocument*>(parser.releaseDocument() ); int count = document->placemarkList().count(); but count is 0. why? I have a valid kml file. why is this not working? ( I just want to add that when I use the function MabelModel::addGeoDataFile(filePath) the path IS presented on the map. - so I'm sure the kml file is ok). thank you |
Registered users: bancha, Bing [Bot], Evergrowing, Google [Bot], lockheed, mesutakcan, Sogou [Bot]