I want my program to have the street's and building's data in xml format. But I have no idea how to start this project. I am new to using api's and reading about the api does not tell me how do I actually write api call in my c++ code and retrieve the data. What sources should I refer to write a simple program to say :
All queries are on wiki page, but where to write this queries and required setup for starting with this api usage is evasive. asked 24 Dec '12, 06:25 Anubha |
This is a minimal working example in plain C/C++ with only minimal error checking and no response processing:
Example output:
I strongly suggest using a third-party library for the network/HTTP code and you will probably also want to use a third-party library for parsing the XML/JSON/whatever response. A much simpler option is to use a scripting language like Python, Ruby, or - if you like camels - Perl. answered 24 Dec '12, 11:51 scai ♦ 1
Thank you again (again as you replied in stackOverflow), I ran the code, and it worked, its first time I connected to an internet server. Will make project in which user will be able to ride a car in any part of world he/she wishes, buildings will be mostly random.
(24 Dec '12, 12:35)
Anubha
Ah, I didn't remember your username :)
(24 Dec '12, 13:40)
scai ♦
|
An API call is done via HTTP, so your program needs to open a network connection. Libraries for C++ that do so are discussed for example here. answered 24 Dec '12, 07:08 Roland Olbricht thanks, any code samples with simple osm api calls would be really helpful.
(24 Dec '12, 08:14)
Anubha
|
Implementing the API call in your project is very programming/scripting language-specific and hasn't much to do with OSM.