I'm trying to insert some values into a Geodjango database, but getting errors. This is the table:

class Place(models.Model):
    placeid = models.IntegerField(primary_key=True)
    structidx = models.IntegerField(null=True, blank=True)
    oscode = models.PointField(null=True, blank=True)
    waste86 = models.CharField(max_length=120, null=True, blank=True)
    objects = models.GeoManager()

And this is the code I'm using to insert data:

INSERT INTO domes_place (placeid, structidx, oscode, holding)
  VALUES ('10', '1', '1', 'POINT(632000,141000)', 'N');

And this is the error:

HINT:  "POINT(632000," <-- parse error at position 13 within geometry

Please could someone tell me what I'm doing wrong?


From looking at the documentation on the Geodjango website, it looks like you don't need the , between the numbers, so give this a try:

INSERT INTO domes_place (placeid, structidx, oscode, holding)
  VALUES ('10', '1', '1', 'POINT(632000 141000)', 'N');

Looks like the missing , is a WKT(Well-Known Text) convention, never noticed it before.


No comma: 'POINT(632000 141000)'

See WKT on Wikipedia for a quick reference to Well-Known Text.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.