Beispiel #1
0
    def test_geocoding(self):
        addr = "4444 Browning Pl, Lincoln, NE, 68516"
        check = [40.7485215, -96.6579318]
        lat_long = geocode(addr)

        self.assertEqual(lat_long, check)
Beispiel #2
0
from springpython.context import ApplicationContext
from HTResearch.Utilities.context import DAOContext
from HTResearch.Utilities.geocoder import geocode

# Helper script to fix broken database by adding latlongs
if __name__ == '__main__':
    ctx = ApplicationContext(DAOContext())
    dao = ctx.get_object('OrganizationDAO')
    empty_latlngs = dao.findmany(latlng=[])
    null_latlngs = dao.findmany(latlng__exists=False)
    for dto in empty_latlngs:
        if not dto.address:
            continue
        dto.latlng = geocode(dto.address)
        dao.create_update(dto)
    for dto in null_latlngs:
        if not dto.address:
            continue
        dto.latlng = geocode(dto.address)
        dao.create_update(dto)
    def test_geocoding(self):
        addr = "4444 Browning Pl, Lincoln, NE, 68516"
        check = [40.7485215, -96.6579318]
        lat_long = geocode(addr)

        self.assertEqual(lat_long, check)