Hot answers tagged

18

This is perfectly normal behaviour in a transverse Mercator projection. The fact that a specific northing does not match a specific latitude (except for the Equator itself) can be easily visualized. We are used to seeing global maps of the more familiar equatorial-aspect (or normal) Mercator projection, which depicts parallels and meridians as perfectly ...


10

Processing in QGIS 3 was refactored a lot and many algorithms were changed. So it is not possible to covert old models into new format. You need to recreate it. says Alexander Bruy, QGIS contributor, core developer and translation team lead, in this post.


6

You can use QGIS: Add delimited text layer Reproject Layer Add geometry attributes


6

Within QGIS, you can open your qgs files and save them as qgz # Here simple list of files but you can use: # - `os.walk` from `os` module https://pymotw.com/3/os/, # - `pathlib` module https://pymotw.com/3/pathlib/ # (need to transform the output path to a string) # - `glob` https://pymotw.com/3/glob/ paths_qgs = ['/path/to/one.qgs', '/path/to/another.qgs'] ...


5

I don't think converting between geopackage and shapefile has any impact on accuracy, no. Although you could check it pretty easily, covert the original data back and forth between formats a bunch of times (even more than you normally would to be sure) and then plot it against the original data and see for yourself.


5

You do not need any plugin. Use Save As... and select CSV as outputformat. From the CSV layer options select "AS_WKT" for the geometry.


5

