Questions tagged [geodjango]

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

Filter by
Sorted by
Tagged with
4 votes
2 answers
1k views

GeoJSON data not displaying on Openlayers map 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__(...
1 vote
2 answers
7k views

Python library or algorithm to generate arc geometry from three coordinate pairs?

I'm trying to write code to generate fixtures for a django/geodjango project. I need to generate geometry for arcs (line string) given three lat/long pairs; start of arc, end of arc and centre of arc. ...
0 votes
1 answer
714 views

External GPS feed for HTML5 geolocation API in django-leaflet?

My goal is the following: I'm developing a Django project. The goal is to locate places with a form. I'm using a CreateView generic view (maybe I should create it manually for more customization. 3 ...
0 votes
1 answer
373 views

GeoDjango geometry transform method is swapping x with y

I need to convert a geometry from srid 4326 to srid 3857: myPoint4326 = Point(x=-73,y=40, srid=4326) myPoint3857 = myPoint4326.transform(3857,clone=True) print(myPoint4326.wkt) print(myPoint3857.wkt) ...
0 votes
1 answer
179 views

Calculate direction in PostGIS & Django (GeoDjango)

Is it possible to calculate direction to detect if users are moving in "similar" direction having a few of their last coordinates (Points) using PostGIS + Django (https://docs.djangoproject....
10 votes
3 answers
8k views

Generalizing Polygons to MultiPolygons in GeoDjango?

I set up a model with models.PolygonField in geodjango, using postgres as database. I try to import shp into postgres. The problem is, shp (compiled with QGIS) mixes polygon and multipolygon, hence it ...
0 votes
1 answer
2k views

django.core.exceptions.ImproperlyConfigured: Could not find the GDAL library via Homebrew

Django 4.1.5 on M1 Ventura 13.3.1 (22E261) failing to detect GDAL installation even when enumerated per the documentation. Is this a version error or a pointer error? I don't really understand what ...
0 votes
1 answer
245 views

Querying PostgreSQL DB with Google "get.bounds()" coordinates

I am trying to only display markers on a Google Map that are in the current map bounds and then update the markers when the map moves. The difficulty I am running into is querying my database to pull ...
0 votes
1 answer
693 views

Contained Query does not work in spatial coordinates in GeoDjango?

These are my Models. I imported the shapefiles to this Models class Parcel(models.Model): objectid = models.BigIntegerField() apn = models.CharField(max_length = 80) lot_size = models....
1 vote
1 answer
213 views

Query GeoServer WFS layer attributes with form

How can I set up a form in HTML to query the attributes in my GeoServer WFS layer? I assume it has something to do with the action attribute but I'm not sure how it will work. Something like <form ...
3 votes
1 answer
2k views

Get exterior ring of a multipolygon using GEOSGeometry or PostGIS

I am trying to get the exterior ring of the multipolygon in the image below using GEOSGeometry (through GeoDjango) or Postgis, but I have not found an easy solution. This is an example of a ...
1 vote
1 answer
200 views

Customising a marker after performing a spatial search query

I'm have a geodjango app that uses leaflet for a front-end. I have integrated the search function on the front-end to be able to search a customer location in real-time, of which the code below does ...
0 votes
0 answers
155 views

Creating a GeoPandas dataframe from GeoDjango query, then extracting latitude values for Plotly

I am attempting to use information from my PostGis database with my Django application to make a 3d scatter in Plotly. I have timeseries data in my database with different metrics from vehicles, and ...
0 votes
0 answers
54 views

GeoDjango support for Microsoft SQL Server

From what I've been researching and testing, it seems SQL Server is not fully supported by GeoDjango. Is this correct? Ive been running into errors such as "'DatabaseOperations' object has no ...
3 votes
2 answers
3k views

GeoDjango application using SpatiaLite database

I want to create a simple GeoDjango app with SpatiaLite database but I have this error at migrate: django.core.exceptions.ImproperlyConfigured: Unable to load the SpatiaLite library extensio`. ...
1 vote
1 answer
206 views

Setting bounds to combination of two GeoJSON layers in Leaflet?

I am creating an app with django, geodjango and Leaflet, I am also using django-geojson and django-leaflet. I manage to insert on a map two features that contain points. But I am getting problems ...
0 votes
0 answers
258 views

TypeError: Cannot set GeoPoint SpatialProxy (POINT) with value of type: <class 'dict'>

I am working with Django, Django Rest Framework, Django Rest Framework GIS and POSTgis database to create an endpoint that should upload a geografical point and all its related information. I have ...
2 votes
1 answer
364 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
0 answers
21 views

Use GeoDjango to split an existing polyline based on road length and road completion percentage

How can I use GeoDjango to split an existing Farm-to-Road Market Proposal- polyline based on road length and user-inputted road completion percentage? I have a sample Farm-to-Road Market Proposal. The ...
6 votes
1 answer
182 views

What are lazy geometries?

How are "Lazy Geometries" different from other types of geometries? I'm an experienced Python/Django developer but am very new to the world of GIS. I've been unable to find the answer on ...
5 votes
3 answers
497 views

Checking if two polygons have internal points in common with GeoDjango and PostGIS

I am using GeoDjango with the PostGIS backend. Given two polygons I want to check if they overlap. I mean, they have interior points in common. If we check A.function(B) In the following picture &...
0 votes
0 answers
37 views

Error while importing shapefile data using LayerMapping in GeoDjango

I am facing an issue while importing shapefile data using LayerMapping in GeoDjango. I have defined a model Province with two fields - province_name and province_shapefile. The province_shapefile ...
1 vote
0 answers
135 views

Store a polygon in a field using GeoDjango and Google Maps

I am currently working on a project that involves storing polygons in a GeoDjango field. I am using Google Maps to draw the polygons, but I am encountering an error when I try to save them. The error ...
0 votes
0 answers
64 views

Add Locate button LeafletWidget() in GeoDjango

I created a new widget that inherent from LeafletWidget() . I'm trying to add Locate Button to the map but i keep getting errors.r Widgets.py from django.forms.widgets import Widget from django.utils....
1 vote
0 answers
51 views

Uploading area KML to GeoDjango MultiPolygonField

I have a model class Area(models.Model): name = models.CharField(max_length = 255) point = postgis.PointField(null = True, blank = True) area = postgis.MultiPolygonField(null = True, blank ...
0 votes
0 answers
30 views

GeoDjango real location points

I'm using GeoDjango to draw points/polygons in current location , but I'm getting this map which don't contain a geolocation button How can I add the current location button? Here is my code: Views....
0 votes
0 answers
73 views

Save a GDAL processed temporary file to Django Filefield

I am attempting to convert a raster file to a cloud optimized geotiff inside my Django application. In order to this, I have a post_save signal to trigger a task to do the conversion. Supposed, this ...
3 votes
1 answer
873 views

Finding nearest points based on distance and the user location and display on a Folium or Leaflet map?

I want to display the nearest services points using the distance function on the Folium map. I need to pass the user location from the form and find the nearest services based on the current location. ...
4 votes
3 answers
469 views

How to import an Access database to GeoDjango?

I'm a I've just inherited a pile of institutional geodata that's stored in an MS Access database. I need to pull that data out into a format that I can work with in GeoDjango--so I'm OK with ...
6 votes
2 answers
10k views

GeoDjango can't find GDAL

I'm following this tutorial: https://docs.djangoproject.com/en/2.2/ref/contrib/gis/tutorial/, I installed every component necessary. But it seems like Django can't find the gdal module. I have gdal ...
1 vote
0 answers
197 views

Print Leaflet map in PDF using django-wkhtmltopdf

I have a Django app I am trying to print a Leaflet map in PDF using django-wkhtmltopdf, but the map is not rendering correctly. I even try to give more time to the 'javascript-delay' parameter but is ...
6 votes
1 answer
13k views

GDAL configuration for Django in mac GDAL_LIBRARY_PATH exception

I tried to install GDAL in macos by the command for django brew install gdal and it successfully installed and I have also used pip install GDAL command and it also installed successfully. But, When I ...
2 votes
2 answers
902 views

Fixing spatial query in GeoDjango

I am new to Geodjango. and I am following the steps given in https://docs.djangoproject.com/en/dev/ref/contrib/gis/tutorial/# and the steps I followed before https://docs.djangoproject.com/en/dev/ref/...
3 votes
2 answers
3k views

How do I use polygon centroids within a GeoQuerySet?

I have two models: neighbourhoods and boroughs, each containing a polygon field. I am trying to construct a QuerySet that will give me the neighbourhoods within a given borough. I expected to use ...
1 vote
0 answers
166 views

Serializing Charfields to Point GeoDjango

I have two CharField in my model (longitude and latitude), I want serialize them with GeoJSON serializer and serve as API so I can use on Leaflet to show points on map, but GeoJSON serializer only ...
1 vote
1 answer
431 views

GeoDjango - Use GDAL python binding in the shell

I would like to use the GDAL python binding in my GeoDjango site. The aim of this is to use ogr2ogr capabilities in a script. I am on windows 7 so I have installed GDAL-1.9.2.win32-py2.7 downloaded ...
1 vote
1 answer
110 views

Getting Output out of the scope-Geo Django

I have a location and I want all the properties around within 100 km to the location. I tried to follow this(GeoDjango error: Only numeric values of degree units are allowed on geographic DWithin ...
4 votes
2 answers
1k views

PostGIS database to be queried by GeoDjango

I would like to create a PostgreSQL database (postgreslq-9.1 and postgis-2.0.2) storing several shapefiles but I am uncertain on how to implement it. I have already done this last year but was pretty ...
1 vote
0 answers
293 views

Adding data to Geodjango Polygon object (and have it carry through operations)

I would like to add extra information (such as speed and direction) to the base Polygon class and I'd like to maintain that data when performing operations such as convex_hull (extra data shouldn't ...
1 vote
4 answers
656 views

Converting coordinates using QGIS

In QGIS do I have a EPSG:4326 shapefile that shows the coordinates "-7148300 -3688500" and I need them in the format -64º -31º for further processing in a geodjango app. However using ...
2 votes
2 answers
3k views

DatabaseError: Coordinate values are out of range [-180 -90, 180 90] for GEOGRAPHY type

I am using Django 1.3, PostGIS 2.0 , Postgresql 9.0 and GeoDjango. I had a database with a table for places. This table had latitude and longitude for places in the US. I enabled this database with ...
12 votes
3 answers
15k 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":{}, "...
1 vote
1 answer
296 views

GeoDjango rendering duplicate geometry in Leaflet

I have a GeoDjango app following this tutorial but substituting World Borders polygon data as included in the standard GeoDjango tutorial. I have created serializers and a django rest api that ...
0 votes
1 answer
163 views

Adding a custom file type in GeoServer

I am trying to add a non-spatial (user-defined) file type, with a .zzz file extension, into GeoServer. This file type has no spatial content but as per requirements, I need to store as a Geonode layer....
1 vote
2 answers
2k views

TypeError: Invalid parameters given for Point initialization.on Django

I am working on a location based poject and what I all want is to show only those pointfields stored in database which are at certain distance from any clicked region of leaflet map.But when I click ...
1 vote
1 answer
1k views

How to find the area of polygon in geodjango?

I need to calculate the area of the Building (which the coordinates represents). I used transform() to calculate the area, but the calculated area is not accurate. Please help me calculating the area ...
1 vote
0 answers
443 views

How to set default_lon, default_lat for admin page using GISModelAdmin

How do you set default_lon, default_lat, and default_zoom for a PointField in the django admin page using GISModelAdmin class? With the following code the admin page loads correctly, but with the ...
-1 votes
2 answers
3k views

Creating interactive map on web page [closed]

I am working on a website using Django. A central component of this website will be a map page with accompanying functionality. I was planning on using JavaScript to render the map and use AJAX to get ...
1 vote
1 answer
713 views

Leaflet draw layers disappearing after creation in Django

I implemented leaflet in my Django project, and managed to add the draw functionalities. The thing is after i draw the shape instantly disappears. What should i do to solve the problem? map.html {% ...
0 votes
0 answers
291 views

Proj Error when trying to save data in PostGIS database from geodjango

I want to store my raster image(tiff) in my PostGIS database I have a Django model ndvitime and I want to store my tiff image from earth engine to my database. The error arises when I want to save the ...

1
2 3 4 5
7