gabm / FancyPlaces

GNU General Public License v3.0
21 stars 9 forks source link

GPX Export #7

Closed jojorb closed 9 years ago

jojorb commented 9 years ago

Hi thank for you app,

i'm looking forward to find the "geo files" you use to store the list of fancy places. where is it store inside the phone? can you tell me if it's geojson or gpx friendly or any other format?

i am very interested to be able to "save them" on a personal nodejs webapp i'm currently working on

gabm commented 9 years ago

well currently everything except the images are stored in a sqlite database - but i was already thinking about some kind of webservice - what we could do for sure would be an exporter to what ever format you like (probably gpx) .. maybe also a "real" interface but that would be quite some work...

jojorb commented 9 years ago

a GPX exporter could be awesome, i do believe that users would want at some points be able to save their places somewhere outside the phone. :)

gabm commented 9 years ago

I am sure about that and I agree with you - lets start with a gpx exporter :)

jojorb commented 9 years ago

Great news, i will follow that ;)

gabm commented 9 years ago

Hey Roby, please try out the new Debug Version that supports a very simple gpx export... you can download it here

Currently the functionality is very limited: you can only export one place at a time and the filename is fixed... but its already prepared for exporting multiple files, currently we need support for multiple selection of the FancyPlaces in the List, so first we need Issue #8 to be fixed...

Please test with your webapp if the gpx is valid (i tried with an online tool for now) and report back...

jojorb commented 9 years ago

the export goes well on phone, when i did plug my phone (let's say i don't share by BT or Wifi, but by USB) i had hard time to find the Fancy Places file so i copy past the .gpx to my /phone/download file to be able to see it on my computer. the .gpx on webbapp seems ok but if i may it could be nice to have it like this:

<?xml version="1.0" encoding="UTF-8"?>
<gpx version="1.1"
creator="GT-I9300"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.topografix.com/GPX/1/1"
xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd">
    <metadata>
        <name>test</name>
        <time>2015-06-08T14:14:54Z</time>
    </metadata>
    <wpt lat="48.9476478" lon="2.5227681">
    </wpt>
</gpx>

if the phone model can be as Creator or whatever something meaning full about phone, could be awesome!

jojorb commented 9 years ago

i just re think about something you may already figure out but i put it there

<?xml version="1.0" encoding="UTF-8"?>
<gpx version="1.1"
creator="FANCY-PLACE"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.topografix.com/GPX/1/1"
xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd">
<metadata>
<author><name>GT-I9300</name></author>
<name>test</name>
<time>2015-06-08T14:14:54Z</time>
</metadata><trk>
...
k3b commented 9 years ago

i have tested gpx and found a minor issue:

your app is setting time to local time while time="...Z" means utc. so you can either onmint tze "Z" or translate the time to gmt/utc

you can also add

    <name>theName</name>
    <desc>the Notes</desc>
    <time>2015-02-10T08:04:45.000Z</time>
    <link href='file://Path/to/Image.jpg' /> <!-- or a "content:..." uri -->
gabm commented 9 years ago

thank you both for your feedback - i will implement your thoughts...

I'm not sure whether a link to an uri on the local device would be very helpful here, so maybe i'll drop that...

k3b commented 9 years ago

@RobyRemzy i think the name and time element should not belong to the meta element but to the wpt element as already implemented. this way the gpx-file can possibly contain more than one fance place.

k3b commented 9 years ago

@gabm you are right: a link to a local-android file does not make sense if the gpx file is copied somewhere to an other computer.

if the gpx file is viewed on the originating android-devjce it makes sense. A portable way would be to copy the image as a file to the same dir as the gpx file.

I plan that the next version of the https://f-droid.org/wiki/page/de.k3b.android.locationMapViewer / https://github.com/k3b/LocationMapViewer will support images when loading gpx files.

But I agree: the link to the image is the least important info in the gpx and can be onmitted

gabm commented 9 years ago

@k3b well then it would make sense, indeed.. is there any standard regarding images and gpx together? like a simple zip archive or something like that?

Probably images and gpx in one directory would make the most sense - if the user decides to just send the gpx, its his own decision...

jojorb commented 9 years ago

@k3b yes you probably right, more convenient out of metatag. i'm more used to work with .gpx with tracking files not single point. and i think it's cool to have the pics inside the same folder. maybe i don't know if you can push to get also elevation and speed? for very fancy photo! :) <ele>55</ele> <speed>3.6770509481430054</speed>

