Comments (3)
So I have been able to update a dataset by changing:
diff --git a/importer/handlers/common/vector.py b/importer/handlers/common/vector.py
index 3a56e16..a26a2b3 100644
--- a/importer/handlers/common/vector.py
+++ b/importer/handlers/common/vector.py
@@ -356,9 +356,7 @@ class BaseVectorFileHandler(BaseHandler):
dataset_exists = dataset_available.exists()
- if dataset_exists and should_be_overwritten:
- alternate = dataset_available.first().alternate
- elif not dataset_exists:
+ if not dataset_exists or dataset_exists and should_be_overwritten:
alternate = layer_name
else:
alternate = create_alternate(layer_name, str(_exec_obj.exec_id))
Works for me, but I'm new to GeoNode development, and I'd appreciate to have a comment from someone who knows better.
from geonode-importer.
Hi @sysnux
To overwrite an existing layer is enough to call the upload API by passing the override_existing_layer=True
as an additional parameter.
NOTE: be sure that the layer name you are providing matches the alternate that was generated (if is the only dataset available will have the layer_name=alternate), otherwise if you have multiple layers with the same name the system will append a MD5 to make it unique.
For example:
- layer_name = stations
- Does not exist a dataset with the alternate
workspace:layer_name
->layer_name / alternate => stations
- Exists a dataset with the alternate
workspace:layer_name
->layer_name / alternate
=>stations / stations_018735210827d5063ed0a1
So you want to overwrite the second layer, the layer name provided must match stations_018735210827d5063ed0a1
With your change, you are risking overwriting an unwanted layer. Two layers can have the same name but have different data in them.
Can you please try to roll back the changes and follow the above point to see if it works?
Thanks
from geonode-importer.
i'll close due the lack of feedback
from geonode-importer.
Related Issues (20)
- ogr2ogr ERROR 1: COPY statement failed
- Error during 0006_dataset_migration
- Mark GPKG, KML and GeoJSON as vector formats instead of archive
- GEODATABASE_URL forced to specify the DB port
- Handle "#" and any other special char HOT 1
- [GeoTiff] Upload with auxiliary file fails HOT 2
- Upload GeoTiff Error You can't execute queries until the end of the 'atomic' block HOT 10
- Let geoserver fail if the SRID is not correctly set
- Implement XmlFilehandler HOT 6
- Implement SldFileHandler
- Shapefile handler does not accept `cpg` and `cst` files
- Layer is not updated when using API (Geonode 4.1 Stable branch)
- Geonode-importer test suite
- Upload shapefile with cst file fails
- PG_USE_COPY should be optional
- Pipe the dump of the ogr2ogr command when using PgPool
- Unable to install geonode on python 3.11 due to gdal forced version HOT 4
- Wondering why using get_geoserver_cascading_workspace HOT 2
- Migration error 0005_fixup_dynamic_shema_table_names
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from geonode-importer.