[OSM-talk] Android Phonegap App

David Serenity debukali at gmail.com
Mon Apr 16 13:47:02 BST 2012


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/talk/attachments/20120416/658cd390/attachment.html>


More information about the talk mailing list