westnordost / osm-legal-default-speeds

Infer default legal speed limits from OpenStreetMap tags
https://westnordost.github.io/osm-legal-default-speeds
BSD 3-Clause "New" or "Revised" License
21 stars 8 forks source link

C# Port #19

Open erlenddahl opened 2 months ago

erlenddahl commented 2 months ago

Hi there!

This is not really an issue, but I'm not sure what's the normal procedure in such cases, so I'm contacting you here.

I found your library, and while it works very well, I need it integrated in my existing C# environment for performance reasons, so I ported it to C#. The task of porting it was done first automatically (by feeding each class into an AI), then I made some manual adjustments to make it compile, and fixed some minor errors the AI had done so that all tests passed. I made a few adjustments to make the code more C#-y, but it's mostly a direct translation (some of it is a bit more verbose in C# than in Kotlin, and some of it could probably be simplified, but I thought it would be easier to apply future updates from the original library if the code is mostly untouched).

It seems to work very well. I'd happily share the port on Github in case others are in the same boat, but I thought I should ask you first.

westnordost commented 2 months ago

With... AI. Hmm, I'd suggest to at least write/copy the tests from Kotlin yourself to make sure that the AI doesn't hallucinate some behavior that should not exist. (Enhancing the unit tests and making them stricter would also be a welcome contribution.)

Anyway, I could link the C# port in this project's readme when it is production-ready.

erlenddahl commented 2 months ago

Yes, I was skeptical too, but it actually worked very well.

I was perhaps not clear enough in the previous post, but all tests are also ported, and they all pass (after a few hours of fixing the inevitable AI-mistakes). I also added some additional tests based on the examples on your web page, and some based on my knowledge of the Norwegian road network.

So, if you're okay with it, I'll push it to Github once I am satisfied with it, with a Readme pointing back to your repo.

westnordost commented 2 months ago

Sure, why should I not be okay with that? :-) Also license-wise, you are free to choose any license you like due to the BSD license used by this reference implementation. I usually prefer GPL-like licenses, but for this reference implementation I found it would have a more positive effect (= higher chance of getting integrated by various router software) if it was as "do what you want with it" as possible.