Hot answers tagged

44 votes

Importing DWG into QGIS project?

In the newer versions of QGIS (2.18+) there was a feature implemented to import .dwg-files into geopackages (.gpkg). This feature can be found under: Project >> DWG/DXF-import In order to make it ...
Nightwatch's user avatar
34 votes

Import GeoJSON into PostGIS

You can use PostGIS's ST_GeomFromGeoJSON to bring in just the geometry part of the GeoJSON. Better yet, you can use ogr2ogr to import the entire JSON document: ogr2ogr -f "PostgreSQL" PG:"dbname=...
alphabetasoup's user avatar
18 votes
Accepted

Importing NULL in PyQGIS

The NULL class is defined in qgis.core: import qgis.core if f["SAMPLE"] == qgis.core.NULL: ... Normally you should be able to do a normal is None check however due to tool we use to ...
Nathan W's user avatar
  • 34.6k
14 votes

Opening ESRI Personal GeoDatabase (*.mdb) in QGIS

Provided you have successfully installed Microsoft Access Database Engine 64 bit, you can: Method 1 (works with QGIS 3) In QGIS Settings panel -> Options | System | Environment add the following ...
Andrea Giudiceandrea's user avatar
14 votes
Accepted

Add an Excel file with a list of coordinates to QGIS as a layer?

You can often make a WKT (Well Known Text) column in Excel without too much fiddling, which effectively creates a spatial definition for points, lines or polygons within a single field. What you want ...
Simbamangu's user avatar
  • 14.8k
13 votes
Accepted

Loading multiple CSV files into QGIS 2.10

You could use the following code in the Python Console to locate your csv files in a specified folder and load them as point shapefiles using their longitude/latitude fields. The code assumes: The ...
Joseph's user avatar
  • 75.3k
13 votes

Importing coordinates as CSV file, but points are not displayed

You are putting the x and y coordinates in wrong order. -8.183973 is latitude (Y) and 111.845623 is longitude (X). You need to adjust the column of X and Y to be Y and X, respectively. The coordinates ...
ahmadhanb's user avatar
  • 40.5k
12 votes
Accepted

Using an existing field as primary key with ogr2ogr?

You can add the -lco FID=[your_id_column] switch to your OGR2OGR script. Eg. ogr2ogr -f "PostgreSQL" PG:"host=myhost user=myloginname dbname=mydbname password=mypassword" mytabfile.shp -lco FID=id ...
nstillwell's user avatar
12 votes
Accepted

QGIS 3.2 - Forcing column type when importing csv

