How can I make a shape file of an csv file with coordinates?
|
|
If you use QGIS, try this tutorial: http://qgis.spatialthoughts.com/2012/01/importing-spreadsheets-or-csv-files-to.html |
|||
|
|
|
The easiest and fastest way of doing it is probably with ogr In the csv driver doc is an example syntax from csv to shape: http://gdal.org/ogr/drv_csv.html
HTH Nicklas |
|||||
|
|
if you are PostgreSQL/PostGIS user, you can convert your bulk data as following: 1.Create a new table for your csv files. 2.Copy csv to newly created table.
3.Now you have to create geometry column for your spatial data.
4.Populating the geometry column from your lat, long with UPDATE function with GeometryFromText function of PostGIS.
5.The last thing, you can connect to QGIS for exporting format of shp or the following code:
and you can use How to convert PostGIS table to Shapefile in Python? or csv2shp (CSV to Shapefile Converter) tool for bulk converting... i hope it helps you... |
|||
|
|
|
First, be certain there are "no" special characters or spaces in the column headings (the only exception is "underscore"). For example, if you have a name like "Borehole ID", change it to something like "BH_ID" or "BHID". Assuming you're using ArcMap, navigate to the .csv file (either in Catalog, or in the Catalog window in ArcMap), right mouse over your .csv file, select "Create Feature Class" ---- > and then "From XY Table". The image shown below is what you'll see next. Populate the "X Field" with your Easting column header and your "Y Field" with the Northing Column header. You can leave the "Z Field" blank unless you want to assign elevations to your points. Next, click on the area that says "Coordinate System of Input Coordinates". Here, you will assign the appropriate projection/datum/zone. Lastly (near the bottom) hit the folder and route to the appropriate directory on your computer or server, and name your new shapefile.
|
|||
|
|
|
If you have FME (or the Data Interoperability Extension in ArcGIS) then the solution looks like this:
A CSV reader, 2DPointReplacer transformer, a PointConnector transformer (optional), and a Shape writer. There are some more examples on our FMEpedia knowledgebase. Pros: Easy and visual. Also flexible (there are simple ways to handle data that is not just x/y but includes headers, etc) and with a much greater range of format support (not just CSV and Shape) Cons: Not Free/Open-Source software. If this is a one-off project, or you already have one of the other solutions specified here, then it's probably not worth buying FME just for this one task. |
|||
|
|
|
Although not Shape, another way to convert text-based X/Y coordinates to a spatial dataset is to load them into Google Fusion Tables. From there you can export them to a KML dataset. I suggest this because whatever application you're going to use Shape in, it may also support KML natively. Many do. |
|||
|
|
|
Here's an arcpy-based solution.
|
|||
|
|
|
I'm sure there are lots of examples of how to do this. You can see how to do this in SpatiaLite (with both GUI and command line options) at http://www.gaia-gis.it/gaia-sins/spatialite-cookbook/html/impexp.html |
|||
|
|
|
Add your csv file in Table of Contents in ArcGIS Desktop. Right click on your data and go for Display XY Data. Selecet your X and Y field, also coordinate system. Then you have a visualization of your points. You can also right click and export your visualization as shapefiles. The reason I prefer this method instead of converting to shapefiles right away is this way you can preview your file before actually convert and save it to your disk, with potential errors. |
|||
|
|
