[OSM-talk] Android Phonegap App

Graham Jones grahamjones139 at gmail.com
Mon Apr 16 14:26:48 BST 2012


Hi.
I have never used phonegap, but one of the 2010 google summer of code
projects did, so you may be able to pick up something from that (search the
wiki for gsoc).  Another looked at a javascript editor, and that used oauth
authentication, so it would be worth a loom too.

Graham

from my phone

On 16 Apr 2012 13:48, "David Serenity" <debukali at gmail.com> wrote:

Hi all,

I am new to osm and phonegap development. I have not found much
documentation on making calls to OSM api from an android phonegap app. I am
especially interested in creating changesets and uploading map data (form
entries and coordinates) to OSM. i tried ajax calls to the api and have run
into same origin policy restrictions and the url ( *
http://api06.dev.openstreetmap.org/api/0.6/changeset/create*) is not found.
i have used the code below:

function loadIt()
{

var xmlData = '<osm><changeset><tag k="created_by" v="EasyMappr" /><tag
k="comment" v="Ah please do it" /></changeset></osm>';

var url = "http://api06.dev.openstreetmap.org/api/0.6/changeset/create";

$.ajax({
  type:"PUT",
  username: "debukali at gmail.com",
   password: "lettersforme",
  url: url,
  data: xmlData,

   error: function(xhr, textStatus, errorThrown) {
     if (xhr.status === 0) {
                alert('Not connect.\n Verify Network.' + textStatus);
            } else if (xhr.status == 404) {
                alert('Requested page not found. [404]');
            } else if (xhr.status == 500) {
                alert('Internal Server Error [500].');
            } else if (textStatus === 'parsererror') {
                alert('Requested JSON parse failed.');
            } else if (textStatus === 'timeout') {
                alert('Time out error.');
            } else if (textStatus === 'abort') {
                alert('Ajax request aborted.');
            } else {
                alert('Uncaught Error.\n' + xhr.responseText);
            }
  },
          success : function(result) {
    alert("Its done" + result);

}
 });


  }



If anyone can provide any ideas or code, please share?

Regards,
David

_______________________________________________
talk mailing list
talk at openstreetmap.org
http://lists.openstreetmap.org/listinfo/talk
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/talk/attachments/20120416/5655a072/attachment.html>


More information about the talk mailing list