[Django]-What is the format for a PointField in a django fixture?

4πŸ‘

βœ…

It appears to use the Well-known text (WKT) format

For example, the following worked with python manage.py loaddata myfixture.json:

[
    {
    "model": "myapp.Location",
    "pk": 1,
    "fields": {
        "name": "Location Number 1",
        "point": "POINT (30 10)",
    }
  }
]

This successfully imported into postgresql database column with the type point geometry(Point,4326).

If you were using another type such as a PolygonField, then presumably the format would be for example:

POLYGON ((30 10, 40 40, 20 40, 10 20, 30 10))
πŸ‘€User

Leave a comment