Tag Info

New answers tagged

3

Assuming you have an older version of GDAL/OGR, you can use OGR SQL to cast the geom field to a geometry. For example: ogr2ogr -f "ESRI Shapefile" "sample.shp" "geo.csv" -sql "SELECT *, CAST(geom as geometry) FROM geo" This will create a new shapefile using the WKT data as the geometry. You can use the same query with ogrinfo as well: ogrinfo -ro -sql ...


1

I am using something like this with great success. import arcpy, os, csv inTables = r"pathToWorkspace" for dirpath, dirnames, filenames in arcpy.da.Walk(inTables, datatype="Table", type="ALL"): for tableName in filenames: print "Appending tables from " + tableName + " to " + newTable ...


1

I found the solution for my problem. There were (probably) two "errors" in my .csv. QGIS seems to detect that my data field called "text" contained exactly this - a text. Thus, it encoded it as a String (or character) data type. Within such a data field, however, double quotation marks are only allowed at beginning and end or not at all. Since my Tweets ...


1

Replace test.csv with the correct filename and paste the following code into the Python console. Note, that in your csv Lat=y comes before Lon=x. # specify your csv-file csvFile = "G:/test.csv" # create an empty memory layer for polylines layer = QgsVectorLayer('LineString?crs=EPSG:4326', 'Connected', 'memory') prov = layer.dataProvider() # add layer to ...


2

I see the problem... irrespective of what format is chosen a .dbf is written. Well, that has certainly changed since the last time I used those tools. Seeing as you're in python perhaps a little routine could help here: def WriteCsv(InFC,OutTab): print("Exporting %s to %s" % (InFC,OutTab)) with open(OutTab,'w') as OutFile: FieldNames = ...


0

When the row limit of Excel is exceeded, this should be an indication to switch to a database. Use PostGIS, put an index on the timestamp and animating that table with QGIS Time Manager will be a breeze.


1

Have you thought about using a combination delimiter? For instance, if you know $, ^, and # may be used in your string, make the delimiter #&^. I am not sure if QGIS supports multiple character delimiters directly. You can always call python's split("#&^") in order to manually split the string and handle individual values that way. We ran into ...


1

What editor are you using to save the CSV? I find that saving the CSV data through LibreOffice, rather than Microsoft Excel helps resolve this in certain cases, particularly on Mac OSX.



Top 50 recent answers are included