Project

General

Profile

Actions

Feature #1047

closed

Enter WKT geometries

Added by Stefan Eichert almost 5 years ago. Updated 3 months ago.

Status:
Closed
Priority:
Normal
Category:
Data import/export
Target version:
Start date:
2019-07-31
Estimated time:

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


Related issues 1 (0 open1 closed)

Related to OpenAtlas - Feature #1567: Enhanced ImportClosedBernhard Koschiček-Krombholz2021-08-25Actions
Actions #1

Updated by Alexander Watzinger almost 5 years ago

  • Target version set to 187
Actions #2

Updated by Alexander Watzinger almost 5 years ago

  • Status changed from New to Acknowledged
Actions #3

Updated by Alexander Watzinger over 4 years ago

  • Target version changed from 187 to 193
Actions #4

Updated by Alexander Watzinger over 4 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.

Actions #5

Updated by Alexander Watzinger over 4 years ago

  • Target version changed from 4.1.0 to 5.0.0
Actions #6

Updated by Alexander Watzinger over 4 years ago

  • Category set to Backend
  • Target version changed from 5.0.0 to 5.2.0
Actions #7

Updated by Alexander Watzinger over 4 years ago

  • Target version changed from 5.2.0 to Wishlist
Actions #8

Updated by Bernhard Koschiček-Krombholz over 3 years ago

  • Description updated (diff)
Actions #9

Updated by Bernhard Koschiček-Krombholz over 3 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?

Actions #10

Updated by Bernhard Koschiček-Krombholz over 3 years ago

  • Category changed from API to Data import/export
Actions #11

Updated by Bernhard Koschiček-Krombholz over 3 years ago

  • Assignee set to Bernhard Koschiček-Krombholz
Actions #12

Updated by Alexander Watzinger over 3 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.

Actions #13

Updated by Bernhard Koschiček-Krombholz over 3 years ago

I wrote already a script that does:
  • 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.

Actions #14

Updated by Alexander Watzinger over 2 years ago

  • Status changed from Acknowledged to Assigned
Actions #15

Updated by Bernhard Koschiček-Krombholz over 2 years ago

Actions #16

Updated by Bernhard Koschiček-Krombholz almost 2 years ago

  • Target version changed from 208 to Wishlist
Actions #17

Updated by Alexander Watzinger almost 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.

Actions #18

Updated by Alexander Watzinger over 1 year 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.

Actions #20

Updated by Stefan Eichert over 1 year 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

Actions #21

Updated by Jona Schlegel about 1 year ago

This would also be interesting for INDIGO to import our sections, which we created in GIS.

Actions #22

Updated by Bernhard Koschiček-Krombholz about 1 year ago

  • Target version changed from Wishlist to 7.17.0
Actions #23

Updated by Alexander Watzinger 8 months 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.

Actions #24

Updated by Alexander Watzinger 7 months ago

  • Target version changed from 7.17.0 to 8.3.0
Actions #25

Updated by Alexander Watzinger 4 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.

Actions #26

Updated by Alexander Watzinger 4 months ago

  • Status changed from Acknowledged to Assigned
  • Assignee set to Bernhard Koschiček-Krombholz
Actions #27

Updated by Bernhard Koschiček-Krombholz 4 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.

Actions #28

Updated by Bernhard Koschiček-Krombholz 3 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.

Actions #29

Updated by Bernhard Koschiček-Krombholz 3 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))    
Actions #30

Updated by Bernhard Koschiček-Krombholz 3 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.

Actions #31

Updated by Bernhard Koschiček-Krombholz 3 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.

Actions #32

Updated by Bernhard Koschiček-Krombholz 3 months ago

Translations done

Actions

Also available in: Atom PDF