jonmcpherson / open-location-code Goto Github PK
View Code? Open in Web Editor NEWThe C# implementation of the google/open-location-code API
The C# implementation of the google/open-location-code API
Hello!
Would you mind adding an internal max length to your implementation, as per google/open-location-code#190?
Specifically, the following changes will be made:
You can follow the example of the Java implementation here: google/open-location-code#209
Let me know if you have time to do this in the next couple weeks.
Calling C# OpenLocationCode.Encode with length 2 fails with 'System.ArgumentException: Illegal code length 2.'.
I am using NuGet package OpenLocationCode by Jon McPherson, v2.1.0
This is for both GeoPoint and lat/long.
A length of 2 should be valid (https://github.com/google/open-location-code/blob/master/docs/specification.md) giving a 'box' 20 degrees across.
My test code is
[TestMethod]
public void UT_HD0099_Encode_LL()
{
string res;
res = Google.OpenLocationCode.OpenLocationCode.Encode(12.123456789, 123.123456789, 11);
Assert.AreEqual("7Q4544FF+99P", res);
res = Google.OpenLocationCode.OpenLocationCode.Encode(12.123, 123.123, 4);
Assert.AreEqual("7Q450000+", res);
res = Google.OpenLocationCode.OpenLocationCode.Encode(12.123, 123.123, 2);
Assert.AreEqual("7Q000000+", res);
}
Is there a way to include the Locality with this solution.
The implementation works excellent with proper Plus Codes, ie: "5G3CQ877+X8", converts beautifully to a workable location.
However, when I try to process another Plus Code like this: "Q877+X8 Bethlehem" (Which translates to the same location), I receive an Exception Error, which I understand happens and why it happens.
How does one convert the "Bethlehem" to the pre-code of "5G3C" in this example?
Regards
Borriez
It appears the NuGet package has debug dll in the release folder.
In order to improve consumption of the library by .NET developers, I'd suggest that a few methods should be converted to properties. This is a breaking change and should be undertaken before the OLC library gets a too wide use.
Hello from the main Open Location Code repo!
We're currently working on fixing floating point precision issues with the various implementations (see here). For the implementations not directly in the main repo, we're asking for the owners to update their code accordingly. Would you be able to do the following when you get a chance?
How should the coordinates be represented? Either stick to decimal
or to double
...
OpenLocationCode
is based on double
for the coordinates, yetdecimal
.CodeArea
constructor expects decimal
as its input arguments, yet all its propertiesdouble
.As the precision of the encoded coordinates is limited, I don't feel that using the more
precise decimal
representation useful in this library. I'd stick to double
.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.