paulocheque / django-dynamic-fixture

A complete library to create dynamic model instances for testing purposes.
http://django-dynamic-fixture.readthedocs.io/
Other
390 stars 67 forks source link

GEOS "Point" expects (longitude, latitude) #78

Closed michaellea closed 7 years ago

michaellea commented 8 years ago

GeoDjango's "Point" class expects the constructor arguments to be (longitude, latitude) rather than the more traditional (latitude, longitude). Inverting them results in some unexpected behaviour & validation errors.

Fix is likely just to switch the arguments in fixture_algorithms/default_fixture.py:

class GeoDjangoDataFixture(object):
    def create_point(self, x=None, y=None):
        # latitude: [-90,90], longitude: [-180,180]
        latitude = x or random.randint(-90, 90)
        longitude = y or random.randint(-180, 180)
        return Point(longitude, latitude)
serge-gaia commented 7 years ago

Agree, we can't use any geometry operations with this inversion of angles.

paulocheque commented 7 years ago

Thanks for the report! Check this commit.

paulocheque commented 7 years ago

Added in 1.9.4.

serge-gaia commented 7 years ago

:+1: