Skip to content
This repository has been archived by the owner on Sep 27, 2023. It is now read-only.

How to access s2sphere.Cell methods of a given s2sphere.CellId? #38

Open
ppKrauss opened this issue Jun 24, 2019 · 2 comments
Open

How to access s2sphere.Cell methods of a given s2sphere.CellId? #38

ppKrauss opened this issue Jun 24, 2019 · 2 comments

Comments

@ppKrauss
Copy link

ppKrauss commented Jun 24, 2019

Supposing this context,

  import s2sphere
  token = '89c2588'
  id = s2sphere.CellId.from_token(token)

I can access id.face() , id.level() etc. methods. But how to access cell.exact_area()?


PS: when try cell = s2sphere.Cell( id.id() ) there are "ERROR: AttributeError: 'int' object has no attribute 'to_face_ij_orientation'"... And other strange errors with cell = s2sphere.Cell( id ).

@kuanb
Copy link

kuanb commented Dec 24, 2019

Here is the pattern I used, with success:

s2sphere.Cell(s2sphere.CellId(cell_id))

@ppKrauss
Copy link
Author

Hi @kuanb, thanks, it is the solution!


I am using s2sphere.Cell( s2sphere.CellId.from_token(token) ).exact_area() and works fine... But the test not returning expected (metric) value.

For example, using the site demo with 94ce59c94ac, that is a cell of ~100 m2, it is returning 6.27395e-12.
A bigger cell, 94ce4 (a cell of ~2500 km2), returns 0.0001046.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants