-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CSV import and ESRI-ShapeFile conversion #6
Comments
We regularly use this simple method too. The only thing I would change would be to also create a *.csvt which allows one to specify if the incoming fields are strings or numeric. Without this most extra fields will be mapped to strings. So say you have a CSV with: your *.csvt would simply have: Now upon conversion to Shapefile, applications can use the fields as intended. There is a good description and example here: http://giswiki.hsr.ch/GeoCSV#CSVT_file_format_specification |
Dear Thimothée, The first would be to activate the Importer module by setting In your case you may use the button "Use Column Definitions". Indeed, you should have the correct field names displayed in your case rather than the From here you can access the html form that make you able to invoke the Ogr2Ogr WPS service from your distiller to create a shapefile or any other format supported by GDAL. I hope my explanation is clear and it helps you to handle your work directly from MapMint. Note that this module has not been made for simple file like CSV but I have tried with your csv file and it has worked perfectly fine. So I simply mention it here as there can be more complexe case you may be forced to deal with and this path may be the right one to follow in a more complexe case. Best regards. |
Dear Timothée, First of all you should have imported the Also in your case you should have chosen So here is what you should see form the Importer module. Pressing the button "Use Column Definitions" should be pressed only once you have select the type I hope this can solve your issue. Best regards. |
Hello everybody,
I come here to give an alternative solution i found to import and display CSV files which have latitude and longitude attributes for coordinates (or equivalent).
Note that such tool already exists to import such data : the Converter vector data sources can be used to build table in PostgreSQL. You just have to check the SQL option and to type the following request:
select *,ST_SetSRID(ST_Point(COL_X,COL_Y) as wkb_geometry from table_name
where
table_name
is the CSV file name andCOL_X
andCOL_Y
, the columns names to use for building the geometry.The CSV file is then imported in PostgreSQL.
Here i wanted to have my CSV file as a ESRI ShapeFile. The solution i found also makes use of
ogr2ogr
.Assume that you have a CSV file
data.csv
, which is comma separated and with two columns which are coordinates in a given SRS (e.g.WGS84
,IGNF:LAMB93
, etc.).According to the ogr2ogr csv documentation, you need to specify which fields contain the geometry in a VRT file:
where
data.csv
is the CSV file name,IGNF:LAMB93
the SRS, andCOL_X
andCOL_Y
, the columns names to use for building the geometry.Save this as a file with VRT extension (i.e.
data.vrt
) and use it as the source:ogr2ogr -f "ESRI Shapefile" data_shapeFile.shp data.vrt
The ESRI Shapefile can then be imported as any
.shp
in the Distiller.I hope this comment will help !
Bye
The text was updated successfully, but these errors were encountered: