Coder Social home page Coder Social logo

s2-geometry-library-csharp's People

Contributors

dddbliss avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

s2-geometry-library-csharp's Issues

geogrid queries

can i use this library to have several grids and query the cell values at some latitude and longitude? for example i want to know at position X the value of the cell that goes from 0 to 5 for how dangerous is that cell and another grid that goes from 0 to 200 for the max speed alowed if it is a street or highway or else.

Getting S2 Cell ID for specific position and level

I am trying to get the level 10 cell ID for central Manchester.

Google says its coordinate is 53.479683, -2.242776. So i tried it like that:
S2LatLng ll = S2LatLng.FromDegrees(53.479683, -2.242776);
But now if i try to get the ID like this:
S2CellId.FromLatLng(ll).Id.ToString();
It returns the wrong cell ID and
S2CellId.FromLatLng(ll).Level
is always level 30 without any chance of choosing it. How can i set the S2 cell level i like and get the right cell ID?

FatalExecutionEngineError with GetCovering

I occasionally get the following exception when getting a covering for a large area. It sometimes succeeds (guessing 10-20% of the time in this case, however it seems to be random). This doesn't seem to happen with lower level's like 10.

Error:
Additional information: The runtime has encountered a fatal error. The address of the error was at 0x705fe24f, on thread 0x2dc0. The error code is 0xc0000005. This error may be a bug in the CLR or in the unsafe or non-verifiable portions of user code. Common sources of this bug include user marshaling errors for COM-interop or PInvoke, which may corrupt the stack.

Code to reproduce:

using System.Collections.Generic;
using Google.Common.Geometry;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            var region_rect = S2LatLngRect.FromPointPair(S2LatLng.FromRadians(0.733204387077201, -1.99196858250162), S2LatLng.FromRadians(0.567830031749048, -2.17145323019111));
            var coverer = new S2RegionCoverer()
            {
                MaxLevel = 13,
                MinLevel = 13
            };
            var covering = new List<S2CellId>();
            coverer.GetCovering(region_rect, covering);
        }    
    }
}

.NET Native compilation fails due to C5 dependency

C5 has a known issue that prevents it from compiling with .NET Native due to infinite expansion.

I suggest you use native .NET collections in place of C5. I used HashSet and Dictionary in place of HashBag and HashDictionary and the library appears to work correctly.

Wrong coordinates returned from S2CellId#ToLatLng?

I need to extract Lat/Lng coordinates from a given CellId, but I'm having a slight difference netween the returned values and the correct ones, and I can't understand why.

The original coordinates are

47.678956162876,-122.12871664749933

while the CellId is

6093384589483442176

What I get back is

47.72217122031298,-122.12705319813203

Here's a little snippet of my code:

var cellId = new S2CellId(CellId).ToLatLng();            
return new Geopoint(new BasicGeoposition() {Latitude = cellId.LatDegrees, Longitude = cellId.LngDegrees})

Am I doing something wrong or is there an issue when converting back to Lat/Lng?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.