Esempio n. 1
0
    def to_grid_locator(self, precision='square'):
        """Calculate Maidenhead locator from latitude and longitude.

        :param str precision: Precision with which generate locator string
        :rtype: ``str``
        :return: Maidenhead locator for latitude and longitude
        """
        return utils.to_grid_locator(self.latitude, self.longitude, precision)
Esempio n. 2
0
def test_to_grid_locator(data, result):
    assert to_grid_locator(*data) == result
Esempio n. 3
0
def test_to_grid_locator():
    expect(to_grid_locator(21.319, -157.904, 'extsquare')) == 'BL11bh16'
    expect(to_grid_locator(52.021, -0.208, 'subsquare')) == 'IO92va'
    expect(to_grid_locator(52.021, -1.958)) == 'IO92'