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

learn more… | top users | synonyms

2
votes
1answer
189 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
15 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....
1
vote
1answer
188 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 ...
3
votes
1answer
57 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 ...
1
vote
2answers
588 views

Polygon intersection with bounding box with polygon's holes intact

I am trying to serve GeoJSON FeatureCollection tiles with each feature's geometries trimmed to the tile boundary. I am working on a Leaflet plugin to re-assemble the geometries. It works by building ...
0
votes
1answer
17 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(...
0
votes
0answers
15 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, ...
1
vote
1answer
71 views

geoDjango point geom field

I can't figure out why the geom field is so long, I can't make heads or tails of the number either.
1
vote
1answer
187 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) ...
3
votes
1answer
687 views

How to configure tilecache on nginx

I am running a geodjango application with mapnik and tilecache. Currently tilecache is run on another server to decrease the load on the application server. The application server has nginx as the ...
0
votes
1answer
56 views

How do I convert latitude and longitude to a 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
438 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 ...
2
votes
1answer
24 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 ...
7
votes
2answers
3k views

Using OpenLayers (with OpenStreetMaps) and PostGis for rendering data acquired from GPS tracking device?

I'm researching and planing to acquire data from GPS device and store them in postGIS database, then use geodjango to process/work them out and finally chart them on a map with OpenLayers. Will these ...
0
votes
1answer
51 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 ...
3
votes
1answer
121 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....
8
votes
5answers
5k views

Geodjango- get the distance between 2 points

What I want to do is quite simple, I have 2 locations defined by gps coords, lat / long like returned by google maps: http://gmaps-samples.googlecode.com/svn/trunk/geocoder/singlegeocode.html I need ...
0
votes
0answers
145 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
22 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
60 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 ...
4
votes
1answer
104 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 +...
2
votes
1answer
106 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
41 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 ...
1
vote
0answers
110 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
87 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 ...
2
votes
2answers
55 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
164 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 ...
3
votes
3answers
713 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#...
0
votes
1answer
59 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", "...
0
votes
0answers
283 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
181 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
117 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
1answer
61 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
38 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
2answers
108 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
2answers
970 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
208 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 ...
2
votes
1answer
272 views

GeoDjango and Google Maps

I try to calculate distance between two cities and I'm in big confusion because the results are wrong. I have a model in geodjango like this: class Address(geo_models.Model): coordinates = ...
1
vote
1answer
114 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
43 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
79 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 ...
6
votes
1answer
2k views

Geodjango distance between two points appears incorrect

I want to show you something. I am using django+postgis and I am experiencing wrong distance values between two points. This is my model: class Location(models.Model): name = models.CharField(...
4
votes
1answer
2k views

How to design model in Django using GeoDjango?

I am using Postgresql 9.0 and PostGIS 2.0. I am using Django 1.3 and GeoDjango. I have a model with id, latitude, longitude and placename. All the places are in the USA. My requirement is following: ...
2
votes
3answers
580 views

Geodjango read raster files

I am developing a web app in geodjango (django) framework but I need to import raster files. Is it possible a geodjango app read raster files from a directory? Thanks
1
vote
0answers
69 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....
1
vote
1answer
321 views

40k+ points from Shapefile, clustering them and populating on Google Maps/Webapp

I just started a new Python/Django webapp job related to GIS (and i'm totally new to GIS). Here is my task and what i have found so far, and i am stuck as to finding out what's the best way or the ...
2
votes
1answer
153 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
211 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
139 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 ...
2
votes
1answer
249 views

How could I generate a CRS field inside the GeoJSON object created by Leaflet layer.toGeoJSON?

I'm using Leaflet to transform some drawn polygons to GeoJSON and send them to a backend. But the GeoJSON objects generated by layer.toGeoJSON are like this: { "type":"Feature", "properties":{}, "...