Django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design.

learn more… | top users | synonyms

0
votes
1answer
21 views

GeoDjango - faster way to use polygon.crosses?

I have a polygon and a line segment. I want to know if the line segment is both inside and outsize the polygon. Using "prepared" has helped but it's still no where near fast enough. how can i speed ...
0
votes
0answers
22 views

How to hook up GMap to GeoDjango?

models.py: class Location(models.Model): name = models.CharField(max_length=100) coords = gis_models.PointField(srid=4326, blank=True, null=True) forms.py: class LocationForm(gis_forms....
3
votes
1answer
66 views

inaccurate distance measurements in Python

I've tried several ways of measuring the distance between two points in my Django application and comparing the results to a reliable measurement. My numbers are way off. For example, I'm assuming the ...
0
votes
0answers
17 views

How to get marker's coordinates from GoogleMap into ModelForm (GeoDjango)

models.py: class Location(models.Model): name = models.CharField(max_length=100, verbose_name=u"Локация", default=u'') coords = gis_models.PointField(u"долгота/широта", srid=4326, blank=True, ...
0
votes
1answer
72 views

Converting latitude and longitude to point in geodjango?

I am doing the geodjango tutorial and I went on google and chose a random longitude and latitude in Kansas, I am using srid=4326 for my polygons So I got this random lat and long on google maps in ...
0
votes
1answer
25 views

I have two points in my geodjango models when serializing them using drf gis one of them gets renamed and the renamed one doesn't show in haystack?

class Space(TimeStampedModel): origin = models.PointField() destination = models.PointField() origin_address = models.CharField(max_length=255) destination_adress = models.CharField(...
2
votes
1answer
28 views

How to polygonize using GeoDjango and PostGIS?

The code of GeoDjango-1.9.2 contains reference to the function ST_Polygonize at: https://github.com/django/django/blob/master/django/contrib/gis/db/backends/postgis/operations.py#L132 But is it seems ...
0
votes
1answer
54 views

GeoDjango - Find all locations within X miles of provided point using bounding box

I'm trying to implement some search functionality for a web app, and have run into an issue where I don't know the proper functions to execute this. Given a Point, a bounding_box database field with ...
0
votes
0answers
204 views

GeoDjango: Insert geography coordinates and filter the nearest points, step by step

I would like to: Save pairs of srid 4326 (latitude, longitude) points in a PostGIS Geodjango 1.8 Database. (Maximum distance between the edge points: 2.000km) Given a srid 4326 (latitude, longitude) ...
0
votes
1answer
27 views

How to set coordinate dimensions in Django GDAL API?

The Django GDAL documentation for coord_dim says: coord_dim Returns or sets the coordinate dimension of this geometry. For example, the value would be 2 for two-dimensional geometries. But how do ...
0
votes
1answer
71 views

Geodjango with Geoserver and Openlayers

I am trying to teach my self Django and its spatial extension geoDjango. There is one thing, which is still a bit foggy in my mind. When using the trio: Postgis, geoserver, openlayers is perfectly ...
2
votes
1answer
130 views

Get LineString length in meters (Python, GEODjango)

In a Django model, I have a LineString field which holds GPS coordinates of a street route. I know that I the .length holds the length of the LineString, but I don't know what unit the returned value ...
2
votes
1answer
43 views

GeoDjango -How to store measurement data

Assume I have recorded the following values during a bike trip. One such dataset has been recorded every 5 seconds: timestamp, longitute, latitude, pulse rate, pedal frequency What is the best way ...
3
votes
1answer
147 views

Update GeoDjango models from KML?

I'm working in Django 1.9 and Postgres 9.4 with PostGIS extensions. I have a KML file, and I want to use it to update my geo fields. This is my model: class PCT(models.Model): code = models....
4
votes
1answer
117 views

GeoDjango with PostGIS: distance_lte filter is inaccurate

My view code (relevant part): location = self.GOOGLE_MAPS.geocode(lookup) if len(location): page = int(request.POST.get('page')) or 0 start = page * settings.PHOTOS_PER_BATCH end = (page +...
1
vote
0answers
131 views

Django/PostGIS: How to insert coordinates in PointField in EPSG:27700, and return EPSG:4236?

I am using Django 1.9 with PostGIS. I have input data that consists of British National Grid eastings and northings, and a table that looks like this: class Org(models.Model): name = models....
1
vote
1answer
104 views

GeoDjango - save two Point fields, one for geography and one for geometry

Most of the explanations I've read for geography and geometry seem to suggest that one must only use either geometry or geography, and that the only way to use both is to cast/convert between one and ...
3
votes
3answers
724 views

Why is geography faster than geometry for distance calculations?

Intuitively, I thought geometry would be faster than geography distance calculations, but this says otherwise: http://stackoverflow.com/questions/3547699/need-performance-on-postgis-with-geodjango#...
2
votes
2answers
60 views

PostGIS Address model/schema industry standard?

Is there an industry standard or best practices for a database of Addresses? I've searched for examples of Address models, and all I've found are very barbaric models that have something like address ...
0
votes
1answer
194 views

GeoJSON properties not displaying in popup-leaflet GeoDjango

I want to show the markers in different colours based on column(rastervalues) values in leaflet. My geojson data is {'geojson': "[{'type': 'FeatureCollection', 'features': [{'type': 'Feature', 'ge ...
0
votes
1answer
71 views

Create a GEOSGeometry from a FeatureCollection in GeoDango

Is it possible create a GEOSGeometry from a FeatureCollection(GeoJSON)? For instance: GEOSGeometry(json.dumps(fc)) where: fc = { "type": "FeatureCollection", "features": [ { "type": "Feature", "...
2
votes
1answer
249 views

GeoDjango, distance filter based on database column

I have a geodjango model with fields coverage = 10 * 1609.344 reference_point = Point(-72,45) #or some other lat lng class ServiceArea (geo_models.Model): center = geo_models.PointField(default=...
0
votes
0answers
323 views

Failed to load resource: the server responded with a status of 404 (Not Found) Django while displaying geojson data on map

I'm getting the following error when I try to diplay geojson data on map. http://localhost:8000/geojson/%7B%22type%22:%22Point%22,%22coordinates%22:[76.996944,31.58]%7D Failed to load resource: the ...
4
votes
0answers
210 views

Display GeoJSON data on map using django-leaflet?

I want to display GeoJSON data on map in geodjango. When I use the below code only GeoJSON data like: { "type": "FeatureCollection", "features": [{ "type": "Feature", "properties"...
1
vote
1answer
73 views

GeoDjango and PostGIS distance query efficiency concerns [closed]

For example, if I want a query that says "show me all houses within 50km from here and order them from nearest to furthest", these are the questions and concerns I have: Assuming we are using EC2 (...
1
vote
0answers
45 views

cross domain problem in geodjango for openlayers in django development server

I want to display geojson data on map in geodjango. Below is my code template/map.html (javascript code). only the map is loading but not the geojson data. Whwn I used debugger the url is gettin ...
1
vote
1answer
129 views

geojson data not rendering with openlayers in geodjango

map.html javascript code var map = new ol.Map({ layers: [ new ol.layer.Tile({ source: new ol.source.OSM() }) ], target: 'map', view: ...
1
vote
2answers
122 views

geojson data not getting displayed on map (Openlayers) in Geodjango

I have the following code models.py class PFT(models.Model): species=models.CharField(max_length=50) geom = models.PointField(srid=4326) objects=models.GeoManager() def __str__(self):...
1
vote
1answer
231 views

Display WFS (GeoJSON) from GeoServer with OpenLayers on Django

I want to display point data from PostGis to my Django application. I created WFS service from GeoServer and want to display using OpenLayers. I went through many posts but none of them worked My ...
1
vote
1answer
118 views

How to display shape files stored in a database into a web page

I'm pretty new to geodjango and python in general. But I would like to display my shapefiles stored in my database into a web pages and present them in layers and retrieve certain information if a ...
1
vote
1answer
45 views

Using geomanager to query

I'm doing a project using the combination of GeoDjango & PostGIS & Openlayer so far, I've imported OSM data with osm2pqsql, done settings and I knew the data is constructed by ...
1
vote
0answers
83 views

Getting current geoposition coordinates in Python? [closed]

I want to get my current geographical address so that i can extract data from my database using address matching. I am using django. I know how to get coordinates in html 5 and address from ...
1
vote
1answer
235 views

Is there an equivalent of GeoDjango for Flask or other Python web frameworks?

I have experimented with GeoDjango, but I think nobody would be surprised if I said there's quite a steep learning curve. I prefer Flask, which I also know much more than Django anyway, but I couldn't ...
1
vote
0answers
72 views

show polygon from database in browser in geodjango

I tried to retrieve the polygon which I saved into postgis database. (all polygons) Here is my code: models.py from django.contrib.gis.db import models class MyMap(models.Model): name = models....
2
votes
1answer
170 views

GeoDjango/PostGIS distance lookup not working

I'm building an api to make distance lookups using Django 1.8, GeoDjango, Django REST Framework and PostGIS. Locally I'm using PostGIS 2.1.7, my host (PythonAnywhere) uses 2.1.4... I'm not able to ...
0
votes
0answers
222 views

How do I set up a PostgreSQL database for use with PostGIS and GeoDjango?

The Django docs say to use createdb -T template_postgis geodjango but I already have a database set up. While trying to find out what this actually does and a way to apply it to an existing ...
1
vote
1answer
158 views

Django Postgis Distance from point

I have a point where the objcet is and another point for mylocation. I want to calculate the distance >> object_location <Point object at 0x7f9ceaac7be0> >> mylocation <Point ...
1
vote
0answers
24 views

Error in Load module in Geodjango

I am following this tutorial https://docs.djangoproject.com/en/1.8/ref/contrib/gis/tutorial/ and did layer mapping. And going along with documentation, I tried the below code from world import load ...
2
votes
0answers
78 views

GeoDjango and bug with bounding box query

Just some context first, I have a postgres database with PostGIS extension, running under a GeoDjango wrapper. I have a weird bug that hopefully someone can shed some light on. I'm running a query ...
1
vote
1answer
353 views

ImportError: cannot import name GEOSGeometry Django 1.7

I am a heroku newbie and I keep getting the said error whenever I try to sync db on heroku. I am using a hobby Dev instance which from this link shows that their is no support for PostGIS on the free ...
0
votes
1answer
107 views

how to custom geodjango admin

Here is what I do in django: class MyModel(models.Model): pass class MyModelAdmin(admin.ModelAdmin): pass admin.site.register(MyModel, MyModelAdmin) But with geodjango I have this: ...
2
votes
1answer
333 views

How to efficiently use a Postgres DB with Python

I have a Postgres DB with a lot of lines that are too long and so now I want to split those lines into smaller ones. This is why I started writing a little python script for that job. Basically it ...
1
vote
1answer
199 views

Creating geodjango model with geometry field that can accept different projections

I am working on web application with GeoDjango and within the model (db table) RoadAxis I have geometry field or more precisely LineStringField where I need to store different polylines (road axis) ...
2
votes
1answer
227 views

GeoDjango Setup: Python 'GDALAllRegister' Attribute Error

I am trying to setup Geodjango 1.8 in a virtualenv with Python 2.7.9 (Win32). I have installed and setup Postgres/PostGis and have my Path setup to my OSGeo4W directory. I have also installed the ...
1
vote
0answers
138 views

GeoDjango: AttributeError: function 'GDALAllRegister' not found [closed]

Im trying to get started with GeoDjango. I am using this https://docs.djangoproject.com/en/1.8/ref/contrib/gis/tutorial/ tutorial. When I run "python manage.py migrate" This error occur: "...
0
votes
1answer
489 views

GeoDjango: Find all points within radius?

I am working in GeoDjango (with a Django 1.7 and PostGIS 2.1.4 backend). I have a model with a PointField in my database and I am trying to find all items within 10km radius of a point. Here is my ...
1
vote
0answers
418 views

Import KML file into GeoDjango

I'm trying to import a KML file into an existing GeoDjango app (using a Postgres 9.3 database). This is my Django model: class PCT(models.Model): code = models.CharField(max_length=3, primary_key=...
0
votes
1answer
185 views

What is the best strategy to add a custom constraint to a geo-django table?

What is the best strategy to add a custom constraint to a geo-django table? This is the corresponding sql-statement: ALTER TABLE my_table ADD CONSTRAINT enforce_valid_geom CHECK (ST_IsValid(geom))...
1
vote
2answers
1k views

How to dispay my PostgGIS geometry on the GeoDjango map widget?

I'm trying to display a custom map feature on a GeoDjango map. The geometry is a multipolygon stored in a PostGIS database backend. And I have trouble to find the correct piece of documentation that ...
1
vote
1answer
725 views

Unable to create Polygon using Geodjango admin interface

I am new to GeoDjango. I have created Admin interface for my Model. It loads correctly. I am also able to draw the Polygon on map(At client side) but when I save It tells me Invalid input and throws ...