Questions tagged [django]
Django is a high-level Python Web framework
123
questions
0
votes
0
answers
89
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
13
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
66
views
Trouble with clipping a GeoJSON polygon from a PNG raster tile in a Django Python app with rasterio
I am currently working with a Django Python app that is associated with a PostgreSQL database where PostGIS is installed. There's a specific table in the database with a column of the polygon type, ...
0
votes
0
answers
25
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
869
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 ...
2
votes
1
answer
81
views
Save a GDAL dataset to Django file field
I am processing a raster image inside my Django app. From a GeoTIFF file I am converting it to a COG. I am using gdal.Translate for the operation. I want to save the processed image without saving it ...
0
votes
0
answers
46
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 ...
1
vote
2
answers
163
views
Math error when trying to calculate the distance between two coordinates in python
I'm not sure if this is the right place but I am trying to develop a Django site that (among other things) shows public projects within 30 km of a given French commune. It mostly works fine but for ...
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
158
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
26
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
147
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):
...
1
vote
1
answer
83
views
Hot to add buttons (links) to Geonode Menu bar using geonode-project 4.1.x?
I just install Geonode-project 4.1.x and try to follow the official documentation (https://docs.geonode.org/en/4.x/devel/workshops/index.html#customize-the-look-and-feel) to customize the look and add ...
3
votes
2
answers
2k
views
Problem installing gdal with conda
I am on Ubuntu 21.04 with system level gdal 3.0.4 as verified by gdalinfo --version. My conda environment was created using the command conda create -n dev python=3.7. I then used pip to install my ...
0
votes
1
answer
142
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....
0
votes
0
answers
23
views
Gedjango point is not storing
I have a django project with a table field of PointField.
I tried to store into pointfield from latitude and lngitude with this line of code:
latitude = float(request.POST.get('latitude'))
longitude = ...
1
vote
0
answers
135
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
164
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
0
answers
75
views
Mixing JSON and GeoJSON in a Django answer
I want to retrieve two separate GeoJSON created from a PostGIS database with Django as well as some valuable information. Here is an example of what I would like to send back to the front end :
...
1
vote
0
answers
89
views
Django Leaflet Back-end Service for Map Screenshot
I am developing an application in Django using leaflet, i have a questionnaire that when user fill they type the address, and then using google address api, i fetch the address details e.g. lat/long.
...
2
votes
0
answers
111
views
How can I display WKT MultiLineString on OpenLayers in DJANGO project [closed]
I want to display WKT in text on HTML. I wanted it on JS variable but i couldn't do that.
Python code
def showResult(request):
start = request.GET['start']
end = request.GET['end']
.
...
1
vote
1
answer
260
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
139
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
408
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
613
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
1
answer
682
views
Icon not displayed on OpenLayers when using Bootstrap Icons-Font
I'm trying to display Bootstrap Icons as icons on my OpenLayers map.
I downloaded the icons css and woff-files into my Django-App and they work fine when referenced from html files.
However, when I'm ...
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 ...
1
vote
0
answers
228
views
Deleting GeoServer layer with Django
I am trying to delete from the GeoServer using Django with request.delete, however, I get the 401 error.
GEOSERVER_URL = f"http://admin:geoserver@GEOSERVER:8080/geoserver/rest/workspaces"
...
7
votes
0
answers
1k
views
Controlling the visibility of a FeatureGroup in Folium with an HTML checkbox
I'm working on a project in Django where I want to show layers on a map by checking or unchecking boxes which I created using bootstrap. I am aware it is possible to use LayerControl to get these ...
2
votes
0
answers
552
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, ...
1
vote
1
answer
126
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(...
1
vote
0
answers
201
views
Error when installing Geonode: cannot find django-geonode-mapstore-client>=2.1.0
I am very new to programming. I am trying to install GeoNode on an AWS Windows EC2 image, according to this tutorial (which is super, by the way!)
When I get to the pip install -e geonode stage, the ...
1
vote
1
answer
388
views
Google Maps satellite view footprints not congruent to street map view
I am trying to draw the layout of a building and project them to a web map using Django and Leaflet. I am using a satellite image to get the correct latitude and longitude and then I send the ...
1
vote
0
answers
143
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
397
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 ...
7
votes
3
answers
4k
views
From uploaded zipped shapefile to Geopandas DataFrame in Django Application
I'm trying to get to a point where I can quickly filter thousands of points in a shapefile. My Django application asks for a zipped shapefile to upload, where the zipped file contains at least the ....
0
votes
0
answers
285
views
Django ORM geo function ST_AsMVTGeom always returns type "bytea" not "geometry"
I want to use POSTGIS function ST_AsMVTGeom with django ORM. Therefore I create following geo function:
from django.contrib.gis.db.models.functions import Transform, GeoFunc
class AsMVTGeom(GeoFunc):
...
5
votes
0
answers
296
views
How to get the raster values of a point using Django's ORM (equivalent to ST_Value in PostGIS)?
I am working on a Django project that uses Django ORM to export raster data into PostGIS database. Here is the Django model:
from django.contrib.gis.db import models
class RasterWithName(models.Model):...
2
votes
1
answer
728
views
Can I create a geospatial PDF in Python without using GIS software?
I have a Django web app that produces a couple different PDFs. One just displays tabular data, but another one needs to display geometries out of a PostGIS database, along with tabular data. In my web ...
0
votes
1
answer
49
views
Difference in area size calculation since update packages
On my mac I use brew to install PostGIS and all dependencies, including geos.
Since month or so, I have a failing test in my Python code.
A polygon that is entered in WGS84 (srid 4326), the converted ...
1
vote
0
answers
568
views
How to plot raster data in leaflet
I'm trying to develop gis based web application. I'm using leaflet for frontend and django for backend. My requirement is to plot raster data in leaflet. I'm using rasterio for reading raster file. ...
0
votes
0
answers
112
views
Filter on distance point field and choice field
I have model shop
shop
class Shop(models.Model):
CATEGORY = (
('BookShop', 'Bookshop'),
('Bakery', 'Bakery'),
('Dairy', 'Dairy'),
Shop_category = models.CharField(max_length=200, null=...
0
votes
0
answers
718
views
Printing OpenLayers map with vector tile layers has CORS error for GeoServer vector tiles
I want to create a client side printing module for OpenLayers (v6) map. In OpenLayers web site there is a printing example with JSPDF (Export PDF example
). I used this example but there is an error:
...
2
votes
0
answers
300
views
GeoDjango query raster pixel values in PostGIS
I am building a REST API in GeoDjango that queries pixel values on a multiband raster held in PostGIS (out of db).
I have defined the following model to match the raster held on the database:
from ...
0
votes
0
answers
58
views
CartoView Error
I've installed CartoView on Windows 7 by default instruction. I've changed Postgres to my own DB (It was problem with default DB from install package). CartoView doesn't start with this error:
I ...
1
vote
0
answers
70
views
Inaccurate difference operations in GEOS
I've noticed large inaccuracies in the Django GEOS API's difference operation, see the example below.
In [3]: geom1 = GEOSGeometry('{ "type": "Polygon", "coordinates": [ [ [ -19.51171875, 37....
1
vote
1
answer
31
views
Linux gives different result from Windows after import with osm2pgsql
I've done a blank Django project. Then shared it via git on gitlab.
Then downloaded a very small region from geofabrik
Then:
in Windows I've imported it via:
osm2pgsql -c -U xx -d yy -H localhost -W -...
1
vote
1
answer
878
views
Rendering polygon from GeoJSON using GeoDjango
I can't render a single polygon from a GeoJSON.
I use this model:
class AddGeometryBase(models.Model):
name = models.CharField(max_length=100)
def __str__(self):
return self.name
...
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 ...
4
votes
2
answers
92
views
Running Geonode solr application
I am trying to follow these steps http://www.paolocorti.net/foss4g_2017_geonode_solr/10_customization.html but I installed geonode using the quick start tutorial http://geonode.org/#install. I am not ...