Feature #1047
closedEnter WKT geometries
Description
In many cases geometries for places, features and stratigraphic units already exist as research data from various sources and could be used for the data input.
So far I imported them directly in the PostgreSQL PostGIS using sql commands.
It would be very very helpful to have the possibility to import them already in the edit view of our physical things.
Therefore I suggest to start with WKT and then extend this to .shp files in the future.
WKT could be achieved by inserting the string as text and creating the polygon then via PostGIS geometry from WKT
shp: https://gis.stackexchange.com/questions/41799/adding-shapefiles-to-postgis-database
Branch: feature/wkt_import
Updated by Alexander Watzinger over 5 years ago
- Status changed from New to Acknowledged
Updated by Alexander Watzinger about 5 years ago
- Target version changed from 187 to 193
Updated by Alexander Watzinger about 5 years ago
- Target version changed from 193 to 4.1.0
Moving this feature to 4.1.0 because we will release the major version 4.0.0 first and than see if this can be implemented with the new API.
Updated by Alexander Watzinger almost 5 years ago
- Target version changed from 4.1.0 to 5.0.0
Updated by Alexander Watzinger almost 5 years ago
- Category set to Backend
- Target version changed from 5.0.0 to 5.2.0
Updated by Alexander Watzinger almost 5 years ago
- Target version changed from 5.2.0 to Wishlist
Updated by Bernhard Koschiček-Krombholz about 4 years ago
- Description updated (diff)
Updated by Bernhard Koschiček-Krombholz almost 4 years ago
- Subject changed from Import geometries to API: Import geometries
- Category changed from Backend to API
- Target version changed from Wishlist to 208
Browsing through old issues, and found that. I will move this to the API section.
I will start with geojson, because they don't need extra packages, are human-readable, easy to manipulate and QGIS and ArcGIS can easily convert .shp files to geojson.
This has to be a cooperative with the UI, since Stefan wants it in the edit view.
In a first version, it should be possible to upload a geojson with several geometries (no Multi Geometries and no Z value) with a name field, which creates a new entry for each geometry.
Early additional features will be:- link to existing Place entity through id field
- link to types through id if geojson import creates a new entity
- create one entity with n geometries
Question to Stefan
WKT could be achieved by inserting the string as text and creating the polygon then via PostGIS geometry from WKT
This can actually be done in the SQL interface provided under /sql or? Can you send me an example from you of such a string?
Updated by Bernhard Koschiček-Krombholz almost 4 years ago
- Category changed from API to Data import/export
Updated by Bernhard Koschiček-Krombholz almost 4 years ago
- Assignee set to Bernhard Koschiček-Krombholz
Updated by Alexander Watzinger almost 4 years ago
Just wanted to add it would be very useful to add many geometries in one go just in case this wasn't meant implicit already. What I mean is not just many geometries for one entry but also for multiple entities.
But first we should implement adding entities themselves.
Updated by Bernhard Koschiček-Krombholz almost 4 years ago
- link to existing Place entity through id field
- link to types through id if geojson import creates a new entity
- create one entity with n geometries
with any amount of geometries coming from a geojson. Of course, it does only basic forms of data validation, but if the input data is fine, it works like a charm.
I will try to write specifications of such an import function until the meeting 28.01.21, so we can discuss this. The main format of data import will be json. Later we can add something like csv, excel and xml, because they are quite easy to convert to json.
Updated by Alexander Watzinger over 3 years ago
- Status changed from Acknowledged to Assigned
Updated by Bernhard Koschiček-Krombholz about 3 years ago
- Related to Feature #1567: Enhanced Import added
Updated by Bernhard Koschiček-Krombholz over 2 years ago
- Target version changed from 208 to Wishlist
Updated by Alexander Watzinger over 2 years ago
- Status changed from Assigned to Acknowledged
- Assignee deleted (
Bernhard Koschiček-Krombholz)
Removing assignees from wishlist issues, just in case anyone else wants to work on it.
Updated by Alexander Watzinger over 2 years ago
- Subject changed from API: Import geometries to Import geometries
- Description updated (diff)
Looking into it with Bernhard just now. Removing API because implementation maybe solved another way.
Updated by Bernhard Koschiček-Krombholz about 2 years ago
Some libraries for reading shapefile:
https://gis.stackexchange.com/questions/113799/reading-shapefile-in-python
Updated by Stefan Eichert about 2 years ago
If we consider a shapefile import, this would probably need its own user interface in order to select which feature of the shapefile is considered to be imported.
A shapefile can contain multiple geometries/features like a "geom" table in PostGIS. So we would have to read the shapefile and let the user select from a list or table with a geometry preview which feature should be imported and linked to the respective entity. Also the Coordinate Reference System needs to be transformed to WGS84. Therefore the shapefile must contain the respective information or the user has to provide it.
I think also some kind of bulk import would be a good idea. Given the example of a cemetery plot, one could enter all the graves first and then load the shapefile of the graves. In the next step the OpenAtlas features could be correlated with the ones from the shapefile. This would really accelerate the data acquisition with already existing digital geometries e.g. in shapefile format.
Technically this could also be done with shp2pgsql in PostGIS: https://gis.stackexchange.com/questions/39238/how-to-import-using-shp2pgsql
Updated by Jona Schlegel almost 2 years ago
This would also be interesting for INDIGO to import our sections, which we created in GIS.
Updated by Bernhard Koschiček-Krombholz almost 2 years ago
- Target version changed from Wishlist to 7.17.0
Updated by Alexander Watzinger over 1 year ago
shp2pgsql seems to be already part of the PostGIS Debian package and can be called (in bullseye, 3.1.1)
Next step would be to design the workflow when importing shape files.
Updated by Alexander Watzinger about 1 year ago
- Target version changed from 7.17.0 to 8.3.0
Updated by Alexander Watzinger 11 months ago
- Subject changed from Import geometries to Enter WKT geometries
- Target version changed from 8.3.0 to 8.2.0
We will discuss this in the next developer meeting but basically we do imports for WKT.
Shape files turned out to be very work intensive (needs funding), in case this is still needed please create an extra issue for this.
Updated by Alexander Watzinger 11 months ago
- Status changed from Acknowledged to Assigned
- Assignee set to Bernhard Koschiček-Krombholz
Updated by Bernhard Koschiček-Krombholz 11 months ago
- Status changed from Assigned to In Progress
Since WKT ist just a text string, i will implement a additional button on the map, where the string can be entered with an additional name and description.
Updated by Bernhard Koschiček-Krombholz 10 months ago
- Description updated (diff)
Currently, WKT import for POINT, POLYLINE and POLYGON is working. Right now, POLYGON will be treated as shape. Is this enough for the beginning, or should I include a switch?
And multi geometries will not be supported. For this, please create a new ticket.
Updated by Bernhard Koschiček-Krombholz 10 months ago
Added a switch, if a polygon is entered, to choose if area or shape.
I have one major issue, since leaflet uses reversed coordinate system, the entered coordinates have to be reversed. I got it working for points and linestrings, but the polygon coordinates won't change. I have really no idea why and maybe someone who is more educated in JavaScript can take a look at it.
Otherwise, it is working with these test WKT strings:
POINT(30 10) LINESTRING(30 10, 10 30, 40 40) POLYGON((30 10, 40 40, 20 40, 10 20, 30 10))
Updated by Bernhard Koschiček-Krombholz 10 months ago
Fixed the problem with the polygon.
There is one UI issue left, which I need help with. It is very Leaflet specific, so I maybe ask Christoph.
After that, it is ready to deploy.
Updated by Bernhard Koschiček-Krombholz 10 months ago
- Status changed from In Progress to Closed
Basic implementation is done. At the map, under the geonames search button, is a new button where you can enter the geometry and the let it draw on the map. Then a new popup of the respective geometry will pop up and you can enter name and description.
Hope this is enough for the beginning. For further feedback or wishes, please create a new ticket.