QGIS uses OGR in the background, and OGR interprets all columns as strings. The OGR CSV driver returns all attribute columns as string data types if no field type information file (with .csvt ...
Kadir Şahbaz's user avatar
12 votes
Accepted

Adding CSV layer to QGIS when X and Y fields are the same

You can add the CSV file, structured as below, as a layer using the following script: import numpy as np c = np.genfromtxt('C:/path/to/file.csv', delimiter=',') # check delimiter lats = c[:,0][1:] ...
Kadir Şahbaz's user avatar
12 votes
Accepted

Importing grid layer from CSV in QGIS

If you import your CSV as a delimited text layer, you could use the "Geometry by Expression" tool on the layer to construct the polygons with this expression: make_rectangle_3points( ...
Matt's user avatar
  • 14.9k
11 votes

Header row in Excel is not header row when imported into ArcMap?

I had the same problem (Arcmap would not import my csv file with headers, instead it would show Field1, Field2, Field3 etc). When I examined the file headers in Excel, I found...decimals numbers, ...
Marissa's user avatar
  • 111
11 votes
Accepted

Importing Composer Template into QGIS Print Composer

You can add items from a template by creating a new print composer and selecting the option shown in the image: Then select your template and it should load up all the items you created.
Joseph's user avatar
  • 75.3k
11 votes

Change default data source encoding in QGIS to utf8

From Settings >> Data Sources >> Data source handling, you may try to uncheck the Ignore shapefile encoding declaration option. If you move the mouse cursor over the above option, this ...
mgri's user avatar
  • 16.1k
11 votes

Importing DXF in QGIS 3

Option 1: You don't need a plugin for that. You can import DXF (or DWG) in Qgis with a built in option: go to: project >> Import/Export >> Import Layers form DWG/DXF . Later you can export or save it ...
Ofir's user avatar
  • 662
10 votes

QGIS won't read table columns in CSV import on Mac OS

I had the same problem of QGIS reading a CSV file (saved from MS Excel 2011 on my Mac) as a single row. So, I re-saved the Excel worksheet as "Windows Comma Separated (.csv)" and QGIS was able to ...
EricO's user avatar
  • 121
10 votes
Accepted

Problem finding the right CRS for CSV file

Your data is obviously in decimal degree, hence WGS 84 - EPSG 4326 is the correct CRS. In the import window change from 25832 to 4326 and you're fine.
Erik's user avatar
  • 15.7k
10 votes

Imported CSV data is not displayed in QGIS

Try to use EPSG:4326-WGS 84 as "Geometry CRS". And check the points are on the right location. If EPSG:4326 doesn't exist in the drop down list, then click the button near the drop down list ...
Kadir Şahbaz's user avatar
10 votes

Importing grid layer from CSV in QGIS

A PyQGIS solution. Proceed with Plugins > Python Console > Show Editor and paste the script below: # imports from csv import reader from ast import literal_eval from os.path import normpath from ...
Taras's user avatar
  • 31.4k
9 votes
Accepted

Adding CSV layer in PyQGIS

The problem was with your URI. (note the third slash) Use the following as a working example: uri = 'file:///D:/Saved Stuff/gulags/1.40.csv?delimiter=;&yField=y&xField=x' layer = ...
lrssvt's user avatar
  • 1,911
9 votes
Accepted

Re-import custom functions without restarting QGIS

When I wanted to re-import the startup.py file after I made some edits, I used: import imp, startup # Use last 3 lines to reload script after saving edits imp.reload(startup) from startup import * ...
Joseph's user avatar
  • 75.3k
9 votes
Accepted

CSV import to QGIS 2.18.00 - QGIS only shows 9 of 14 points

You have 14 points, but 5 points are overlapping...(plotted at the same location). Overlapping features are really difficult to detect. I honestly have no good idea how to deal with this problem, ...
Kazuhito's user avatar
  • 30.5k
9 votes

Importing raster with R from File Geodatabase?

R spatial packages all depend on GDAL for file read/write, and GDAL uses the OpenFileGDB driver, which can only read vector data sources at this time - see https://www.gdal.org/drv_openfilegdb.html. ...
obrl_soil's user avatar
  • 3,682
9 votes
Accepted

Importing massive amounts of raster files

You can convert your .img files to .tif using gdal_translate. Here is a shell script to convert all .img in actual folder to .tif #! /bin/bash for i in *.img; do gdal_translate $i ${i%.*}.tif ...
Zoltan's user avatar
  • 7,245
9 votes
Accepted

Loading CSV as point vector using QGIS

You need to tick "la virgola è il separatore decimal" as your fields field_9 and field_12 without this option need point as decimal separator.
ThomasG77's user avatar
  • 30.4k
8 votes
Accepted

How to setup a new script, and parameters in ArcMap?

Sounds like you already successfully added your script to the toolbox, so you're close. You just need to set the parameters that are listed in the script within ArcMap if you want to run the script ...
mmoore's user avatar
  • 1,013
8 votes

How to fix encoding problem in shapefile importing?

I was facing the same problem last days, and that was due to german letters in shapefile attribute table, so for that I did the following: Simply, just click on option button and change UTF-8 to ...
Muhammad Abdullah's user avatar
8 votes

How do I import Excel coordinates with letters into ArcMap?

You can do it using python. Add your excel to ArcMap, modify the #-lines and then execute code below in the Python window. Im using the Regular expressions (re) module to find the float part (for ...
BERA's user avatar
  • 68.9k
8 votes

Adding CSV layer to QGIS when X and Y fields are the same

Your problem is that, that is not a CSV file - which is a series of features one per row. What you have is more like an ASCII grid file, so with some editing you might be able to import it that way. ...
Ian Turton's user avatar
  • 80.5k
8 votes

Importing grid layer from CSV in QGIS

If you can generate additional columns in your .csv you can generate a WKT string (POLYGON) column directly in the .csv: POLYGON(left bottom, left top, right top, right bottom, left bottom) and then ...
Kasper's user avatar
  • 3,142

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