You can use these expressions: left: to_dms(x_min(transform($geometry,layer_property(@layer,'crs'),'EPSG:4326')),'x',3) top: to_dms(y_max(transform($geometry,layer_property(@layer,'crs'),'EPSG:4326')),'y',3) right: to_dms(x_max(transform($geometry,layer_property(@layer,'crs'),'EPSG:4326')),'x',3) bottom: to_dms(y_min(transform($geometry,layer_property(@...


4

To include varying projections in the transformation to lat/lon (EPSG:4326), you can use a variable for the current EPSG of your source, so than you don't have to care about which EPSG your data is in, see here: Getting lat/long for centroids using QGIS You can use this directly in the field calculator, adapting the expression as follows, whereas "x&...


4

Clearly do not know exactly how to proceed in QGIS but with GDAL command line utility gdal_translate, just need to do gdal_translate -of PNG -scale -co "WORLDFILE=YES" input.tif output.png It will write an output.png with an associated output.wld (contains world file content) Edit: after answering, seen similar answer for jpeg e.g How to convert ...


4

If you want to Ignore the edge cases, and get only the First (or only) Polygon, from the MultiPolygon geometry, then you need to use the ST_GeometryN() function. A query like the following will give you the geometry as Polygons SELECT ST_GeometryN(geom, 1) FROM polygons;


4

Proj4Net seems to be a port of Proj4J that is a port of Proj.4 https://trac.osgeo.org/proj4j/. The Proj.4 library is using EPSG:4326 as a pivot coordinate system so the conversion from EPSG:2105 into EPSG:3857 goes actually through the route EPSG:2105 -> EPSG:4326 -> EPSG:3857. Theoretically that should be a reversible route but several conversions in ...


4

I read the CSV file into a Pandas' DataFrame, extract the numbers from your boundary column, convert to shapely polygons, convert Pandas df to GeoPandas gdf: import pandas as pd import geopandas as gpd from shapely.geometry import Polygon df = pd.read_csv(r"C:\GIS\data\testdata\latlongs.txt", sep='\t') #Create a pandas dataframe from the csv df....


3

GeoJSON can have only one layer. https://www.rfc-editor.org/rfc/rfc7946#section-2 GeoJSON Text A GeoJSON text is a JSON text and consists of a single GeoJSON object. GeoJSON Object A GeoJSON object represents a Geometry, Feature, or collection of Features. For GDAL and QGIS this means https://gdal.org/drivers/vector/geojson.html A GeoJSON datasource is ...


3

You will get best results if you install Grass GIS together with QGIS and use the processing tool v.to.lines.


3

On Linux systems it is fairly easy, provided there is an easy regex that describes the folders with the shapefiles in. ogr2ogr will create a new geopackage and add a table for each spatial file it finds in the directory and handle the reprojection at the same time. for folder in **/shapefiles do ogr2ogr -f GPKG -t_srs EPSG:32632 $folder/filename.gpkg $...


3

If the Earth were spherical, of homogeneously distributed mass, rotating at constant angular velocity, alone in the universe without the influence of other celestial bodies, we could mathematically model its gravitational field. Any equipotential surface of that field is likely not to have a strictly ellipsoidal shape, just as the Earth does not, just as it ...


3

I believe it is because you are passing Pandas datatypes to the attributes of the QgsFeatures. import pandas as pd ## make a toy dataframe data = [[0, 'Very'], [1, 'Little']] df = pd.DataFrame(data, columns = ['ID', 'Happy']) ## check dtypes df.dtypes ## returns df.dtypes ID int64 Happy object dtype: object Here is a function that will convert ...


3

A standalone sample correction. The issue is the fact you try to fill QGIS content using for integer a <class 'numpy.int64'> (due to pandas type) whereas it should be a native Python int. The important part is newrow = [c.item() if hasattr(c, 'item') else c for c in newrow] that cast numpy objects to their Python equivalent and then avoid your code to ...


2

In order to calculate a new point from an origin, you will also need a distance from the origin to the point in question. Here I assumed that you have a distance value available. An option would be to create a function calculating the target point from an origin and a vector: function CalcPosFromAltAzDist(startPoint, vectorPointing) { var ellipsoid = ...


2

I had the same unwanted output and after doing some research it seems the cause can vary. My case was I had some polyline layers with very, very small gaps (in which some fragments were formed by two or less nodes) (Figure 1 and Figure 2). So, after directly running Lines to polygons tool, the algorithm would run, but no polygon would be created. A warning ...


2

You have 2 issues with the posted code: The code returns before setting the result in the appropriate form element. Move return dd; to the end of the function. The values returned by the <input> elements will be strings, so you will get unexpected results from this: var dd = d1 + m1/60 + s1/3600; like 420.233333333333333340.0033333333333333335. ...


2

In Earth Engine's geometry model, something being called a GeometryCollection rather than MultiPolygon just means that some of the geometries are not polygons (they could be lines or points). You cannot cause a GeometryCollection to be made out of polygons except by unioning them with a non-polygon geometry. However, there is no reason to do this — geometry ...


2

The splitext splits the path into the root and the extension (https://docs.python.org/3/library/os.path.html#os.path.splitext). So the return value is a tuple. You probably want to choose the root. Therefore, you need to change the line in your code as follows outKML = os.path.join(os.path.splitext(layer)[0], ".kmz")


2

I think that converting data into SpatiaLite in this case may be a good idea, even shapefiles do support simple BBOX queries with spatial index if spatial index is created (the .qix or .sbn/.sbx files) and you can run your query with ogr2ogr also against the shapefile by using the SQLite SQL dialect. https://gdal.org/user/sql_sqlite_dialect.html. You should ...


2

You can use the gdal.VectorTranslate function (basically the same as ogr2ogr commandline utility): from osgeo import gdal gdal.UseExceptions() pbf = 'https://ahocevar.com/geoserver/gwc/service/tms/1.0.0/ne:ne_10m_admin_0_countries@EPSG:900913@pbf/3/2/4.pbf' ds = gdal.OpenEx(pbf, gdal.OF_VECTOR) # note use of gdal.OpenEx, ogr is deprecated from gdal 2.0+ ...


2

In Network panel of browser debugger, you get https calls like https://geodienste.hamburg.de/HH_WMS_Freiwilliges_Engagement?SERVICE=WMS&VERSION=1.3.0&REQUEST=GetFeatureInfo&FORMAT=image%2Fpng&TRANSPARENT=true&QUERY_LAYERS=freiwilligenagenturen&CACHEID=153183&LAYERS=freiwilligenagenturen&INFO_FORMAT=text%2Fxml&FEATURE_COUNT=...


2

This will reproject all shapefiles then package them into geopackages, one for each folder with shapes. For example I get the geopackages /home/bera/Downloads/shape/svk/riks/riks.gpkg /home/bera/Downloads/shape/svk/riks/subfolder/subfolder.gpkg I use collections.defaultdict list to create a dictionary of folder:[all shapes in that folder] and then iterate ...


2

You are trying to apply the .expression to the entire ImageCollection. Unfortunately .expression can only be applied to an ee.Image() object so you have to map your function over the entire image collection: print(dataset.first(), 'before') var rewrite = dataset.map(function(image) { return image.addBands( image.expression( 'P * 86400 * 30', { P:...


2

I assume that the raster data in the input GPKG was compressed, while you did not set any compression when exporting the raster to GeoTIFF format. Check out the GeoTIFF format creation options: https://gdal.org/drivers/raster/gtiff.html and find out which compression method is appropriate for you: https://kokoalberti.com/articles/geotiff-compression-...


2

Check this out. This solution works if you have your DEM as TIFF format. But if you can extract the XYZ coordinates from the NetCDF file yourself and save it to a text file, then you can use LAStools to create LAS file. although LAStools is a command line tool but you can use it in python: def convert_txt_to_las(txt_path, out_las_path): command = '...


Only top voted, non community-wiki answers of a minimum length are eligible