Hi Lars

I use a script to do this for me.

----------------------------
PRINT 'START'
GO
Print GetDate()
GO
exec sp_spatial_query
        '
        select col1, col2, etc, HG_GeometryFromText(WKTColumn) as
sw_geometry into destTable from dbo.sourceTable
        '
GO
Print GetDate()
GO
-- Script for SM_MEMBER and ST_Spatial goes in here
ALTER TABLE destTable
        ADD sw_member int NOT NULL IDENTITY (1, 1)
GO
print GetDate()
go
ALTER TABLE destTable ADD CONSTRAINT
        PK_destTable PRIMARY KEY CLUSTERED 
        (
        sw_member
        ) ON [PRIMARY]

GO
print GetDate()
go
exec sp_sw_spatialize_column 'dbo','destTable','sw_geometry','sw_member'
go
print GetDate()
go
exec sp_sw_create_rtree 'dbo','destTable','sw_geometry','sw_member'
go
print GetDate()
Go
PRINT 'FINISHED'
go
----------------------------

As you can see I simply insert into a new table and then add the
SW_MEMBER, Primary Key, and then spatial indexes.  I use the GetDate()
function to monitor progress through the script.

Hope this helps.

Cheers Ian
______________________ 
Ian Tidy 
GIS Administrator 
Works Asset Department 
Napier City Council 
Hastings St, Private Bag 6010, Napier, New Zealand 
Phone +64-6-835-7579 Ext. 8115 
Fax +64-6-835-7574 
mailto:[EMAIL PROTECTED] 
http://www.napier.govt.nz 



-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Lars I.
Nielsen (GisPro)
Sent: Friday, 18 August 2006 11:25 p.m.
To: MAPINFO-L Mailinglist
Subject: [MI-L] SpatialWare for MS/SQL - HG_GeometryFromText ?

Hi list,

I'm trying to port some OGC WKT strings into SpatialWare blobs, but 
can't seem to get it right.

Has anyone got an example of a polygon WKT string that the 
GeometryFromText function in SpatialWare will accept ? The manual is 
sorely lacking in that respect.

--

My attempts started with these strings, all fail.

    update Test_WKT set sw_geometry = ' HG_GeometryFromText ( 
mi_poly_wkt ) '
    update Test_WKT set sw_geometry = ' HG_GeometryFromText (' + 
mi_poly_wkt + ') '
even
    update Test_WKT set sw_geometry = mi_poly_wkt

where the mi_poly_wkt column has (varchar) values as given below :

    GEOMETRYCOLLECTION ( POLYGON (( x1 y1 , x2 y2 , x3 y3 , .... , x1 y1

)) )

This format matches what the reverse function HG_AsText spits out when 
given a valid polygon geometry blob (sw_geometry), so I assumed it would

work as input. Alas.

Even when using a hard coded value instead of the mi_poly_wkt column, it

errs. The error message is always :

    Server: Msg 70509, Level 11, State 1, Line 0
    SW-70509: Invalid geometry detected: (ID=1):xp_rtree_insert_trigger

--

Yes, the Test_WKT table has been spatialized and an R-Tree index has 
been created.

--

Can anyone help me out ?

Using SpatialWare 4.8 on MS/SQL 2000.

-- 

Best regards / Med venlig hilsen
Lars I. Nielsen
GisPro

_______________________________________________
MapInfo-L mailing list
MapInfo-L@lists.directionsmag.com
http://www.directionsmag.com/mailman/listinfo/mapinfo-l

######################################################################

This e-mail message has been scanned and cleared by MailMarshal 

######################################################################
######################################################################
Attention: 
This e-mail message and accompanying data may contain information that
is confidential and subject to legal privilege. Any information
provided is given in good faith. However unless specifically stated to
the contrary, Napier City Council accepts no liability for the
content of this e-mail or for the consequences of any action taken on
the basis of the information provided, unless that information is
subsequently confirmed in writing. If you are not the intended recipient,
you are notified that any use, dissemination, distribution or copying
of this message or data is prohibited. If you received this e-mail
message in error, please notify us immediately and erase all copies
of this message and attachments. Thank you.

_______________________________________________
MapInfo-L mailing list
MapInfo-L@lists.directionsmag.com
http://www.directionsmag.com/mailman/listinfo/mapinfo-l

Reply via email to