6
votes
Accepted
Convering latitude and longitude of starting point of line from Lambert to DMS in QGIS
There are built-in functions to get the start and end points:
y(
transform(
geometry:=start_point($geometry), -- use the `start_point` or `end_point` function here
source_auth_id:...
6
votes
Accepted
Converting PNG to GeoTIFF using GDAL Python
I'm assuming that your PNG file doesn't have geolocation information embedded but you know what the corners of the data. I think you just had the wrong option for gdal.Translate. Check this out using ...
5
votes
Accepted
Converting from MultiPolygon to Polygon in PostGIS
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 ...
5
votes
Accepted
Converting grid corners from UTM to degrees, minutes, and second in QGIS
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'))...
5
votes
Convert date/time format
A Field Calculator expression tested in QGIS 3.16.16
array_to_string(array_reverse(string_to_array(left("created", 10), '-')),'.')+' '+substr("created", 12, 2)+':'+substr("...
5
votes
Accepted
How do I translate MapBox GL JS GPS coordinates into SWEREF 99 TM ones?
Library proj4.js (http://proj4js.org/) is usually used for coordinated transformation in JS. To use it one needs CRS definition, which can be easily found on epsg.io site.
SWEREF 99 TM coordinate ...
5
votes
Accepted
Converting number with leading zeros in integer in QGIS
Try this expression with the to_int() function:
to_int("baumnummer")
-- to_int('000001') -> 1
If you wish to maintain the string field type, you could expand the expression above with ...
4
votes
Accepted
Converting to a CRS and the back to the original CRS, not the same original coordinates
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 ...
4
votes
Accepted
Converting CSV file with polygons in dictionary format into GeoDataFrame
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 ...
3
votes
Converting PNG to GeoTIFF using GDAL Python
I know that the OP specifically asked for a gdal solution but may I offer another solution that works better for me ?
Here I'm using the rasterIo lib (available on both pipy and conda) to read the png,...
3
votes
QVariant error when converting DataFrame into attribute table using PyQGIS
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 ...
3
votes
Accepted
QVariant error when converting DataFrame into attribute table using PyQGIS
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, ...
3
votes
An observation regarding conversion between geodetic latitude and geocentric latitude
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 ...
3
votes
Recursively reproject shapefiles in folders and subfolders
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 ...
3
votes
Accepted
Convert date/time format
While @Kazuhito's answer works perfectly, I just wanted to add an alternative solution using to_datetime to make a datetime object and format_date to convert it back to a formatted string:
format_date(...
3
votes
Accepted
How to create a polygon from a CSV file with coordinates using PyQGIS?
Read the attributes into a list of QGSPointXY's using getFeatures :
points = [QgsPointXY(f['long'], f['lat']) for f in iface.activeLayer().getFeatures()]
poly = QgsGeometry.fromPolygonXY([points]) #...
3
votes
Accepted
Converting XYZ file to shapefile using Python
I have numerous XYZ files, which aren't gridded
from GDAL XYZ – ASCII Gridded XYZ
GDAL supports reading and writing ASCII gridded XYZ raster datasets (i.e. ungridded XYZ, LIDAR XYZ etc. must be ...
2
votes
Saving raster layer from GeoPackage results in large GeoTIFF file
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:/...
2
votes
Accepted
GEE Converting Units of the FLDAS Precipitation data (Rainf_f_tavg) from kg m-2 s-1 to mm/month
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 ...
2
votes
Recursively reproject shapefiles in folders and subfolders
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/...
2
votes
Converting DEM raster (NetCDF file) into point cloud (LAS file) using Python
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 ...
2
votes
Converting raster (.tif) to ASCII format using ArcMap
Make sure you have the same symbology setting on the asc raster as the tif.
The actual values can be the same but the symbology can make them appear different.
2
votes
Converting shapefile into raster with desired pixels 1km²
Your question in lacking details like whether you want to use an attribute as raster value or specify it manually.
In both cases, search for "Rasterize":
If you want the pixels to overlap ...
2
votes
Accepted
Converting coordinates in Harrisburg (Pennsylvania) to WGS84 using GeoPandas
The coordinates I have are in feet, in the coordinate system NAD83 / Pennsylvania South (ft US). The EPSG code for it is EPSG:2272. I found that out by trying the epsg code of a data set I have for ...
2
votes
Accepted
Converting text file into GeoJSON using Python
I think using geopandas is a more convenient way to create GeoJSON.
Once you convert your txt to coordinates, you need to do some preliminary work.
This is the process of handling str in pandas.
...
2
votes
Accepted
Map lat/lon onto polar stereographic projection map based on two known points on map image
The dataset is documented in "MANAIR Manual of Standards and Procedures for Aviation Forecasts: appendix C" -- Appendix C: Graphic Area Forecast (GFA)—Supplement to Chapter 4. A coordinate ...
2
votes
Accepted
Workflow to convert Python script without UI file into QGIS Plugin
Inspiration for this answer was found in @J.Monticolo's comment
So, for me, put the startup.py file into a
your_plugin_name_or_whatever.py, do a function called def launch_code and put the startup.py ...
2
votes
Convert Coordinate Notation warning, empty output
Your three lines of sample data worked for me with
Input coordinate system: WGS_1984_UTM_Zone_10N
Input coordinate format: UTM bands
X Field (where the data is) UTM
If the warning is being cause by ...
1
vote
Retrieving FLDAS evapotranspiration data (NASA/FLDAS/NOAH01/C/GL/M/V001) via GEE and converting units to mm/year
Yes, there are several issues in your code. You should use an ee.Reducer for getting evaporation values instead images. First of all, I'm going to review units. Units in kg m-2 s-1 are equivalents to ...
1
vote
Accepted
Converting float image to 8bit using GEE
You can use the following code line:
var image8b = image.unitScale(-3, 3).multiply(255).toByte();
Be sure to select the appropriate unit scale. I have used (-3, 3) because I don’t really know the ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
convert × 1325qgis × 277
shapefile × 225
arcgis-desktop × 195
coordinate-system × 182
raster × 116
python × 87
coordinates × 76
geotiff-tiff × 71
kml × 65
geojson × 62
latitude-longitude × 61
polygon × 59
csv × 58
gdal × 56
arcpy × 52
arcmap × 52
postgis × 41
ogr2ogr × 39
dem × 37
r × 36
arcgis-10.0 × 35
autocad × 30
wgs84 × 28
arcgis-10.1 × 26