June 1, 2012 at 12:22 pm
I didn't actually. Not message, etc at all. A search of sys.objects in every database returns no results as well. On with the search..
Cheers
June 1, 2012 at 12:27 pm
I noticed while looking at the table structure for tl_2008_us_state that there is a column called geom and one called boundaryGeog. Just mentioning this because it is odd those two names are a cross between what is causing the current situation.
Cheers
June 1, 2012 at 12:31 pm
"geom" is the name you created during the import. I named it BoundaryGeom. BoundaryGeog is another field I added to the tl_2008_us_state table. geom is a Geometry field while BoundaryGeog is a geography field.
June 1, 2012 at 12:34 pm
I changed BoundaryGeom to BoundaryGeog as seen below and now it throws the following:
UPDATE tl_2008_us_state
SET BoundaryGeog = GEOGRAPHY::STGeomFromWKB(BoundaryGeog.MakeValid().STAsBinary(), 4326)
WHERE NAME NOT IN('Massachusetts', 'New Mexico', 'Wyoming', 'Montana', 'Texas', 'North Carolina', 'Arizona', 'Tennessee', 'Utah')
Msg 6506, Level 16, State 10, Line 2
Could not find method 'MakeValid' for type 'Microsoft.SqlServer.Types.SqlGeography' in assembly 'Microsoft.SqlServer.Types'
Cheers
June 1, 2012 at 12:42 pm
Per your explanation of column names changing the statement as seen below resolves the issue.
UPDATE tl_2008_us_state
SET BoundaryGeog = GEOGRAPHY::STGeomFromWKB(Geom.MakeValid().STAsBinary(), 4326)
WHERE NAME NOT IN('Massachusetts', 'New Mexico', 'Wyoming', 'Montana', 'Texas', 'North Carolina', 'Arizona', 'Tennessee', 'Utah')
Cheers
June 1, 2012 at 12:43 pm
Please refer to my post. You should have two fields added to tl_2008_us_state: BoundaryGeom (GEOMETRY) and BoundaryGeog (GEOGRAPHY).
June 1, 2012 at 12:49 pm
I do not have those two. I see the add column statement for BoundaryGeog but nothing that either renames, drops and adds, etc BoundaryGeoM
Cheers
June 1, 2012 at 12:56 pm
See screenshot in step 2, lower right panel, I named Geometry name as BoundaryGeom.
June 1, 2012 at 1:01 pm
Ah! Now I see it. I didn't catch that when importing the shape file. I left geom as the default.
Cheers
June 2, 2012 at 12:35 pm
I'm try to do something similiar and going through this article, line by line, has given me a lot of ideas. It's excellent and helps a lot. Thanks
Viewing 10 posts - 16 through 24 (of 24 total)
You must be logged in to reply to this topic. Login to reply