Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Here's what I think you're asking for:</p> <p>GeoDjango uses an object relational mapper. In your models.py, you'll have to define a model that includes a point, e.g:</p> <pre><code>class my_points(models.Model): name = models.CharField(max_length = 100) coords = models.PointField() </code></pre> <p>Then, in one of your views, you'll need to instantiate a my_points object:</p> <pre><code>a = my_point(name="example", coords=x,y) </code></pre> <p>I imagine this isn't syntactically perfect, but the GeoDjango model api: <a href="http://docs.djangoproject.com/en/dev/ref/contrib/gis/model-api/" rel="nofollow">http://docs.djangoproject.com/en/dev/ref/contrib/gis/model-api/</a> and the regular geodjango models guide: <a href="http://docs.djangoproject.com/en/dev/topics/db/models/" rel="nofollow">http://docs.djangoproject.com/en/dev/topics/db/models/</a> will probably get you where you need to go. Hope that helps.</p> <p><strong>Edit</strong>: Okay, I didn't understand your post. "add a POINT" indicated to me that you wanted to add one. Your SQL statement is for updating a value, though.</p> <p>To update values in a database, you'll still need a model. I'm going to proceed on the assumption that you have a model set up called "my_points".</p> <pre><code>from django.contrib.gis.geos import GEOSGeometry # queries the database for the object with an id=101 a = my_points.objects.get(id=101) # defines your point pnt = GEOSGeometry('POINT(5 23)') # updates the object in memory a.coords = pnt # saves the changes to the database a.save() </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload