さまざまな外部マップ ファイル形式 (ShapeFiles、MapPoint、KML など) を解析し、中央のマッピング/レポート ベースに使用される中央データベースに形状を格納するアプリケーションを構築しています。ポイントの抽象的な配列で表される線を持つルーチンがあり、それをデータベースに格納する sqlGeography オブジェクトに変換しようとしています (現時点では SQL2012 Express)。
LINESTRING ステートメントの例を次に示します (文字列 strGeo に格納されます)。
LINESTRING(41.942587758675 -85.636084221926,41.9425261573997 -85.6360833224383,41.9423450573927 -85.6360807217602,41.9423035553449 -85.6360801225198,41.9421639573891 -85.6360781210972,41.9421098574371 -85.6360773225739,41.9420307561342 -85.6360762213003)
次に、その文字列に対してこの操作を実行します (VB.NET)
Dim strSql As New SqlChars(New SqlString(strGeo))
Dim geo As SqlGeography = SqlGeography.STLineFromText(strSql, 4326)
SQL Server 2012 Feature pack から Microsoft.SqlServer.Types への適切な参照を追加しましたが、デバッガーが SqlGeography 行にヒットすると、次のようになります。
System.DllNotFoundException: Unable to load DLL 'SqlServerSpatial110.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
at Microsoft.SqlServer.Types.GLNativeMethods.GeodeticIsValid(GeoMarshalData g, Double eccentricity, Boolean forceKatmai, Boolean& result, Boolean& isSmallerThanAHemisphere)
at Microsoft.SqlServer.Types.GLNativeMethods.GeodeticIsValid(GeoData& g, Double eccentricity, Boolean forceKatmai)
at Microsoft.SqlServer.Types.SqlGeography.IsValidExpensive(Boolean forceKatmai)
at Microsoft.SqlServer.Types.SqlGeography..ctor(GeoData g, Int32 srid)
at Microsoft.SqlServer.Types.SqlGeography.GeographyFromText(OpenGisType type, SqlChars taggedText, Int32 srid)
at Microsoft.SqlServer.Types.SqlGeography.STLineFromText(SqlChars lineStringTaggedText, Int32 srid)
at ShpFileProcessor.Module1.ProcessFile(FileInfo fil) in C:\Users\Chet Cromer\documents\visual studio 2010\Projects\NorthernLights\ShpFileProcessor\ShpFileProcessor\Module1.vb:line 180
コンピューターのどこにも SqlServerSpatial110.dll が見つかりません。SQL Express 2012 がインストールされており、SYSTEM32 と SYSWOW64 の両方で SqlerverSpatial.dll を見つけることができますが、VS ではこれらのファイルのいずれも登録できません。
このように LINESTRING で 2 つの括弧を使用すると、別のエラーが発生することに気付きました。
LINESTRING((41.942587758675 -85.636084221926,41.9425261573997 -85.6360833224383,41.9423450573927 -85.6360807217602,41.9423035553449 -85.6360801225198,41.9421639573891 -85.6360781210972,41.9421098574371 -85.6360773225739,41.9420307561342 -85.6360762213003))
System.FormatException: 24141: A number is expected at position 27 of the input. The input has (41.942587758675.
at Microsoft.SqlServer.Types.WellKnownTextReader.RecognizeDouble()
at Microsoft.SqlServer.Types.WellKnownTextReader.ParseLineStringText()
at Microsoft.SqlServer.Types.WellKnownTextReader.ParseTaggedText(OpenGisType type)
at Microsoft.SqlServer.Types.WellKnownTextReader.Read(OpenGisType type, Int32 srid)
at Microsoft.SqlServer.Types.SqlGeography.ParseText(OpenGisType type, SqlChars taggedText, Int32 srid)
at Microsoft.SqlServer.Types.SqlGeography.GeographyFromText(OpenGisType type, SqlChars taggedText, Int32 srid)
at Microsoft.SqlServer.Types.SqlGeography.STLineFromText(SqlChars lineStringTaggedText, Int32 srid)
at ShpFileProcessor.Module1.ProcessFile(FileInfo fil) in C:\Users\Chet Cromer\documents\visual studio 2010\Projects\NorthernLights\ShpFileProcessor\ShpFileProcessor\Module1.vb:line 180
(文字数を数える前に、位置 27 は最初の緯度/経度の組み合わせの間のスペースです)
最初の文字列形式は正しい形式だと思いますが、現時点では確信が持てず、SqlServerSpatial110.dll の問題をどう処理すればよいかわかりません。
この道を通った人いますか?何か不足していますか?