Summary: | kmz kml google export import | ||
---|---|---|---|
Product: | [Applications] digikam | Reporter: | Gerhard Hoogterp <gerhard> |
Component: | Geolocation-KMLExport | Assignee: | Digikam Developers <digikam-bugs-null> |
Status: | RESOLVED FIXED | ||
Severity: | wishlist | CC: | caulier.gilles, shadow.walker |
Priority: | NOR | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | Gentoo Packages | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | 0.1.0 | |
Sentry Crash Report: | |||
Attachments: |
kml export functionality
kml export functionality some little fixes for kmlexport |
Description
Gerhard Hoogterp
2007-01-08 22:24:37 UTC
I'm currently trying to make a kmlexport plugins (for already GPS-tagged images), for the moment it's a first draft, (everything is put in mess in kmlplugins directory), before releasing anything I'd like to cleanup everything and create a separated libkmldocument (still battle with kdevelop tonight) to keep the plugin as lightweight as I can. but you can already see a first result in googleearth by loading this file: http://stpo.homelinux.org/data/kmltest/kmldocument.kml or trying to see an optimized version for maps.google.com by loading this one on your browser: http://stpo.homelinux.org/data/kmltest2/kmldocument.kml Stephane, Why creating a new plugin for that ? Why not to extend the current GPSSync plugin witch can group all Geolocalization options for kipi host ? Tha advange is simple : starting time of host will not be increased by a new plugin to load. Gilles I looked at the google maps version - very nice! Just a few questions (more out of curiosity): How accurate are the GPS positions? They seem to be really good, though I am not 100% sure for example about img_1860_jpg.jpeg. Do you know which corner of the thumb corresponds to the actual position (or is it the center?) Is there any way to do similar things "locally", i.e. without uploading pictures + kml files to some webpage? (I don't really fancy of putting 15K+ images, one some webpage, not to mention the aspect of privacy ...) Side-remark: if I understood things correctly, for digikam it is planned in the longer run to have the GPS coordinates directly in the database. Best, Arnd Arnd, > Side-remark: if I understood things correctly, for digikam it is > planned in the longer run to have the GPS coordinates > directly in the database. Absolutly. We currently working on with Marcel. Only a draft is done). No changes is done in database actually. We prepare the new database tables for a future release (not 0.9.1, certainly later). Added new data tables in database is not a trivial stuff. We need to take a care. A dedicaced digiKam release only for that will be done. You can take a look into the current draft (not yet finalized, i need to add more informations) at the url below. You can see than not only GPS info will be stored in database in the future... http://wiki.kde.org/tiki-index.php?page=Digikam%20development%20discussion Gilles I had a look at your kml file, it is very nice ! I think this is really a nice feature. Arnd, if you do not want to put the kml online you can use google earth to open it. I don't think this is possible using google maps. Julien Arnd, > How accurate are the GPS positions? They seem to be really good, > though I am not 100% sure for example about img_1860_jpg.jpeg. these point position where not created with the correlator but added with the edit coorditate (but it seems that the positions slightly shift since last time I edt them, I heard Google change some maps positions sometime, mayby not acurate enough). > Do you know which corner of the thumb corresponds to the actual > position (or is it the center?) Since I haven't touched the Hotspot element of the iconstyle, I think it's the upper left corner. > Is there any way to do similar things "locally", i.e. > without uploading pictures + kml files to some webpage? Actually, you con choose either to create a kmlfile with relative path as in my first example, loading it in googleearth, and have everything will work with files either on local or on a webserver. But if you want the pictures appears on maps.google.com, you have to put the complete URL of picture and then have pictures on a webserver. ------- Gilles, > Why creating a new plugin for that ? Why not to extend the current GPSSync > plugin witch can group all Geolocalization options for kipi host ? > Tha advange is simple : starting time of host will not be increased by a > new plugin to load. Why not, I'm finishing to separate the lib creating kmldocument and the code for the export and I'll see how to do that but I warn you that since I haven't touched C++ almost ten years, it may be not beautiful/proprer/optimized :-) >Why not, I'm finishing to separate the lib creating kmldocument It will be a new shared library ? If yes, this is want mean that it will a new depency to kipi-plugins ? Why not include this code to plugin itself ? Can you give me more informations about ? In general, it better to limit external depency... >and the code for the export and I'll see how to do that but I warn you that since I haven't touched C++ almost ten years, it may be not beautiful/proprer/optimized :-) It's not a problem, i will help you... gilles > Actually, you con choose either to create a kmlfile with relative > path as in my first example, loading it in googleearth, and have > everything will work with files either on local or on a > webserver. But if you want the pictures appears on maps.google.com, > you have to put the complete URL of picture and then have pictures > on a webserver. Thanks a lot Stephane! I now also installed googleearth - your first file looks very nice in that! Hm, this makes me start thinking about upgrading my modem connection at home to broadband... ((Off-topic: On the other hand a pure off-list variant (+open source ... ;-) might be also good, see marble for kde, http://www.kdedevelopers.org/node/2412 or gaia, http://sourceforge.net/projects/gaia-clean/ )) > It will be a new shared library ? If yes, this is want mean that it will a new > depency to kipi-plugins ? Why not include this code to plugin itself ? Can you > give me more informations about ? first I wanted to have code to generate placemark with picture, after I thought that to practice a little bit more C++ I could make a library that can handle everything or almost all kml specs so, afterward, I could easily in the plugin not only add date, icons (which is already done) but also join a gpx track to have not only pictures but the track of the journey or different folder if I decide to not create kml file with a set of selected pictures but a set of selected albums. So the kml part is becoming relatively big and could be used for other projects. you can see the first things I coded using the kmldocument classes here: http://stpo.homelinux.org/data/kml.tgz where I just create some placemarks folders and styles. and the first attempt to use them in a plugin (where I just copied all classes files) can be found here: http://stpo.homelinux.org/data/kmlexport.tgz > first I wanted to have code to generate placemark with picture, after I
> thought that to practice a little bit more C++ I could make a library that
> can handle everything or almost all kml specs so, afterward, I could easily
> in the plugin not only add date, icons (which is already done) but also
> join a gpx track to have not only pictures but the track of the journey or
> different folder if I decide to not create kml file with a set of selected
> pictures but a set of selected albums. So the kml part is becoming
> relatively big and could be used for other projects. you can see the first
> things I coded using the kmldocument classes here:
> http://stpo.homelinux.org/data/kml.tgz
> where I just create some placemarks folders and styles.
Thanks for picking up my wish so fast.. The main reason for the wish was for
reading the kml file though: Google maps is slow and clumsy compared to
google earth.
After battling google maps yesterday for some 40 minutes to find a point in
greece which I found in 5 minutes in google earth I decided to file the
request.
That said, export opens also lots of interestig options! So I'm happily
awaiting what you guys come up with.. Just don't forget the import please..;)
Gerhard
while exporting is easy (reading data in base or exif and writing an xml file accordingly km specs) I doubt that importing (meaning interacting wgh googleearth app) will be so easy. Stéphane On Tuesday 09 January 2007 17:31, Stéphane Pontier wrote:
> ------- Additional Comments From shadow.walker free fr 2007-01-09 17:31
> ------- while exporting is easy (reading data in base or exif and writing
> an xml file accordingly km specs) I doubt that importing (meaning
> interacting wgh googleearth app) will be so easy.
Why? The kml file is a simple xml structure with the data for one or more
points. Parsing xml shouldn't have to be be a problem.
If there's one checkpoint you use the coordinates for the photo, if there are
more you have two options: Use the fist record or show all the titles and let
the user choose the record to use.
Stéphnae, I'm agree with gerhard. XML is easy to import/export using Qt. Look my code to import GPX trace file from GPS device : http://websvn.kde.org/trunk/extragear/libs/kipi-plugins/gpssync/gpsdataparser.cpp?rev=590452&view=auto No need to re-invent the wheel to create a shared lib to decode/encode kml files. With Qt it's very easy to do... Gilles Created attachment 20120 [details]
kml export functionality
kml export added to the gpssync plugin
I finally found time to work again on the kmlexport. I use QDom and merge it with gpssync plugin. It can now take a gpx file to create a track with the pictures. Next thing to implement is to give user the choice of the track and picture style (color, width and elevation mode) Stéphane, do yo uremeber this point talk on kde-imaging@kde.org ML ? >To create the track I had to add a lineString method to the GPSDataParser >class. The track created is time independent and cant be clicked. If I want >to be able to create a track which can be clicked (to get information about >to road taken between two picture for example) I have to create a new set of >points using time and localisation of each gpx point. I can add this >functionality to GPSDataParser class, but since it's more kml function >related than GPS data parsing, isn't it cleaner to create a new class >derivate from GPSDataParser to put all kml related method in ? Can you fix your patch to derivate the GPSDataParser class ? //----------------------------------------------- Gerhard, Can you review this patch with your GPS ? Thanks in advance Gilles Created attachment 20204 [details]
kml export functionality
in this patch, I derivate the GPSDataParser class (but I had to change the
m_GPSDataMap from private to protected) to be able to manipulate the GPS data.
Additionnaly to previous features, the plugin can export Points of GPS
tracks(hidden by default) and allows to choose the track color, width, and
Altitude mode for the track and pictures.
SVN commit 651402 by cgilles: kipi-plugins from trunk : GPSSync : patch from Stéphane Pontier to add new option for export GPS position from pictures to a KML file. This one can be viewed in GoogleEarth or GoogleMaps ! BUG: 139793 CCMAIL: shadow.walker@free.fr CCMAIL: kde-imaging@kde.org M +4 -2 Makefile.am M +1 -1 gpsdataparser.h AM kmlexport.cpp [License: GPL (v2+) (wrong address)] AM kmlexport.h [License: GPL (v2+) (wrong address)] AM kmlexportconfig.cpp [License: GPL (v2+) (wrong address)] AM kmlexportconfig.h [License: GPL (v2+) (wrong address)] AM kmlgpsdataparser.cpp [License: GPL (v2+) (wrong address)] AM kmlgpsdataparser.h [License: GPL (v2+) (wrong address)] M +42 -0 plugin_gpssync.cpp M +4 -0 plugin_gpssync.h --- trunk/extragear/libs/kipi-plugins/gpssync/Makefile.am #651401:651402 @@ -10,11 +10,13 @@ # Srcs for the plugin kipiplugin_gpssync_la_SOURCES = plugin_gpssync.cpp gpssyncdialog.cpp gpslistviewitem.cpp \ gpsbabelbinary.cpp gpsdataparser.cpp gpseditdialog.cpp \ - gpsmapwidget.cpp + gpsmapwidget.cpp kmlexport.cpp kmlexportconfig.cpp \ + kmlgpsdataparser.cpp # Libs needed by the plugin kipiplugin_gpssync_la_LIBADD = $(LIBKEXIV2_LIBS) -lkipiplugins $(LIBKIPI_LIBS) $(LIB_KHTML) \ - $(LIB_KPARTS) $(LIB_KIO) $(LIB_KDEUI) $(LIB_KDECORE) $(LIB_QT) + $(LIB_KPARTS) $(LIB_KIO) $(LIB_KDEUI) $(LIB_KDECORE) $(LIB_QT) \ + $(LIB_KFILE) # LD flags for the plugin kipiplugin_gpssync_la_LDFLAGS = $(KIPI_PLUGINS_COMMON_LDFLAGS) -module $(KDE_PLUGIN) $(all_libraries) --- trunk/extragear/libs/kipi-plugins/gpssync/gpsdataparser.h #651401:651402 @@ -60,7 +60,7 @@ QDateTime findNextDate(QDateTime dateTime, int secs); QDateTime findPrevDate(QDateTime dateTime, int secs); -private: +protected: typedef QMap<QDateTime, GPSDataContainer> GPSDataMap; ** trunk/extragear/libs/kipi-plugins/gpssync/kmlexport.cpp #property svn:eol-style + native ** trunk/extragear/libs/kipi-plugins/gpssync/kmlexport.h #property svn:eol-style + native ** trunk/extragear/libs/kipi-plugins/gpssync/kmlexportconfig.cpp #property svn:eol-style + native ** trunk/extragear/libs/kipi-plugins/gpssync/kmlexportconfig.h #property svn:eol-style + native ** trunk/extragear/libs/kipi-plugins/gpssync/kmlgpsdataparser.cpp #property svn:eol-style + native ** trunk/extragear/libs/kipi-plugins/gpssync/kmlgpsdataparser.h #property svn:eol-style + native --- trunk/extragear/libs/kipi-plugins/gpssync/plugin_gpssync.cpp #651401:651402 @@ -50,7 +50,10 @@ #include "gpssyncdialog.h" #include "plugin_gpssync.h" #include "plugin_gpssync.moc" +#include "kmlexport.h" +#include "kmlexportconfig.h" + typedef KGenericFactory<Plugin_GPSSync> Factory; K_EXPORT_COMPONENT_FACTORY( kipiplugin_gpssync, Factory("kipiplugin_gpssync")) @@ -96,6 +99,17 @@ addAction( m_action_geolocalization ); + // this is our action shown in the menubar/toolbar of the mainwindow + m_actionKMLExport = new KAction (i18n("Export kml..."), + "www", // icon + 0, // do never set shortcuts from plugins. + this, + SLOT(slotKMLExport()), + actionCollection(), + "kmlexport"); + + addAction( m_actionKMLExport ); + m_interface = dynamic_cast< KIPI::Interface* >( parent() ); if ( !m_interface ) @@ -305,10 +319,38 @@ } } + +void Plugin_GPSSync::slotKMLExport() +{ + KIPI::ImageCollection selection = m_interface->currentSelection(); + + if ( !selection.isValid() ) { + kdDebug( 51000) << "No Selection!" << endl; + } + else { + KIPIGPSSyncPlugin::KMLExportConfig *kmlExportConfigGui = new KIPIGPSSyncPlugin::KMLExportConfig( kapp->activeWindow(), i18n("KMLExport").ascii()); + connect(kmlExportConfigGui, SIGNAL(okButtonClicked()), this, SLOT(slotKMLGenerate())); + kmlExportConfigGui->show(); + + } +} + +void Plugin_GPSSync::slotKMLGenerate() +{ + KIPI::ImageCollection selection = m_interface->currentSelection(); + KIPIGPSSyncPlugin::kmlExport myExport(m_interface); + if(!myExport.getConfig()) + return; + myExport.generate(); +} + + KIPI::Category Plugin_GPSSync::category( KAction* action ) const { if ( action == m_action_geolocalization ) return KIPI::IMAGESPLUGIN; + if ( action == m_actionKMLExport ) + return KIPI::EXPORTPLUGIN; kdWarning( 51000 ) << "Unrecognized action for plugin category identification" << endl; return KIPI::IMAGESPLUGIN; // no warning from compiler, please --- trunk/extragear/libs/kipi-plugins/gpssync/plugin_gpssync.h #651401:651402 @@ -27,6 +27,7 @@ #include <libkipi/plugin.h> class KActionMenu; +class KAction; class Plugin_GPSSync : public KIPI::Plugin { @@ -44,6 +45,8 @@ void slotGPSSync(); void slotGPSEdit(); void slotGPSRemove(); + void slotKMLGenerate(); + void slotKMLExport(); private: @@ -52,6 +55,7 @@ private: KActionMenu *m_action_geolocalization; + KAction *m_actionKMLExport; KIPI::Interface *m_interface; }; Hi, I'm doing some tests about kml export. That's a great feature, thanks. (I was using gpsPhoto - http://www.carto.net/projects/photoTools/gpsPhoto/ - to do that before). Just some comments : - it would be better to have a file dialog to choose the destination directory - if the destination directory already exists, I get a warning dialog asking me if I want to overwrite it - if you select only pictures with no GPS coordonates, you don't even have the time to see the "No position info for" ; maybe there could be a warning at the end saying something like "the following pictures don't have GPS coordonates" - when you draw the gpx track, I think it would be better to not add a placemark for each point of the track because it's useless and you can have troubles with google map saying the file is too big ; line string coordonates are enough imho... Finally, I have to repeat this feature is really great ! Stéphane, I let's you respond to Fabien... Gilles Created attachment 20286 [details] some little fixes for kmlexport >- it would be better to have a file dialog to choose the destination directory done >- if the destination directory already exists, I get a warning dialog asking me if I want to overwrite it Since the plugin create kml file and an "images" directory, I first thought of an unique directory per export, but now I dont know if It's better: - to test if the directory is empty and if not, erase the existing files or overwrite them (I keep one directory per export) - or test each file before copying them to be able to have several export in the same directory and avoid corruption (old kml pointing to a new picture replacing an old one of the same name) >- if you select only pictures with no GPS coordonates, you don't even have the time to see the "No position info for" ; maybe there could be a warning at the end saying something like "the following pictures don't have GPS coordonates" I've added a messagebox if at least one picture didn't had GPS coordinates >- when you draw the gpx track, I think it would be better to not add a placemark for each point of the track because it's useless and you can have troubles with google map saying the file is too big ; line string coordonates are enough imho... I just saw that to. now when exporting for google map, the plugin does not export placemark for each points. in addition, in this patch, I also fix kmlexport related issues pointed by http://www.englishbreakfastnetwork.org SVN commit 658210 by fsalvi: Apply patch from Stephane Pontier. Fix i18n issues reported by Brian Remedios. CCBUG: 139793 CCMAIL: shadow.walker@free.fr M +59 -28 kmlexport.cpp M +9 -17 kmlexport.h M +39 -36 kmlexportconfig.cpp M +18 -21 kmlexportconfig.h M +28 -24 kmlgpsdataparser.cpp M +15 -14 kmlgpsdataparser.h M +1 -1 plugin_gpssync.cpp Hi Stéphane, I committed your patch + some i18n fixes (check #22). It's better now, thanks ! About the unique directory per export, I think it would be better to test each file, so that it's possible to have one export directory for many tracks/albums. It corresponds to what we usually do when uploading files on a website. It's also a way to share the same pictures but with different kml files. Another thing I saw : if you check the "draw GPS track" feature but not select any GPX, you don't get any error/warning. Maybe you could add something here ? Thanks for your work. Hi Stéphane, Just a ping to have some news :) I'll try to take care of that next week. Been busy with works for my new apartment Somehow this bug has been closed, but the previous messages sounds to me as if there were still some open issues to be solved. Fabien, Stephane: what is the status here? I unfortunatly didn't had time to work again on this :-( |