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.
...
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 '
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 = "...
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 (...
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",
"...
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[]}
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 ...
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,...
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 ...
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 ...
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 ...
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 ...
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.
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()
...
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
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.
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&...
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 ...
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:
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....
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....
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 ...
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/
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/...
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('./...
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 ...
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) ...
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 ...
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 ...
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)
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
convert × 1387qgis × 296
shapefile × 238
arcgis-desktop × 201
coordinate-system × 194
raster × 124
python × 96
geotiff-tiff × 79
coordinates × 75
kml × 70
geojson × 67
latitude-longitude × 63
arcmap × 59
gdal × 59
csv × 59
polygon × 58
arcpy × 54
ogr2ogr × 44
postgis × 41
dem × 39
r × 36
arcgis-10.0 × 34
autocad × 31
wgs84 × 28
utm × 27