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

learn more… | top users | synonyms

0
votes
0answers
3 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 = ...
2
votes
0answers
9 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 ...
0
votes
0answers
31 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 = ...
1
vote
2answers
546 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 ...
1
vote
1answer
29 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
36 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
48 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
662 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: ...
2
votes
1answer
43 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 = ...
0
votes
1answer
235 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 ...
0
votes
1answer
15 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", ...
3
votes
1answer
574 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
0answers
50 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 ...
2
votes
0answers
49 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", ...
1
vote
1answer
32 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
25 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
17 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
40 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 ...
0
votes
0answers
23 views

Dispaly 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 dispaly using openlayers. I went through many posts but none of them worked My ...
1
vote
2answers
521 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
99 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
207 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
66 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
36 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
57 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 ...
8
votes
4answers
4k 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 ...
5
votes
1answer
1k 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 = ...
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
469 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
50 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 = ...
1
vote
1answer
271 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
98 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
134 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
78 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
193 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":{}, ...
0
votes
0answers
12 views

Trouble Changing Paths for geospatial libraries

I am currently using Python 2.7, Django 1.8 and Windows 7. I am trying to set the Windows environment variables, as per the instructions here . When I try to do this using the Powershell, I get the ...
1
vote
0answers
21 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
58 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
227 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 ...
1
vote
1answer
114 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
171 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 ...
0
votes
1answer
59 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
227 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
189 views

GeoDjango error: Only numeric values of degree units are allowed on geographic DWithin queries

I'm trying to get N points within 5000 meters of a certain point. My database is Postgres(PostGIS). I have a model like this: class Theatre(models.Model): geom = models.PointField(srid=4326, ...
3
votes
3answers
585 views

which map projection should I use to calculate distance in Poland

I'm using/learning geodjango + postgis, and I'm trying to calculate distance between 2 cities in Poland. First using WGS84/4326 I define 2 points, and then after transforming this points into ...
1
vote
0answers
116 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: ...
1
vote
0answers
273 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, ...
1
vote
1answer
471 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 ...
0
votes
1answer
85 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 ...
2
votes
2answers
104 views

Can you rename the Django GeoManager object instance?

Is it possible to change the name of the GeoManager object from "objects" to something like "geo_objects"? The way I've done it in the code below is supposed to be the default way to configure your ...