我试图将一些XML数据转换为几何体并且出现错误。起初,我尝试获取特定的数字坐标并进行投射,但得到了类似的错误:
错误:(在代码中,因为它有标签)
A .NET Framework error occurred during execution of user-defined routine or aggregate "geometry":
System.FormatException: 24114: The label <boundary><MultiGeom in the input well-known text (WKT) is not valid. Valid labels are POINT, LINESTRING, POLYGON, MULTIPOINT, MULTILINESTRING, MULTIPOLYGON, GEOMETRYCOLLECTION, CIRCULARSTRING, COMPOUNDCURVE, CURVEPOLYGON and FULLGLOBE (geography Data Type only).
这是尝试CAST(MyColumn AS GEOMETRY)
。
这就是XML数据的样子(注意 ... [values] ... 正在替换完整的坐标值,仅用于示例目的:
<boundary><MultiGeometry><Polygon><LinearRing><coordinates>-97.765454 30.435704,-97.769209 30.434563,-97.775798 30.437743,-97.781058 30.441067,-97.784075 30.443015,-97.783362 30.443726,-97.781434
30.444964,-97.78141 30.445552,-97.781102 30.445859,-97.780104 30.446532,-97.780978 30.447194,-97.785235 30.450363,-97.790375 30.448821,-97.790674 30.448731,-97.790688 30.448963,-97.79103 30.4506
92,-97.791543 30.453036,-97.791994 30.455476,-97.79241 30.456756,-97.792832 30.45781,-97.792172 30.458024,-97.793562 30.461406,-97.792489 30.461897,-97.791647 30.46257,-97.790356 30.463142,-97.78
9209 30.46382,-97.788378 30.464607,-97.787809 30.465319,-97.787592 30.466123,-97.787561 30.466906,-97.787959 30.467816,-97.788629 30.468526,-97.789367 30.469198,-97.789732 30.469689,-97.790204 30
.470817,-97.781231 30.473563,-97.780311 30.473861,-97.780041 30.473202,-97.780611 30.473037,-97.780346 30.472335,-97.77767 30.472967,-97.775423 30.473218,-97.77545 30.4737,-97.772053 30.473949,-9
7.771333 30.474056,-97.77111 30.473701,-97.770642 30.473765,-97.77015 30.473824,-97.769638 30.473118,-97.764115 30.474854,-97.762738 30.471413,-97.761191 30.467978,-97.761085 30.467487,-97.763038
30.466992,-97.762067 30.464561,-97.761117 30.464949,-97.760484 30.465054,-97.759764 30.465481,-97.758782 30.464738,-97.758625 30.465295,-97.758695 30.465966,-97.758492 30.466395,-97.758574 30.46
6962,-97.758396 30.467357,-97.758306 30.468183,-97.758503 30.468403,-97.758255 30.468941,-97.757683 30.469601,-97.757683 30.470085,-97.75739 30.470998,-97.756634 30.47157,-97.756342 30.471878,-97
.756228 30.472186,-97.75591 30.472438,-97.755535 30.47246,-97.754627 30.472135,-97.753707 30.471722,-97.753606 30.471447,-97.753174 30.471046,-97.753162 30.470628,-97.753403 30.470859,-97.753314
30.470529,-97.752819 30.470011,-97.752794 30.469802,-97.751899 30.4689,-97.751379 30.468553,-97.750103 30.468189,-97.747863 30.468281,-97.747469 30.468154,-97.74719 30.468528,-97.746612 30.468776
,-97.74625 30.468595,-97.746034 30.468677,-97.7462 30.469046,-97.746105 30.469255,-97.745717 30.469525,-97.745476 30.469849,-97.745984 30.470096,-97.745648 30.470636,-97.745312 30.470713,-97.7448
61 30.470636,-97.744658 30.471115,-97.744683 30.471313,-97.744309 30.471863,-97.74424 30.472726,-97.74377 30.47299,-97.742424 30.474124,-97.742107 30.474245,-97.741313 30.474234,-97.740119 30.473
663,-97.739573 30.473652,-97.739039 30.473306,-97.738855 30.473388,-97.738532 30.473911,-97.738221 30.474192,-97.738043 30.474885,-97.73826 30.475578,-97.738263 30.476076,-97.737388 30.476339,-97
.73694 30.476438,-97.73449 30.476747,-97.731269 30.476924,-97.730297 30.476817,-97.719867 30.480161,-97.720501 30.483118,-97.720139 30.483431,-97.720076 30.483932,-97.719892 30.484234,-97.719924
30.484834,-97.719689 30.485274,-97.719619 30.485714,-97.719029 30.485956,-97.718609 30.486,-97.717232 30.486319,-97.71619 30.486507,-97.715009 30.486501,-97.71377 30.486122,-97.713294 30.486304,-
97.713269 30.486848,-97.713434 30.487596,-97.714012 30.488883,-97.714298 30.489334,-97.714298 30.48957,-97.713759 30.490214,-97.713219 30.490522,-97.712152 30.490836,-97.711555 30.491083,-97.7097
64 30.49137,-97.709098 30.491346,-97.707942 30.488179,-97.707896 30.487929,-97.705045 30.478793,-97.704685 30.478481,-97.708147 30.473127,-97.715294 30.46205,-97.716256 30.460589,-97.717599 30.45
8633,-97.717935 30.4584,-97.719177 30.457873,-97.719634 30.457568,-97.71992 30.457216,-97.720411 30.45603,-97.721149 30.455835,-97.721243 30.454826,-97.725271 30.452009,-97.725617 30.451551,-97.7
25943 30.450868,-97.725981 30.450445,-97.725892 30.449771,-97.725648 30.449055,-97.725522 30.449182,-97.723979 30.449507,-97.722646 30.449445,-97.723018 30.448729,-97.726791 30.441035,-97.727423
30.439676,-97.727736 30.438611,-97.727962 30.438978,-97.728317 30.439223,-97.729199 30.439267,-97.729562 30.439517,-97.730598 30.439515,-97.731419 30.43945,-97.732413 30.439899,-97.732417 30.4400
08,-97.733015 30.440655,-97.733338 30.440807,-97.733935 30.441246,-97.734668 30.441241,-97.73476 30.441503,-97.735295 30.441972,-97.735317 30.442332,-97.735785 30.442336,-97.735909 30.442539,-97.
736474 30.443045,-97.737032 30.443174,-97.737452 30.443512,-97.737951 30.443742,-97.738844 30.443932,-97.739765 30.444349,-97.740371 30.444522,-97.742201 30.443835,-97.742349 30.443859,-97.742559
30.443867,-97.7444 30.443192,-97.74456 30.442985,-97.746231 30.442372,-97.746375 30.442381,-97.744663 30.439937,-97.745789 30.439277,-97.746195 30.438928,-97.746914 30.438684,-97.747375 30.43880
9,-97.748447 30.439366,-97.748875 30.439719,-97.749638 30.44114,-97.749691 30.441042,-97.750477 30.440742,-97.75071 30.440774,-97.752354 30.440137,-97.752494 30.439943,-97.752892 30.439894,-97.75
407 30.439446,-97.755747 30.438886,-97.758005 30.438148,-97.760441 30.437361,-97.762119 30.4368,-97.763562 30.436395,-97.764517 30.435985,-97.765454 30.435704</coordinates></LinearRing></Polygon></MultiGeometry></boundary>
<boundary><coordinates>-97.762119 30.4368</coordinates></boundary>
请注意,这些坐标对可以更多或相同(使用相同的XML)。
是否有表格可以转换此XML以使其与Geometry兼容?在查看Microsoft provides到几何数据类型时,我不会看到它应该出现的形式,而不是看起来像SHAPE和坐标,所以我&#39;我试图弄清楚他们如何使用我在上面的示例数据中提供的内容来推断他们所做的事情。
感谢。