Hot answers tagged

8 votes
Accepted

TypeError when converting shapefiles to KMLs using PyQGIS

According to the documentation the first argument should be a QgsVectorLayer, which is why you are getting the unexpected type error. You are also missing the QgsCoordinateReferenceSystem parameter. ...
Matt's user avatar
  • 14.2k
8 votes

Replace single and double quotes with QGIS expressions

you can use this expression: replace(replace("fieldname", char(34), ''), char(39), '') char(34) corresponds to the double quote " char(39) corresponds to the simple quote '
Louis Cottereau's user avatar
7 votes
Accepted

Converting Pandas column with featurecollection to GeoJSON

You can use the following code. Just specify json_string_column and output file path. import json import pandas as pd import geopandas as gpd # df = YOUR DATAFRAME json_string_column = "...
Kadir Şahbaz's user avatar
6 votes
Accepted

Replace single and double quotes with QGIS expressions

Use regular expressions with regex_replace() function. The single quote ' has to be masked by a backslash: \'. Use this expression to get rid of single ' and double quotes ": regexp_replace (...
Babel's user avatar
  • 63.1k
4 votes

Convert OSM XML file to GeoJSON yields nothing

You need to add /full to the API URL like: https://www.openstreetmap.org/api/0.6/relation/13737936/full and copy that XML. Gives: { "type": "FeatureCollection", "...
nmtoken's user avatar
  • 13.2k
3 votes

What format is this geometry and how to convert it into a shapefile?

This is the format from Oracle Spatial SDO_Geometry the data is organized this way: {SDO_GTYPE, SDO_SRID,SDO_POINT,SDO_ELEM_INFO[],SDO_ORDINATES[]}
Marco Reliquias's user avatar
3 votes
Accepted

Convert a WKT string within a text file to GeoJSON using ogr2ogr or GDAL command line tools

Read some documentation https://gdal.org/drivers/vector/csv.html. Edit the text file and add a header line and enclose the WKT between double quotation marks. Notice ending comma in the header. It is ...
user30184's user avatar
  • 61.8k
3 votes
Accepted

Convert a point on a flat 2D web-mercator map image to a Coordinate

See the Inverse transformations section of the spherical Mercator projection Wikipedia's page. It says: φ = 2 * tan⁻¹[exp(y/R)] - π/2 φ is the latitude in radians (you can multiply by 180/π at the end,...
Gabriel De Luca's user avatar
3 votes
Accepted

Converting KML to JSON or shapefile in QGIS

Add your KML as a layer to QGIS Export to GeoJSON or GeoPackage Go to planemad/qgis-extract-html-attributes and save the extract_html_attributes.py script. Note the requirement to install the ...
user2856's user avatar
  • 63.8k
3 votes

ArcGIS: How can I convert the cells of a raster to points?

You can use the "Extract by Mask" tool to create a new raster layer that only contains the cells of interest, and then use the "Raster to Point" tool to convert the cells of this ...
Polina Kolenichenko's user avatar
3 votes

Converting raster to vector and creating polygons based on each pixel in QGIS

Since QGIS 3.4 there is an algorithm called "Raster pixels to polygons". You can find it in the Processing Toolbox -> Vector creation -> Raster pixels to polygons For more details ...
Francisco Puga's user avatar
3 votes

Find out date format in the list of house numbers

