Exemplo n.º 1
0
 def test_compact_and_uncompact(self):
     hexagons = h3.polyfill(
         {
             'type':
                 'Polygon',
             'coordinates': [
                 [
                     [37.813318999983238, -122.4089866999972145], [
                     37.7866302000007224, -122.3805436999997056
                 ], [37.7198061999978478, -122.3544736999993603], [
                     37.7076131999975672, -122.5123436999983966
                 ], [37.7835871999971715, -122.5247187000021967],
                     [37.8151571999998453, -122.4798767000009008]
                 ]
             ]
         }, 9
     )
     compactedHexagons = h3.compact(hexagons)
     self.assertEqual(
         len(compactedHexagons), 209,
         'got an appropriate number of hexagons back'
     )
     uncompactedHexagons = h3.uncompact(compactedHexagons, 9)
     self.assertEqual(
         len(uncompactedHexagons), 1253,
         'got an appropriate number of hexagons back'
     )
Exemplo n.º 2
0
 def test_uncompact_error(self):
     hexagons = [h3.geo_to_h3(37, -122, 10)]
     with pytest.raises(Exception) as e_info:
         h3.uncompact(hexagons, 5)
     self.assertTrue(isinstance(e_info.value, Exception))
Exemplo n.º 3
0
    def test_compact_and_uncompact_nothing(self):
        compactedNothing = h3.compact([])
        self.assertEqual(len(compactedNothing), 0, 'still nothing')

        uncompactedNothing = h3.uncompact([], 9)
        self.assertEqual(len(uncompactedNothing), 0, 'still nothing')