Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 977199
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T03:51:59+00:00 2026-05-16T03:51:59+00:00

PostgreSQL / Django / newbie here. I’ve got a bunch of JSON data with

  • 0

PostgreSQL / Django / newbie here.

I’ve got a bunch of JSON data with venues and lat/long information, and I’m looking to import it into my database. So far I’ve fenagled a script to format my JSON into SQL statements, so I can import them with a slew of INSERT statements.

But my ‘location’ field (a PointField) is giving me grief when I try to use ST_PointFromText(‘POINT(lon lat)’) syntax. Specifically:

ERROR: new row for relation “finder_venue” violates check constraint “enforce_srid_location”

So how do I generate a proper SRID?

Or, given Django’s ease, I can’t help but feel like I’m committing programmatic heresy here. Can someone point me in a more intelligent direction?

Thanks,

Jon

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T03:51:59+00:00Added an answer on May 16, 2026 at 3:51 am

    If you want to set the SRID in PostGIS, you can do this:

    ST_SetSRID(ST_PointFromText('POINT(-122 37)'), 4326)
    

    (4326 is the SRID here.)

    For GeoDjango, your model will be defined like this:

    from django.contrib.gis.db import models
    class Thing(models.Model):
        # ...
        location = models.PointField(srid=4326)  
        objects = models.GeoManager()
    

    If you’re actually using 4326, you can leave it out, as that’s the default.
    Then, you’ll set the location of your model instances so:

    from django.contrib.gis.geos import Point
    some_thing.location = Point(-122, 37)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using sqlite3 and Django I want to change to PostgreSQL and keep all data
Is Django or maybe POSTGRESQL losing information about primary keys and foreign keys when
Is there any way I can get django to store my data in postgresql
We've got a pretty typical django app running on postgresql 9.0. We've recently discovered
I'm using Django 1.3 with Postgresql 8.4 and I've got models like the following
I'm a django newbie and have been looking at this timezone stuff for several
I'm here because I'm really really new with heroku-python-django-postgresql group. I have googled for
I'm building a database with geo data in it using : PostgreSQL 9.1, Django
My site, which is built on Python/Postgresql with django, has an area where you
My web stack is django/python + postgresql + linux + apache. I use fabric

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.