Questions tagged [geodjango]
Django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design.
335
questions
0
votes
0
answers
35
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
27
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 ...
1
vote
1
answer
102
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
151
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 ...
0
votes
0
answers
16
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 ...
0
votes
0
answers
28
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 ...
0
votes
1
answer
1k
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 ...
1
vote
0
answers
91
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
56
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
47
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
28
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
56
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 ...
5
votes
3
answers
444
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
70
views
GeoDjango: PROJ_DB version mismatch
PROJ and GDAL are having it out on my system; GeoDjango reports the following error message :
GDAL_ERROR 1: b'PROJ: proj_create_from_database: C:\\Program Files\\PostgreSQL\\14\\share\\contrib\\...
0
votes
0
answers
27
views
How to represent SVG polygon in HTML using definition coming from PostGIS ST_AsSVG function [duplicate]
In my Django app I have PostGIS database. I tried to get a polygon as a SVG, so I could represent that polygon in HTML using the SVG standard.
I use the following query:
SELECT ST_AsSVG(geom) from ...
1
vote
0
answers
169
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 ...
0
votes
0
answers
31
views
Create dataset from code and "inject" multipolygon to it in geonode-project
I have created a new Django app form my geonode-project
In this app I have a Project Model with a geom (Multipolygon field), It also has a OneToOneField to Dataset.
What I want to achieve is:
When a ...
0
votes
0
answers
183
views
'InMemoryUploadedFile' object is not subscriptable while uploading a shape file into geodjango polygon field
I have converted kml file into .shp file. Now I am trying to upload .shp file through rest API to a geodjango polygon field.
'''
class ZoneViewSet(APIView):
def upload_zone(self, request):
...
0
votes
1
answer
164
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....
1
vote
0
answers
150
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
188
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 ...
1
vote
1
answer
103
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 ...
1
vote
1
answer
278
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
153
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
0
answers
421
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
vote
1
answer
657
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
269
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 ...
6
votes
1
answer
11k
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
0
answers
604
views
Load GeoJSON file into GeoDjango database
I am trying to load a GeoJSON file into my database (django.contrib.gis.db.backends.postgis) without success.
models.py
class Node(models.Model):
network = models.ForeignKey(RoadNetwork, ...
0
votes
0
answers
406
views
Generate MVT with POSTGIS and feature tolerance
I have a database which has three geometry tables 'tbl_point, tbl_line, tbl_polygon' with millions of features.
Each table has two geometry columns named geom & m_geom for geometries and multi-...
4
votes
0
answers
240
views
Layer ordering of ST_ASMVT tiles in Leaflet
I am generating MVT tiles for multiple layers in Django using the following query:
WITH
bounds AS (
SELECT ST_Segmentize(ST_MakeEnvelope(8247861.100083642, 3551570.082242422, 8252753....
0
votes
1
answer
342
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)
...
1
vote
1
answer
135
views
django.contrib.gis.gdal.CoordTransform does not work
I want to convert EPSG:7844 toEPSG:4326 by using django.contrib.gis.gdal. I define CoordTransform in this way:
from django.contrib.gis.gdal import CoordTransform, SpatialReference
ct = CoordTransform(...
3
votes
1
answer
828
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. ...
3
votes
0
answers
355
views
How to use a custom CRS in PROJ?
I want to change the CRS of a shapefile which uses EPSG:6257. Unfortunately, I am using Ubuntu 20.04 which comes with PROJ6. This particular CRS was only made available from PROJ7.2 onwards. So, I am ...
1
vote
1
answer
170
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 ...
1
vote
0
answers
152
views
Query to Display Polygons not Working on Geodjango-Leaftlet Web App
I am currently working on a Geodjango-Leaflet-OpenStreetMap web app. I have around 540000 polygons of property boundaries that were drawn in ArcMap; the polygons will be imported to the web app later ...
0
votes
1
answer
419
views
Search & Display Function for Geodjango-Leaflet Web Map
I am trying to add a search function into my Geodjango-Leaflet-Openstreetmap web map. I have around 540000 polygons of property boundaries that were drawn in Arcmap; the polygons will be imported to ...
0
votes
0
answers
67
views
How do I display data from a django rest get request in a react-leaflet using onEachFeature? [duplicate]
I imported shapefiles into my PostgreSQL database with PostGIS extension and created a REST API using Django which has a GET response like this:
[
{
"objectid": 1,
"id_field&...
1
vote
0
answers
143
views
Query a region within a larger region with GeoDjango REST API
I have a working Django REST API which can query all the counties in a country.
//My model
class kenya_counties(models.Model):
objectid = models.BigIntegerField()
id_field = models.BigIntegerField(...
2
votes
2
answers
1k
views
Add Geodjango MultiPolygon to Leaflet Map
I'm building a geospatial mapping application with Geodjango. I have created a model which has a MultiPolygonField():
class newJob(models.Model):
job_name = models.CharField(max_length=64)
...
0
votes
1
answer
231
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 ...
3
votes
1
answer
467
views
How to dynamically query and visualize PostGIS data using GeoDjango and OpenLayers?
I am trying to implement dynamic query functionality in GeoDjango and OpenLayers. First, I filter the data and return it in GeoJSON format using Django serialize. Then, the return GeoJSON data ...
0
votes
1
answer
487
views
Django: how to set all of the model's fields using LayerMapping?
I have a GeoDjango model like below (in "data" app):
from django.contrib.gis.db import models
class FirstModel(models.Model):
data_id = models.IntegerField(blank=True, null=True)
...
2
votes
1
answer
809
views
How to add a polygon coodinates field instead of drawing it
I am working on a simple web mapping app using Django framework, and I am trying to add a geometric field where to insert polygon geometry's coordinates instead of drawing it manually (these ...
1
vote
1
answer
565
views
How to get most accurate Point-Point distance queries in Europe with Spatialite
I have a GeoDjango app, currently on PostGIS, which I am converting to use Spatialite db instead. I have no specialised knowledge about GIS systems :(
The locations table has a Geography column ...
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
454
views
Use ST functions in GeoDjango Project
I have a Geo-Django project in which i am using postgres as database. I have a table with geometry column. I am filtering data and getting results which is working fine.
Problem is I want the geometry ...
0
votes
1
answer
791
views
PostGIS via GeoDjango: function ST_DistanceSphere(geometry, geometry) does not exist
I've been using PostGIS via GeoDjango (Django v3.0.7), happily until just now. I have a query (Django .filter()) that looks like this:
.filter(point__distance_lte=(dlPt, D(m=CloseRadius)))
when it ...
1
vote
0
answers
235
views
Loading selected shapefile from dropdown in Leaflet map having PostgreSQL database using GeoDjango [closed]
My base.html looks like this
{% load static %}
<!--To load leaflet links-->
{% load leaflet_tags%}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
&...