how do i upload a csv file into qgis

Overview
  1. Prepare a table containing rows that include at least fields for: Unique ID, Breadth, and Longitude.
  2. Lat & Long values should be in decimal degree format (Non degrees, minutes, seconds, format)
  3. Example of row with right Lat & Long values: 23, Berlin, 52.500556, 13.398889
  4. In the preceding case, 23 = unique ID for Berlin, Berlin = Placename, 52.500556 = Lat, 13.398889 = Long
  5. Save this tabular array in Comma Seperated Values format (CSV)
  6. From Manage Layers Toolbar, use the Add Delimited Text Layer tool and select the CSV file to generate a points layer.
  7. Save the points layer to a Shapefile (or other format) for hereafter use.

Preparing tabular data

  1. Tabular information can be adult in various spreadsheet applications. Nosotros reccommend LibreOffice for it'south handling of specific linguistic communication graphic symbol set encodings.
  2. For our example, nosotros downloaded the County File of Jamaican Placename Features from USGS State Files.
  3. After saving the country file jm.zip to your working folder, double-click the .zip file to extract the contents. The complete set of placename features is in the file jm.txt. To make things simpler, we will use only the Populated Identify features in jm_populatedplaces_p.txt, but we MUST offset rename information technology to something like: jm.csv
  4. later y'all take renamed the file to jm.csv, launch LibreOffice, and the Calc spreadsheet application
  5. From the CALC application (not from Author or the default LibreOffice Suite!) click on the menu particular File > Open and scan to your UNZIPPED and RENAMED file jm.csv then click Open up

  1. Set Grapheme Set for your import file to Unicode UTF-8, USGS Country Files are UTF-8
  2. Set the Separator (Delimiter) options. For this instance check TAB delimiter.
  3. Uncheck COMMA delimiter. (This prevents unexpected commas from creating new columns.)
  4. If the fields seem to be delimited properly in the preview, click OK.
  5. Currently QGIS imports CSV as UTF-viii Encoding. If you are using Whatever OTHER encoding, create TWO tables: i for the LAT LONG import, and ane to join the other character set attributes to the resulting points layer (come across JOINS for details on how to accomplish the 2nd Bring together process).
  6. In the example shown below, the placenames are in UTF-8 encoding, so it is not necessary to create a 2d table. If the names were in Arabic (CP1256 encoding) for example, you should split up the placename column into a 2d tabular array (which MUST also have a column of unique Identifiers, which will serve equally the JOIN ID)
  7. In the jm.csv example, and for all GNS Country files, the UNIQUE ID field is "UFI" or Unique Feature ID. Make sure you know which field contains your JOIN ID, and keep in mind that it must be a unique value for each row.

  1. When the .csv is opened in LibreOffice, scan the table to check for possible import errors.
  2. If the tabular array looks okay, SAVE it as native OpenOffice format jm.ods

  1. Brand certain to Format the Cells for your Lat Long values with enough decimal places, then that saving to CSV does not trim off your most accurate values.
  2. Then RESAVE the data as the .csv for importing to qgis, like jm_import.csv
  3. The dialog will allow you to EXPLICITLY set the Encoding (change it to Unicode UTF8) and the Delimiter (modify it to $). By using a $ delimiter, you can avoid errors caused by stray commas that might be in the cells.

Add Delimited Text Layer

  1. Because the x, y values you want to import must be in Decimal Degrees, be certain to RESET the CRS to apparently WGS 84 (EPSG: 4326)

  1. In QGIS 2, the power to import delimited text as Vector Layers is congenital in to the Manage Layers tools. Only click on the big COMMA icon to launch the Add together DELIMITED TEXT LAYER dialog.

Import CSV File

  1. Scan to the CSV FILENAME you lot want to import, workshop_data/part_two/jm_import.csv
  2. Fix the Encoding, in this case UTF-8
  3. Unset Comma delimiter, and choose CUSTOM DELIMITERS, (for the example type our $ delimiter into the OTHER DELIMITERS box)
  4. If the correct delimiter is fix, the preview window at the bottom volition exist correctly parsed into columns
  5. Set the checkbox to accept the first line of the .csv file as the FIELD NAMES.
  6. At present y'all want to ready the Signal Coordinates parameter, and brand sure the X field and Y field values have been designated.
  7. In the example of USGS Country Files, set the X field = LONG, and the Y field = LAT
  8. X is more often than not used for the "horizontal" or degrees Eastward and W of Longitude, while Y is use for the "vertical" degrees Northward and South of Latitude.
  9. When the preview looks okay and you have fix your X, Y fields, hit OK
  10. You will exist prompted to specify the Coordinate Reference Organisation (or projection) for the imported x, y coordinates.

  1. In the example of evidently decimal degrees, click on the option WGS84, likewise called EPSG:4326. If you don't see this bachelor under "Recently Used" options, then put your cursor into the FILTER form and type "WGS" into the form. Select EPSG:4326 from the results.
  2. Note: WGS 84 Pseudo Mercator is a specialized projection which is equivalent to the and then-called Google Spherical Mercator. You don't want to use this EPSG:3857 for loading decimal caste points from .csv. EPSG:3857 is really only advisable for calculation Google and other basemaps with the OpenLayers Plugin.
  3. With the correct CRS selected, hit Okay, and the points should appear equally a new data layer in the QGIS Layer List and the Map View.

Bank check points and attribute table

  1. The imported x, y values volition now be converted to point features (in WGS84 coordinate organisation)
  2. Right-click on the layer to Open the Attribute Table, and brand sure the tabular data was imported
  3. Cheque the Number of Features on the top bar of the aspect to make sure all were mapped (2,774 features in our example for Jamaica)

Note: you may encounter problems if the field delimiters (such as COMMAS) have been used within the fields and wrappers such every bit Double-quotes were not used int the raw data file. Sometimes it may be necessary to massage the .csv file in society to eliminate uses of the jail cell delimiters within FIELDS. Usually this tin can be accomplished by adjusting the Export to CSV settings in Libre Part and saving out to a new version of the .csv file with specific field delimiters (SEPARATED Past) and text wrapper (TEXT DELIMITER) settings. In other words, if commas in your text are a problem, apply a custom pipage delimiter every bit SEPARATED By = | and employ the TEXT DELIMITER = ", then consign to a new .csv file and endeavor to add the layer to QGIS again using those settings.

Save out to SHP

Annotation that QGIS is holding the points layer created in retentiveness. You lot may want to right click on the layer and Save Equally a SHAPEFILE (or your preferred format) for later apply.



Later on exporting to SHP, right click to remove the DELIMITED TEXT LAYER (jm_import.csv) and use the ADD VECTOR layer tool to add your new Shapefile (jm_places.shp). Now you should be able to run spatial analysis tools and other operations on the Shapefile, which would not have been possible using the .csv file held in the memory buffer.


Continue with Add together WMS information layers

johnsonseagersom.blogspot.com

Source: http://maps.cga.harvard.edu/qgis_2/wkshop/import_csv.php

0 Response to "how do i upload a csv file into qgis"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel