OsmSharp / core

The core functionality of OsmSharp.
Other
317 stars 87 forks source link

Xml Deserializing an Osm #80

Closed blackboxlogic closed 5 years ago

blackboxlogic commented 5 years ago

If you hit the OsmApi with a Get Map action, the xml response will never finish deserializeing with:

var serializer = new XmlSerializer(typeof(Osm));
var osm = serializer.Deserialize(STREAM);

The XMLReader gets stuck looping over the Bounds element. I have a fix, and a pull request with tests will follow shortly.

blackboxlogic commented 5 years ago

I've found more Xml Deserialization issues, which I'm going to fold into this same issue. OsmSharp didn't support the responses from: GET /api/versions GET /api/capabilities See expected behavior here.

I will create pull requests (including tests) for these issues.

blackboxlogic commented 5 years ago

And now I'm adding support for: GET /api/0.6/permissions I expect I will be making many of these sorts of changes, please let me know if I should change any part of my workflow or code style to work better with this project.

blackboxlogic commented 5 years ago

And now I'm working on adding the discussion part of GET /api/0.6/changeset/#id?include_discussion=true

xivk commented 5 years ago

I'm still not sure if including all possible API responses in OsmSharp is a good idea. This library is about OSM data, the notes, discussions, versions, persmissions etc are not really in scope.

Can you give a good reason these should be included here or can you also add them to the separate package we discussed? What kind of application are you building?

blackboxlogic commented 5 years ago

You're definitely in a better position to judge the direction of OsmSharp than I.

This library is about OSM data

Someone decided that the OSM database should contain 'discussions' because they would be a valuable part of the OSM ecosystem. And someone else decided that the API should allow for CRUD operations on 'discussions', because that would be valuable. I can see how this data seems "softer" than nodes and ways, but to me it still looks like "osm data".

can you also add them to the separate package we discussed

I thought "OsmApiClient" would include:

And I thought the data model (and serialization) lived nicely in OsmSharp, since 90% of it is already here, and it would be odd to have parts of the data model in one package and other parts in a different package. I don't think I could have part f the data model (and serialization) in OsmSharp and part in OsmApiClient. I definitely wouldn't want to duplicate the whole data model, making it incompatible with OsmSharp.

What kind of application are you building

I went looking for an Osm Api client for a very small personal project thinking that one would already (should already) exist for c#. I realized I would need to write my own, which I assume everyone else has also written their own, and why not have a single well maintained, open source one.

The first project I had in mind will only need a very small subset of these calls. But while I'm at it, I realized that I have the time and ability to fully implement a tool that could be very useful to others, including future me.

I'm starting with an automated edit tool, which might turn into a data-import tool. To start, I think I'll only need:

More specific personal project: Routing in Maine (USA) is terrible because there are no addresses outside of the biggest towns. But before trying a large import, I want to get my toes wet by fixing phone number formats. Secondary goal: writing a full api client as a way to learn the technical details of Osm.

blackboxlogic commented 5 years ago

I believe this is resolved by https://github.com/OsmSharp/core/pull/82