This project is read-only.

How to create a good database for MsSqlSpatial

Topics: User Forum
Feb 19, 2007 at 8:38 AM
Hello,
I found a simple database (in mdb file, but i found the same in excel file) with the gps of the french town.

 
 Town name                      Latitude      Longitude 
 L'Abergement-Clémenciat        46.15         4.916667
 L'Abergement-de-Varey          46            5.416667
 Amareins                       46.083333     4.8
 Ambérieu-en-Bugey              45.95         5.35
 Ambérieux-en-Dombes            46            4.9
 Ambléon                        45.75         5.6
i've exported it to sql server (same database structure) but i've some difficults to use it with MsSqlSpatial.

I want to use this database with MsSqlSpatial.
Can you help me ?

Thanks
Philippe
Feb 19, 2007 at 8:55 AM
I think I have to use ST.AddGeometryColumn but I don't find an example for that !

thanks for your support
Philippe
Feb 19, 2007 at 6:02 PM
A tutorial about importing data from non-spatial formats is in the works. Please, be patient.

Best regards,
Ricardo Stuven.
Feb 20, 2007 at 6:29 PM
well. when is it planned to be available ?
i need that, that week :(
can i access to a draft ?

Or does someone have a database already mssqlspatial enabled with all the french town ? (about 36000 rows)

Regards
Philippe
Feb 26, 2007 at 3:36 PM
hello
nobody can just give me an approximative delay ?

thanks
Philippe
Feb 27, 2007 at 1:05 PM
Edited Feb 27, 2007 at 1:05 PM
well i found a solution, probably not the best but it works
i imported the brut data in sql server in a town table
i created a town2 table and added the mssqlspatial support
EXEC	@return_value = [ST].[AddGeometryColumn]
		@schema_name = N'dbo',
		@table_name = N'town2',
		@column_name = N'geom',
		@srid = -1,
		@type = N'POINT'

then i created a #town temp database and created strings like "POINT(23.12 12.12)" in the col column
select INSEE, 'POINT(' + cast(latitude as nvarchar) + ' ' + cast(longitude as nvarchar) + ')' as col
into #town 
from town

and then i inserted the result in the town2 table (geom is the mssqlspatial column)
insert into town2(columns, geom)
select town.*, ST.GeomFromText(col,-1)
from town
inner join #town on #town.id = town.id