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

learn more… | top users | synonyms

1
vote
0answers
13 views
+50

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
18 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
34 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
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 ...
3
votes
3answers
664 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
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
53 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
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", ...
2
votes
1answer
45 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
0answers
52 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
53 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
27 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
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
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 ...
1
vote
1answer
36 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
68 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
37 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
59 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
100 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
51 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 = ...
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
135 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 ...
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
59 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
229 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
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
229 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
116 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
172 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
117 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
236 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
274 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, ...
0
votes
1answer
88 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 ...
1
vote
2answers
527 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
474 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 ...
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 ...
0
votes
0answers
130 views

Django with arcpy 10.3: RasterDB.dll problem

I am working on a Django application and I need to be able to work with arcpy for geoprocessing. I have installed the Anaconda python distribution to use as the python for Django, because it has conda ...
2
votes
0answers
114 views

geodjango difficulties with srid

I'm trying to make geodjango app. I'm using SQLite and SpatialLite. I want to add shops, and be able to sort them from closest to furthest from my location. When in my model I have: location = ...
1
vote
0answers
120 views

Create polygons enclosing same number of points on PostGIS

I have a geodatabase on Postgis with points representing customers, what i need is give a number of customers, lets say 100 and it need to generate polygons enclosing 100 clients each one. I only ...
2
votes
1answer
209 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
225 views

Draw line overlays and center map

(Apologies if this is a trivial question; I'm completely new to the GIS world.) I have a dataset with start and end points of lines. Columns in the table are unique_line_id, line_start_point_lat, ...
0
votes
1answer
277 views

Spatialite in GeoDjango - “…they do not properly define db_type…”

I've started a new project and choose GeoDjango for it. Because I already developed with Django and sqlite as a DBMS and all worked perfectly fine for me, I found it a great option to use spatialite ...
2
votes
1answer
1k views

GEOS_ERROR: TopologyException: Input geom 1 is invalid: Self-intersection at or near point

I'm using GeoDjango (but I guess this is from the geos library). I have a set of polygons that compose a city surface and I want to merge them into a single one. The code looks like this: polygons = ...
2
votes
1answer
55 views

Python Geospatial Development Error

I'm working through some examples in the Python Geospatial Development book by Erik Westra. On page 439, about setting up a tile map server, he gives the following code for calculating a bounding ...
1
vote
0answers
52 views

Read and Write data with Open Layers3

I'am currently using postGIS/geoDjango/OL3 I need the capability for a user to drop a point on the map, and store that in my database. When any user returns, that point will be shown on the map. ...
1
vote
1answer
64 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. Any help is appreciated
1
vote
0answers
107 views

Clustering the WGS84 point features (projection transformation aspects)

My question is quite trivial and was discussed many times before (like here) but in our case it has the confounding extra requirements... The list of sparsely distributed 2d point features is stored ...