Hi,
I am developing an android app using phonegap apis. I would like the app to to upload map data to osm using the osm apiv0.6. iam using the code below from localhost to create a changeset:
function createChangeset(){
var xmlData = '<osm><changeset><tag k="created_by" v="JOSM 1.61"/><tag k="comment" v="Just adding some streetnames"/> </changeset></osm>';
var url1 = "http://api06.dev.openstreetmap.org/api/0.6/changeset/create";
var r = $.ajax({
type:"PUT",
dataType:"xml",
username: "debukali@gmail.com",
password: "lettersforme",
url: url1,
data: xmlData,
"error":function(xhr, textStatus, errorThrown)
{
if (xhr.status === 0) {
alert('Not connect.\n Verify Network.');
} 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()
{
$("#openingmessage").css("background","yellow").html(data);
}
});
}
I get 2 errors
- OPTIONS http://api06.dev.openstreetmap.org/api/0.6/changeset/create 404 (Not Found)
- XMLHttpRequest cannot load http://api06.dev.openstreetmap.org/api/0.6/changeset/create. Origin null is not allowed by Access-Control-Allow-Origin.
It also shows alert from code above with “Not connect verify network”. I have read about Same Origin Policy but i have not seen any osm v0.6 api calls that return jsonp.
Please show how to make authentication,upload, element creation calls to osm api v0.6 using jquery?