If you import from CSV, change data type from Date to Text(string) when importing CSV. Otherwise, add another field using the following expression in Field Calculator (set door number field before ...
Kadir Şahbaz's user avatar
2 votes

Converting shapefile to WKT

No plug is needed to convert shp to wkt. You just need to export "Save layer as" csv and select "AS_WKT" in the "Geometry" field and that's it. I'm sorry for my English.
Czechu Pck's user avatar
2 votes
Accepted

Converting a shapefile to .sqlite using Python

Try this: shape = r'/home/bera/GIS/Data/testdata/subway.shp' output = r'/home/bera/GIS/Data/testdata/subway.sqlite' vl = QgsVectorLayer(shape, 'temp') options = QgsVectorFileWriter.SaveVectorOptions() ...
BERA's user avatar
  • 66.9k
2 votes

Transforming from EPSG:25832 to EPSG:5684

Use ogr2ogr something like: ogr2ogr \ -s_srs EPSG:25832 \ -t_srs EPSG:5684 \ output.shp \ input.shp
nmtoken's user avatar
  • 13.2k
2 votes

Converting geopackage to feature class (shapefile or geodatabase) using ArcGIS Pro

You can also use to Copy Features function. Just take the gpkg file as Input and save the output to a gdb.
Saelon's user avatar
  • 55
2 votes

Convert HMTL Maps to GeoJSON/JSON data

You can simply iterate over features, create GeoJSON object and then download stringified GeoJSON. Code could look something like this: var geojson = { "type": "FeatureCollection&...
TomazicM's user avatar
  • 22.8k
2 votes
Accepted

Conversion of JPEG with JSON coordinates into a GeoTIFF

Unless the points are really in Antarctica, I think you've got your longitude and latitude reversed. If so, and you reverse them so they are in longitude, latitude order, they appear to be in Atlanta ...
user2856's user avatar
  • 63.8k
1 vote

Converting point data to raster layer using QGIS

Set the horizontal and vertical resolution to 1000 and size units to Georeferenced units and leave output extent empty:
BERA's user avatar
  • 66.9k
1 vote

Negative Easting while converting long/lat to UTM zone

Yes! use the UTM Python Library. From the command line install utm pip install utm Then try something like: import utm utm.from_latlon(48, -122) (574595.1124862543, 5316784.0095401555, 10, 'U') utm....
GBG's user avatar
  • 9,207
1 vote
Accepted

Convert JSON data to geometry

This is a great opportunity to try out some python. This script will convert your json columns into 2 new columns - 1 for the centroid wkt (the lat/lng part of the json) and 1 column for the poly wkt....
jbalk's user avatar
  • 7,240
1 vote

Calculate TMS tile coordinates (XYZ) for a given Lat/Lng pair in EPSG:27700 projection?

One possible way to get tile (x, y, z) coordinates for specific [lat, lng] coordinate and specific projection is to 'misuse' generic Leaflet L.TileLayer layer and 'tileload' layer event. Procedure ...
TomazicM's user avatar
  • 22.8k
1 vote

Converting a raster file to a format supported by QField

See Documentation on supported data types and advice on raster formats here https://docs.qfield.org/reference/data-format/
Oisin's user avatar
  • 1,542
1 vote

Convert datum of elevation data in PostGIS

You will need to inject PROJ_NETWORK set to ON into your PostgreSQL start-up environment. And your PostgreSQL user will need write access to its home directory probably too. See https://proj.org/usage/...
Paul Ramsey's user avatar
  • 19.8k
1 vote
Accepted

How to convert WKT polygons to kml file using python?

Try this, using some modern packages. import fiona import pandas as pd import geopandas as gpd from shapely import wkt # Enable KML support fiona.supported_drivers['KML'] = 'rw' df = pd.read_csv('./...
Shawn's user avatar
  • 1,615
1 vote

HURDAT2 Does anybody have advice on how to convert large txt file to .shp in efficient manner?

There's a repository containing some JS code here: https://github.com/HarryStevens/parse-hurricane-data Running that on the data file produces a GeoJSON output that can be read into QGIS (and I assume ...
Spacedman's user avatar
  • 61.5k
1 vote
Accepted

Change Time Format in QGIS

I assume 0.377777 is the time in days and you want to convert it in hours. So simply multiply it by 24: 0.377777*24 returns 9.066647999999999 You may want to round the result: round (0.377777*24, 0) ...
Babel's user avatar
  • 63.1k
1 vote

Convert Coordinate Notation with specified number of decimals

The Location Unit Format dialog you show in your question affects the display of coordinates in the status bar. The tool Convert Coordinate Notation has no parameter or environment setting that ...
Hornbydd's user avatar
  • 42.6k
1 vote

Convert a WKT string within a text file to GeoJSON using ogr2ogr or GDAL command line tools

The accepted answer works, the bit missing is how to edit the initial file programatically. We can do: #!/bin/bash echo "wkt," > testwkt.csv echo -n '"' >> testwkt.csv cat ...
zabop's user avatar
  • 1,274
1 vote

Converting ArcMap feature layers to GeoPackage using

after creating an empty gpkg with "create SQLITE database" tool, you can use the "feature class to feature class" tool directly (or in a script with arcpy)
radouxju's user avatar
  • 49.3k

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