[OSM-talk] GPX upload via API

Guilhem Bonnefille guilhem.bonnefille at gmail.com
Thu Aug 16 11:30:02 BST 2007

On 8/16/07, Tom Hughes <tom at compton.nu> wrote:
> In message <8b65902a0708160057r2273e4d1rcf387d22e5b758ee at mail.gmail.com>
>         Guilhem Bonnefille <guilhem.bonnefille at gmail.com> wrote:
> > On 7/25/07, Christof Dallermassl <cdaller.hw at gmx.at> wrote:
> >> I just added a java class that allows to upload one or more gpx files in
> >>   batch mode. Check out at
> >> http://svn.openstreetmap.org/applications/utils/gps-tracks/jgpxupload/
> >
> > Reading at the code, I do not understand the 3 following lines:
> >             String urlGpxName =
> > URLEncoder.encode(gpxName.replaceAll("\\.","_"), "UTF-8");
> >             String urlDesc =
> > URLEncoder.encode(description.replaceAll("\\.","_"), "UTF-8");
> >             String urlTags =
> > URLEncoder.encode(tags.replaceAll("\\.","_"), "UTF-8");
> > more precisly, what's the goal of the call ".replaceAll("\\.","_")"?
> > I understand that this replace all dots by an underscore. Am I right?
> > What's for?
> The problem is that GPX upload API encodes those fields in the URL and
> there are certain characters (including .) which you can't use in a
> URL component with rails as it will treat then as starting a new
> component.

OK. But what about slash ('/')? It seems that this caracter is used as
separator for parameters. So if description, tags or filename contain
such caracter, the API will go wrong.

I'm not aware with HTTP protocol, but why not use a POST request for
uploading GPX traces? Or perhaps, PUT method allows parameters, like
POST (I really don't know, but I'm surprised it is not possible).

Other solution: insert description and tags inside the GPX file.
GPX 1.1 has:
- a desc metadata field to describe the file
- a keywords metadata field to add some searchable keywords.
We can imagine to store description in the *desc* element and tags in
the *keywords* element. By this way, we have a single "param" for the
PUT method: the name of the file. The server has to process the file
to retrieve description and tags.
Is it a possible solution?

Best regards,
-=- #UIN: 15146515 JID: guyou at im.apinc.org MSN: guilhem_bonnefille at hotmail.com
-=- mailto:guilhem.bonnefille at gmail.com
-=- http://nathguil.free.fr/

More information about the talk mailing list