Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

GIS fields #12

Open
ouhouhsami opened this Issue · 1 comment

1 participant

@ouhouhsami

It could be interesting to have generator for geographic fields.

GeometryField
PointField
LineStringField
PolygonField
MultiPointField
MultiLineStringField
MultiPolygonField
GeometryCollectionField

Could you give me a way to add support to these types of field ?

Thx

@ouhouhsami

a first generator for pointfield, (we should ad srid value, this example is for google srid) :

class GeoPointGenerator(generators.Generator):
    def __init__(self, *args, **kwargs):
        super(GeoPointGenerator, self).__init__(*args, **kwargs)

    def generate(self):
        coord_0 = decimal.Decimal(str(random.randrange(2003750834)/100 - 20037508.34/2))
        coord_1 = decimal.Decimal(str(random.randrange(2003750834)/100 - 20037508.34/2))
        value = 'POINT(%s %s)' % (coord_0, coord_1)
        return value
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.