0

I have a database in SQL server 2008 R2. The database has a table with 5 columns and one column is "geometry", like :

  0xE610000001042C1C00000000004033DF60C000000080 ...

I have exported it to a csv file and would like to import it to a database in Spatialite 1.2.1.

I have created a database in Spatialite 1.2.1. The database has a table with the same structure as the one on SQL server.

table structure But, when I imported the csv file to the table, I got error:

problem of loading from csv with one column as "geometry"

load csv to Spatialite Did I do something wrong ?

I am new to Spatialite.

Thanks !

user3448011
  • 1,469
  • 1
  • 17
  • 39
  • How long can the `"geometry"` field be? Also make sure that the newlines are correct (open the file in Notepad to check maybe). Some programs might need `\r\n` instead of only `\n` – Danny_ds Jan 02 '16 at 21:05
  • @Danny, there is only one row in the csv file. The "geometry" field is very long, which has 65536 characters. If I replaced the long string with a very short one, no error for loading but the table is empty. – user3448011 Jan 02 '16 at 23:37
  • When you say that you exported it to a csv file, what format did the geometry data take? Was it like the `0xE6100...` value? If so, that's a SQL specific representation that your other database is unlikely to understand that format. Take a look at the `STAsText()` method (https://msdn.microsoft.com/en-us/library/bb933977.aspx) for something more platform agnostic. – Ben Thul Jan 03 '16 at 05:09
  • This appears to be a bug in `spatialite-gui.exe`. Try converting your file into an SQL script with an INSERT statement. Please note that SQLite uses a different syntax for [blob literals](http://www.sqlite.org/lang_expr.html#litvalue). – CL. Jan 03 '16 at 09:27

0 Answers0