gabm commented 9 years ago

Hi guys,

i am currently preparing the v1.2 release which will officially feature the gpx export... Could u please test this test build again and report back?

GPX Export works now like this:

Well please report back if the feature works for you...

@k3b Relative paths in URIs are not standardised...How to you handle this in your app? It seems its widely accepted...

jojorb commented 9 years ago

Hi there, thank you for the update, for now i don't mind too much to have a folder for each "poi". i just had some difficulties to fetch the folder when my phone is plug on my computer, for any reasons the folder don't appear, it's probably due to my ROM, i dunno.

in the folder i have my export.gpx and my 0_mytest.png there it could be awesome to have the same name for the .gpx and the png.

also inside the .gpx i can see that name : my test desc : my test (witch should be : this is my note)

gabm commented 9 years ago

about the folder acess on your phone: "i don't know"

the rest is working as expected i think:

since you now can select and export multiple FancyPlaces at once the policy is like this:

it seems there is a copy+paste error and the description field contains the title currently, right?

jojorb commented 9 years ago

oh i see it's 1 folder for selected POI and 1 export.gpx.

and yes the title is also into the description field, right now.

gabm commented 9 years ago

okay, the bug should be fixed now, a new test release is here

@RobyRemzy can u import the gpx to your app? Does everything work for you?

k3b commented 9 years ago

@gabm uri with relative paths:

that is a good question.

the map-symbol can be interpretet as a path relative to the gpx-url.

this way the gpx can be loaded via file or via http:

gabm commented 9 years ago

thats interesting - I thought I read somewhere, that "relative URIs" dont exist.. but english wikipedia says differently...

Currently relative filenames are already exported.. maybe you could test it (see my previous comment) and if it works I'll close here for now and prepare the v1.2.0 release...

k3b commented 9 years ago

i have tested interoperability with FP-20150621-2213.apk

potential problems in fp are formatted as bold

usecase filemanager open gpx-file

usecase in FancyPlaces share a fancy place

Example how to urlencode fp-name

  String urlEnecodedName = java.net.URLEncoder.encode(fp.getName(), "UTF-8");
gabm commented 9 years ago

Hi, thank you a lot for your extensive testing!

k3b commented 9 years ago
 > gpx-link

I donot think that there is a standard for this, too- i prefer "2_test.png" because that would also allow tu use http: https: urls. else we download gpx via http that references a file.

But that decision is up to you. my codeupdate for k3b/LocationMapViewer#9 will do it the way you will do.

 > fp export

you can use the LocationMapViewer-s parser. it already supports gpx-1.0, gpx-1.1, kml format and handles different time formats (gmt-time, local-time, time with timezone, ...) so it should be possible to import geodata form other apps, too.

For details see

https://github.com/k3b/LocationMapViewer/blob/master/k3b-geoHelper/src/test/java/de/k3b/geo/io/gpx/GpxReaderTest.java (this is an android independant j2se-junittest)

if you are lucky all you have to do is replace

   import de.k3b.geo.api.GeoPointDto;
   import de.k3b.geo.api.IGeoPointInfo;

with you code.

IGeoPointInfo is the data interface and GeoPointDto a simple implementation of IGeoPointInfo


As export-format you can do the same as openoffice or google-kmz-geo-format: a zip file containing all files (ie gpx+*.png)

gabm commented 9 years ago

ok, so now things should be alright for now, you can try it here

I will now prepare release v1.2.0 ... The next steps will include work on a working fancy place ex- and import (i like your idea of the zip file).. Maybe I can use your gpx reader and maybe we could also think about a gpx writer implementation?!

Thank you both for your help and your time!

k3b commented 9 years ago

I just checked the New testbuild and found a bug in gpx export. There is no XML escaping

I Exporte a FP named "Romeo&Juliet" and See that the "&" is not xml-escaped (&amp;)

I have no Permission to reopen this ticket

gabm commented 9 years ago

I added a very simple and stupid method to fix this issue for now - I need to build a proper XML reader/writer, probably using org.sax library (and maybe i can reuse some of your code)...

just for the record: the issue is fixed using this method which maybe doesn't even care about all cases...

Its included in v1.2.0 ...