[OSM-dev] Using API 0.6 to create a new node

Bryan Housel bryan at 7thposition.com
Tue Jun 14 16:11:21 UTC 2016


You can’t just pass “0” as the changeset id.

Your app will need to create a changeset first with :
http://wiki.openstreetmap.org/wiki/API_v0.6#Create:_PUT_.2Fapi.2F0.6.2Fchangeset.2Fcreate <http://wiki.openstreetmap.org/wiki/API_v0.6#Create:_PUT_.2Fapi.2F0.6.2Fchangeset.2Fcreate>

This diagram talks a bit about the flow of how to create a changeset, issue updates against it, then close the changeset:
http://wiki.openstreetmap.org/wiki/File:OSM_API0.6_Changeset_successful_creation_V0.1.png <http://wiki.openstreetmap.org/wiki/File:OSM_API0.6_Changeset_successful_creation_V0.1.png>




> On Jun 14, 2016, at 11:41 AM, toni hernández <toni at sigte.udg.edu> wrote:
> 
> Hi everyone,
> 
> I am trying to display OSM data into my web map as well as other custom layers.
> One of the goals of my web application is to upload data from my application to the osm database.  I have been reading thishttp://wiki.openstreetmap.org/wiki/API_v0.6#Elements <http://wiki.openstreetmap.org/wiki/API_v0.6#Elements> but still I do not understand how a PUT request functions. I have so much to learn....
> 
> After authentificating with osmauth.js I try this code without any success. I get a 401 error.
> 
> var xml_string = '<?xml version="1.0" encoding="UTF-8"?> <osm version="0.6" generator="MyOpenstreetmapApp"><node changeset="0" lat="41.983910" lon="2.816094"><tag k="shop" v="supermarket"/></node></osm>';
> 
> ajaxurl= "http://www.openstreetmap.org/api/0.6/node/create" <http://www.openstreetmap.org/api/0.6/node/create>;
> 
> $.ajax({
>     url: ajaxurl,
>     data: xml_string, 
>     type: 'PUT',
>     contentType: "text/xml",
>     dataType: "text",
>     success : function (resp){console.debug(resp)},
>     error : function (xhr, ajaxOptions, thrownError){  
>         console.log(xhr.status);          
>         console.log(thrownError);
>     } 
> });        
> 
> Do I need to include oauth_secret and oauth_consumer_key from the authentification proccess in the ajax request?
> 
> Any help will be really apreciated.
> Thanks 
> -- 
> Toni Hernández Vallès 
> Servei de Sistemes d'Informació Geogràfica i Teledetecció
> -
> Universitat de Girona
> SIGTE
> -
> Pl. Ferrater Mora 1
> 17071 Girona
> Tel +34 972 418 039 (7026 intern)
> toni at sigte.udg.edu <mailto:toni at sigte.udg.edu> 
> 
> http://www.sigte.udg.edu <http://www.sigte.udg.edu/>
> Twitter http://twitter.com/SIGTE_UDG <http://twitter.com/SIGTE_UDG>
> 
> _______________________________________________
> dev mailing list
> dev at openstreetmap.org
> https://lists.openstreetmap.org/listinfo/dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/dev/attachments/20160614/3830e437/attachment.html>


More information about the dev mailing list