Giter VIP home page Giter VIP logo

s2-geometry-javascript's People

Contributors

jonatkins 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

s2-geometry-javascript's Issues

Needs v1.0.0 git tag

Once this is tested and has relevant documentation, it'll need a v1.0.0 tag for semver for use with npm, bower, or whatever else.

False Cell ID returned

Following Latitude and Longitute
lat = -6.120097
lng = 106.846511
return a Cell ID of '4197156086991552512'

unbenannt

Code:

var s2 = require('s2-geometry').S2;
var origin = s2.S2Cell.FromLatLng({lat: -6.120097, lng: 106.846511}, 15);
var cell = origin.toHilbertQuadkey();
console.log(s2.toId(origin));

Regards Skeec

Needs LICENSE

Which license do you prefer? I'll add it and PR.

  • MIT
  • BSD 2-clause
  • BSD 3-clause
  • Apache-2.0
  • ISC

I like to dual-license Apache-2.0 and MIT because then it can be GPL-compatible via MIT and also grant relevant rights in perpetuity all IP via Apache-2.0.

How to apply hilbert curve?

Do you know if it's possible to apply a hilbert curve without converting the cell to a 64-bit ID and back?

I'm able to return neighbors and I have some code for the hilbert curve and I'm trying to figure out how to adapt it so that I can add next() and prev() functions to a cell, but it appears to need and integer as initial.

I see you mention combine face,position to get the cell id L16, but I'm not sure which function that refers to and there's no variable called position, except in pointToHilbertQuadList L161 & L256, but I'm not clear on how to use that to get next and prev.

Can you help me with this at all? I'd be willing to pay for consulting.

How to convert Face,Quadtree to CellId?

Is it possible to directly derive a CellId, such as 9749618446378729472 from the face,quadtree pair, such as 4/032212303102210?

face encoding

  • "human readable" form is base 10
  • 3-bit - i.e. an unfolded 6-sided cube with base 10 face representations of 0,1,2,3,4,5
  • 6 and 7 are unused and invalid
  • 3 binary characters - i.e. 000, 001, 010, 011, 100, 101
  • 110 and 111 are unused and invalid

position encoding

  • "human readable" form is base 4 (quadkey)
  • 61-bit

level encoding

  • "human readable" form is base 10
  • can calculated from the least (or most?) significant bit
  • the length of hilbert curve quadkey / quadtree string is the level
  • if the level is explicit then the extra digits are dropped or added (from / to the end?)

id encoding

Note that + means concat and NOT add

  • face bits + position bits + 1 + pad(bits, 0)
// id          9749618446378729472
// quadkey     4/032212303102210
// base 4      10    032212303102210                   1000000000000000
// base 10    100    001110100110110011010010100100    1000000000000000000000000000000

Note that + means concat and NOT add

// psuedo-code
// This WON'T work because JavaScript uses 31-bit integers (53-bit floats)
var faceBits = 3;
var maxLevel = 30;
var maxBits = (maxLevel * 2) + 1; // one bit is lost to the marker

var str = face.toString(2) + position.toString(2) + '1';
str = padRight(str, maxBits, '0');
//  4/032212303102210
//  4    032212303102210                    1000000000000000
// 100   0001110100110110011010010100100    1000000000000000000000000000000
Long.fromString('9749618446378729472', true, 10).toString('4');
'20131031212211021000000000000000'
Long.fromString('9749618446378729472', true, 10).toString('2');
'1000011101001101100110100101001001000000000000000000000000000000'

Expected:

9749618446378729472
20131031212211021000000000000000
1000011101001101100110100101001001000000000000000000000000000000

Transfer Ownership

I'm currently hosting the updates at https://github.com/coolaj86/s2-geometry-javascript

Would you like to transfer ownership?

You can go to the transfer ownership section at the bottom of the settings page, click 'transfer' and choose to transfer s2-geometry-javascript to Daplie.

I've already created AUTHORS and LICENSE files in my fork to give you proper attribution.

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.