I'm developing some Android software using openstreetmap, and I've got a question: I'd like to submit XML data to the server to create a way, but it always sends back the response " But surely, the nodes of way do not already exist when i create a way? So I don't know how to solve the problem. I've read the API documentation many times and am trying to do the same as it shows in the examples. Can you help me to solve the problem, or tell me the right way to send a request to server to create a way with nodes that do not yet exist? Thank you very much! asked 04 Sep '12, 03:47 lovepanmei SomeoneElse ♦ |
If you've not tried Wireshark you might find it of use. I just used JOSM to upload a hedge I traced from Bing and captured what was happening. The XML was:
So it looks like you create the nodes and then the ways in the same changeset. answered 08 Sep '12, 08:58 EdLoach ♦ Is the action that create the nodes and ways in the same chageset wrong?
(08 Sep '12, 09:14)
lovepanmei
No, if you look at EdLoach's osmChange XML above you'll see that's exactly what JOSM is doing. If you compare that XML with the XML that you're sending you may be able to see what you're doing wrong.
(08 Sep '12, 12:06)
SomeoneElse ♦
|
You can not create a way with nodes that does not exist, or delete nodes when a way refers to it. This is to prevent the data from becoming inconsistant. You have to create the nodes before you create the way, or prefrebly at the same time. answered 04 Sep '12, 07:13 Gnonthgol ♦ how can i create them at the same time?The data i submit include the way data and the node data also ,it remains wrong ,can you tell me the right xml format.I read the api many times.The time of my project is tight ,so please help.
(04 Sep '12, 07:40)
lovepanmei
Would you show us a small XML with a way and only a few nodes that doesn't work?
(04 Sep '12, 07:42)
scai ♦
<osmchange version="0.6" generator="Osmosis"> <create> <node id="-1" timestamp="2007-01-02T00:00:00.0+11:00" lat="-33.9133118622908" lon="151.117335519304" changeset="1234" version="12"/> <node id="-2" timestamp="2007-01-02T00:00:00.0+11:00" lat="-33.9133118622911" lon="151.117335519312" changeset="1234" version="12"/>
</create> </osmchange> what i submit is like above,is there something wrong with it?
(04 Sep '12, 08:00)
lovepanmei
2
If you are creating a node (using <create> and specifying a negative id), you don't need the version or timestamp just the lon, lat and changeset. If you are trying to include an existing node (which is what version 12 suggests), don't try to create it just refer to its existing node id.
(04 Sep '12, 17:00)
ChrisH
if i want to create a way including not existing node ,how can i do? Is the following xml right? <?xml version='1.0' encoding='UTF-8' standalone='yes' ?> <osm> <node id="-1" lat="34.23294236166552" lon="108.91146183013916" changeset="13030131"/> <node id="-2" lat="34.232294838724385" lon="108.9129638671875" changeset="13030131"/> <way changeset="13030131"> <tag k="name" v="hrllo"/> <tag k="RAILWAY" v="railway_platform"/> <nd ref="-1"/> <nd ref="-2"/> </way> </osm>
(08 Sep '12, 06:43)
lovepanmei
|
Can you explain a bit more about the purpose of your application?
I'd also mention the "if you want to test your software" section of this page. There's a copy of the API at http://api06.dev.openstreetmap.org/ which you can use for testing, which avoids filling the live database with rubbish.
I know it ,but the request i submit probably has something wrong,but i don't know where.Can you help me to check the xml file as following: <?xml version='1.0' encoding='UTF-8' standalone='yes' ?><osm><node id="-1" lat="34.23294236166552" lon="108.91146183013916" changeset="13030131"/><node id="-2" lat="34.232294838724385" lon="108.9129638671875" changeset="13030131"/><way changeset="13030131"><tag k="name" v="hrllo"/><tag k="RAILWAY" v="railway_platform"/><nd ref="-1"/><nd ref="-2"/></way></osm>