A very though answer from Joseph clarifying how QGiS makes measurements However, the question is now clearer to me and it is:
How can I place the shape of defined dimensions (in metres, 5000m X 2000m) measured on the WGS84 ellipsoid at a location on the ellipsoid (51 degrees N 2 degrees W)?
QGIS 3 uses ellipsoid length calculations by default whereas in previous versions, this was ignored and instead planimetric distance calculations were used. If you measure the lines using the expression:
You should get the values you were looking for (5000m and 2000m):
Before you use your code, set your project ellipsoid measurement to ...
ST_GeomFromText demands the coordinates in the x1 y1,x2 y2, ... ,xn yn format, as said in the comments.
Consider using something like this to adjust the format of your coordinates column:
select coordinates, replace(replace(replace(coordinates, ' ', ';'), ',', ' '), ';', ',') as adjusted, ST_GeomFromText('LINESTRING('||adjusted||')') as geom from vejnet....
The QgsVectorLayer class does not have the function geometry. https://qgis.org/api/classQgsVectorLayer.html. Maybe you should use:
for feature in layer.getFeatures():
Let’s point out some useful information:
1 - A layer has features.
2 - A feature has a geometry
With that in mind, you need to iterate over the features in your layer. For each feature you do:
for feature in layer.getFeatures():
geom = feature.geometry()
len = geom.length()
And so on...
To directly answer your question, you can "align" the geometry of the pixels of multiple images by using ee.Image.reproject() and ee.Image.resample() and mapping those functions over images in the collection. However, be aware that this will potentially alter/smooth the information provided in each of the original images. (Your example is for a high latitude ...
I would use data access search and insert cursors after creating a new feature class. This will most likely be slower than the Buffer tool but it may be more successful, or you may be able to find your problematic geometry with try/except statements.
i = 'PCPP_sites'
o = 'C:\buffer_test'
outPath, outName = os.path.split ...
The easiest way to produce size invariant wind barbs is to make use of the Windbarbs mark in your style, rather than trying to construct it in map units (which is why yours change size with projection).
Based on this blog post by GeoSolutions you can use a SLD file like this:
After some further research, I found a solution:
The 3D equivalent to QgsGeometry().asPolyline (which returns a list of QgsPointXY) is QgsGeometry().constGet().points(), providing a list of QgsPoint. Such list is called a QgsPointSequencein QgsAbstractGeometry class, but called a QgsPolyline in QgsGeometry class. That's definetely confusing.
However, my ...
The code is in GitHub. The Fix Geometries tool is a wrapper to the function LWGEOM_GEOS_makeValid, which then calls different functions for different geometry types. You can read the various LWGEOM_GEOS_makeValid* functions such as the polygon one in the file qgsgeometrymakevalid.cpp
In R there is package cleangeo for geometry checking and celaning. You can use for example:
report <- clgeo_CollectionReport(spatial_object)
#returns a table:
type valid issue_type
1 <NA> TRUE <NA>
2 rgeos_validity FALSE GEOM_VALIDITY
3 rgeos_error FALSE ORPHANED_HOLE
The query is taking a long time because it is doing a cross products between tables a and b (and poly).
So if poly has 1 polygon only, and both a and b have 1,000,000 features, you end up computing st_DWithin 1,000,000,000,000 times.
You can try to combine the two update using a join instead. You may have to use a subquery to achieve it though, as ...