Use GeometryShapes for CircularAreaSink
Closed this issue · 3 comments
In GitLab by @Huite on Jun 18, 2022, 16:07
QGIS doesn't make it very easy to draw circles. The current setup ask you to specify a range, which will buffer a point to create a circle. Only afterwards can the circle be moved.
I just found this plugin via StackExchange:
https://plugins.qgis.org/plugins/GeometryShapes/
https://github.com/pvandegeer/GeometryShapes
This does exactly the right thing.
It's possible to state a dependency in metadata.txt, but that doesn't install it, which adds another step to installation.
Possibilities:
- Require it
- Include it (it's GPL licensed as all plugins are anyway)
A related issue: how to ensure the created geometry is always a circle?
Since the CircularAreaSink is just a Polygon layer for QGIS, a user may add any geometry. We could set the plugin to go into "Circle Drawing mode" automatically after adding a CircularAreaSink element, but this doesn't help with drawing circles later on... of course, the current setup doesn't do that either, and basically assumes a single circle per layer. So it would be an improvement regardless.
In GitLab by @Huite on Jun 18, 2022, 18:03
GeoPackages support CurvyPolygons, as well as a "Shape Digitizing Toolbar":
This is perhaps the best option, if it were not for shapely and geopandas:
Input In [5], in <cell line: 1>()
----> 1 gpd.read_file(r"c:\tmp\qgis-tim-tests\test32.gpkg", layer="curvy_poly_RD")
File C:\imodforge\lib\site-packages\geopandas\io\file.py:238, in _read_file(filename, bbox, mask, rows, **kwargs)
236 f_filt = features
237 # get list of columns
--> 238 columns = list(features.schema["properties"])
239 if kwargs.get("ignore_geometry", False):
240 return pd.DataFrame(
241 [record["properties"] for record in f_filt], columns=columns
242 )
File C:\imodforge\lib\site-packages\fiona\collection.py:208, in Collection.schema(self)
201 """Returns a mapping describing the data schema.
202
203 The mapping has 'geometry' and 'properties' items. The former is a
204 string such as 'Point' and the latter is an ordered mapping that
205 follows the order of fields in the data file.
206 """
207 if not self._schema and self.mode in ("a", "r") and self.session:
--> 208 self._schema = self.session.get_schema()
209 return self._schema
File fiona\ogrext.pyx:719, in fiona.ogrext.Session.get_schema()
File fiona\_geometry.pyx:81, in fiona._geometry.normalize_geometry_type_code()
UnsupportedGeometryTypeError: 10
# Mapping of OGR integer geometry types to GeoJSON type names.
GEOMETRY_TYPES = {
0: 'Unknown',
1: 'Point',
2: 'LineString',
3: 'Polygon',
4: 'MultiPoint',
5: 'MultiLineString',
6: 'MultiPolygon',
7: 'GeometryCollection',
# Unsupported types.
#8: 'CircularString',
#9: 'CompoundCurve',
#10: 'CurvePolygon',
#11: 'MultiCurve',
#12: 'MultiSurface',
#13: 'Curve',
#14: 'Surface',
#15: 'PolyhedralSurface',
#16: 'TIN',
#17: 'Triangle',
100: 'None',
101: 'LinearRing',
0x80000001: '3D Point',
0x80000002: '3D LineString',
0x80000003: '3D Polygon',
0x80000004: '3D MultiPoint',
0x80000005: '3D MultiLineString',
0x80000006: '3D MultiPolygon',
0x80000007: '3D GeometryCollection' }
From: https://github.com/Toblerity/Fiona/blob/a6ed5b2e6972e4dad438b85e6f4b4ac8db1154c6/fiona/_geometry.pyx
In GitLab by @Huite on Jun 18, 2022, 18:17
https://gis.stackexchange.com/questions/256123/how-to-convert-curved-features-into-geojson
GDAL (and OGR) do support the curvy elements. One would have to convert using GetLinearGeometry()
. Doesn't seem worth the effort -- better to go with linear geometry out of the box.
In GitLab by @Huite on Oct 31, 2022, 13:18
Contrary to earlier comment: I can open the coordinates now via geopandas from a circular feature created by the Shape Digitizing Toolbar!