我在版本2.4下使用不同的lon / lat数据集获得了引用的错误。我升级到2.6并且能够在该数据集上使用2dsphere索引。但是,使用不同的数据集(下面的摘录),我在尝试使用2dshpere进行索引时收到了旧的错误消息。错误消息摘录如下:
我遇到同样的错误:无法从对象中提取geokeys;格式错误的几何?对象如下,在GeoJSONLint.com上验证。另外,我使用的是mongodb 2.6.1版。最近我在使用2.4版本时发生了这种情况,并且我升级到2.6,然后解决了问题,但是我再次使用新的geojson数据集获得错误。如果有人能告诉我如何解决这个问题会非常有帮助。
{"type":"Feature",
"geometry": {
"type":"Polygon",
"coordinates": [[[-80.341942, 25.935059],[-80.341995, 25.936712],[-80.342026, 25.937851],[-80.342026, 25.938393],[-80.34211, 25.939489],[-80.342178, 25.942131],[-80.342308, 25.942329],[-80.342339, 25.94285],[-80.342438, 25.944914],[-80.342445, 25.945118],[-80.342514, 25.947062],[-80.342537, 25.947479],[-80.342613, 25.949152],[-80.342667, 25.950306],[-80.342712, 25.951366],[-80.342773, 25.952713],[-80.342857, 25.954611],[-80.341438, 25.955782],[-80.340202, 25.956839],[-80.339104, 25.957079],[-80.33831, 25.957081],[-80.336006, 25.957088],[-80.333244, 25.957096],[-80.331787, 25.957102],[-80.326721, 25.957117],[-80.326714, 25.957117],[-80.32444, 25.957127],[-80.323616, 25.957129],[-80.322365, 25.957132],[-80.318619, 25.957146],[-80.317375, 25.95715],[-80.316597, 25.957151],[-80.314278, 25.957161],[-80.313507, 25.957163],[-80.3134, 25.957163],[-80.31308, 25.957165],[-80.312973, 25.957167],[-80.312798, 25.957167],[-80.312263, 25.957167],[-80.312088, 25.957167],[-80.311996, 25.957167],[-80.311737, 25.957167],[-80.311646, 25.957169],[-80.311531, 25.957169],[-80.311272, 25.95717],[-80.311188, 25.95717],[-80.311073, 25.95717],[-80.311028, 25.95717],[-80.310913, 25.95717],[-80.310883, 25.95717],[-80.310837, 25.95717],[-80.310829, 25.95717],[-80.310783, 25.95717],[-80.310776, 25.95717],[-80.310738, 25.957169],[-80.310684, 25.957167],[-80.310646, 25.957165],[-80.310616, 25.957165],[-80.310547, 25.957163],[-80.310356, 25.957161],[-80.310287, 25.957159],[-80.310249, 25.957157],[-80.310143, 25.957155],[-80.310104, 25.957155],[-80.302231, 25.95697],[-80.301704, 25.956972],[-80.298981, 25.956896],[-80.301468, 25.956968],[-80.298668, 25.956886],[-80.29528, 25.956772],[-80.295052, 25.95677],[-80.294975, 25.95677],[-80.294975, 25.956905],[-80.294975, 25.956928],[-80.294762, 25.956938],[-80.29454, 25.956947],[-80.294548, 25.956835],[-80.294579, 25.954868],[-80.294579, 25.954702],[-80.294601, 25.953625],[-80.294601, 25.953461],[-80.294571, 25.953079],[-80.294502, 25.95186],[-80.294487, 25.95163],[-80.294472, 25.951212],[-80.294418, 25.949945],[-80.294296, 25.946936],[-80.294281, 25.946581],[-80.294197, 25.944429],[-80.294128, 25.943003],[-80.294098, 25.942413],[-80.29409, 25.94228],[-80.293854, 25.939285],[-80.293846, 25.939144],[-80.293694, 25.936041],[-80.293625, 25.934875],[-80.293549, 25.933006],[-80.293541, 25.932341],[-80.293533, 25.931826],[-80.293472, 25.931252],[-80.293495, 25.93054],[-80.293373, 25.928652],[-80.293343, 25.928129],[-80.293335, 25.927803],[-80.29332, 25.92738],[-80.293228, 25.925432],[-80.295456, 25.925182],[-80.296936, 25.925102],[-80.297676, 25.925114],[-80.297974, 25.925117],[-80.298866, 25.925131],[-80.30027, 25.925121],[-80.300957, 25.925116],[-80.305336, 25.925138],[-80.306831, 25.925156],[-80.307472, 25.925163],[-80.307686, 25.925158],[-80.308235, 25.92514],[-80.30941, 25.925127],[-80.309402, 25.924763],[-80.313126, 25.924776],[-80.318581, 25.924747],[-80.319275, 25.924746],[-80.319557, 25.924723],[-80.320023, 25.924686],[-80.320137, 25.924664],[-80.320526, 25.924587],[-80.320992, 25.924469],[-80.321259, 25.9244],[-80.321419, 25.924341],[-80.321869, 25.92417],[-80.322388, 25.923891],[-80.32254, 25.923805],[-80.322746, 25.923674],[-80.323059, 25.923479],[-80.323067, 25.923475],[-80.323181, 25.923376],[-80.323235, 25.92333],[-80.32373, 25.922907],[-80.324226, 25.922354],[-80.324783, 25.921375],[-80.324966, 25.920954],[-80.32531, 25.921684],[-80.325325, 25.922615],[-80.32534, 25.923359],[-80.32534, 25.923492],[-80.325348, 25.923607],[-80.325356, 25.923817],[-80.325371, 25.924597],[-80.325401, 25.925245],[-80.325432, 25.925819],[-80.325439, 25.92606],[-80.325462, 25.926447],[-80.325447, 25.926756],[-80.325409, 25.927439],[-80.325562, 25.92762],[-80.325706, 25.927801],[-80.325928, 25.92808],[-80.326218, 25.927971],[-80.326492, 25.927883],[-80.327003, 25.927832],[-80.33033, 25.927818],[-80.333618, 25.927853],[-80.334419, 25.927872],[-80.336128, 25.927896],[-80.336777, 25.927883],[-80.338219, 25.927912],[-80.339294, 25.927912],[-80.33963, 25.927931],[-80.340416, 25.927938],[-80.340919, 25.927923],[-80.341103, 25.927925],[-80.341606, 25.927925],[-80.34166, 25.929146],[-80.341721, 25.930458],[-80.341728, 25.930592],[-80.341766, 25.931606],[-80.341858, 25.933409],[-80.341942, 25.935059]
]]},
"properties":{
"id": "ZIP33015","census_year": 2010,"exposure_year": 2014, "commercial_exposure": 652653581, "residential_exposure": 2299303204, "mobile_home": 0, "tenants": 8631577, "condo_owners": 49223035, "total_exposure": 3009811397}}
当我在上面运行db.exposureByZip.ensureIndex({" geometry":" 2dsphere"})时,我收到以下错误:
{
"createdCollectionAutomatically" : false,
"numIndexesBefore" : 1,
"ok" : 0,
"errmsg" : "Can't extract geo keys from object, malformed geometry?: { _id: ObjectId('53a6be43beeb0a0246ae75bb'), geometry: { type: \"Polygon\", coordinates: [ [ [ -80.341942, 25.935059 ], [ -80.341995, 25.936712 ], [ -80.342026, 25.937851 ], [ -80.342026, 25.938393 ], [ -80.34211000000001, 25.939489 ], [ -80.342178, 25.942131 ], [ -80.342308, 25.942329 ], [ -80.342339, 25.94285 ], [ -80.342438, 25.944914 ], [ -80.342445, 25.945118 ], [ -80.34251399999999, 25.947062 ], [ -80.34253699999999, 25.947479 ], [ -80.342613, 25.949152 ], [ -80.34266700000001, 25.950306 ], [ -80.34271200000001, 25.951366 ], [ -80.34277299999999, 25.952713 ], [ -80.342857, 25.954611 ], [ -80.341438, 25.955782 ], [ -80.34020200000001, 25.956839 ], [ -80.33910400000001, 25.957079 ], [ -80.33831000000001, 25.957081 ], [ -80.336006, 25.957088 ], [ -80.33324399999999, 25.957096 ], [ -80.33178700000001, 25.957102 ], [ -80.32672100000001, 25.957117 ], [ -80.326714, 25.957117 ], [ -80.32444, 25.957127 ], [ -80.323616, 25.957129 ], [ -80.322365, 25.957132 ], [ -80.318619, 25.957146 ], [ -80.317375, 25.95715 ], [ -80.316597, 25.957151 ], [ -80.314278, 25.957161 ], [ -80.313507, 25.957163 ], [ -80.3134, 25.957163 ], [ -80.31308, 25.957165 ], [ -80.312973, 25.957167 ], [ -80.312798, 25.957167 ], [ -80.312263, 25.957167 ], [ -80.312088, 25.957167 ], [ -80.31199599999999, 25.957167 ], [ -80.31173699999999, 25.957167 ], [ -80.311646, 25.957169 ], [ -80.311531, 25.957169 ], [ -80.311272, 25.95717 ], [ -80.311188, 25.95717 ], [ -80.31107299999999, 25.95717 ], [ -80.31102799999999, 25.95717 ], [ -80.310913, 25.95717 ], [ -80.310883, 25.95717 ], [ -80.31083700000001, 25.95717 ], [ -80.310829, 25.95717 ], [ -80.310783, 25.95717 ], [ -80.310776, 25.95717 ], [ -80.310738, 25.957169 ], [ -80.31068399999999, 25.957167 ], [ -80.31064600000001, 25.957165 ], [ -80.310616, 25.957165 ], [ -80.310547, 25.957163 ], [ -80.310356, 25.957161 ], [ -80.310287, 25.957159 ], [ -80.310249, 25.957157 ], [ -80.310143, 25.957155 ], [ -80.310104, 25.957155 ], [ -80.30223100000001, 25.95697 ], [ -80.301704, 25.956972 ], [ -80.298981, 25.956896 ], [ -80.301468, 25.956968 ], [ -80.29866800000001, 25.956886 ], [ -80.29528000000001, 25.956772 ], [ -80.295052, 25.95677 ], [ -80.29497499999999, 25.95677 ], [ -80.29497499999999, 25.956905 ], [ -80.29497499999999, 25.956928 ], [ -80.29476200000001, 25.956938 ], [ -80.29454, 25.956947 ], [ -80.29454800000001, 25.956835 ], [ -80.294579, 25.954868 ], [ -80.294579, 25.954702 ], [ -80.294601, 25.953625 ], [ -80.294601, 25.953461 ], [ -80.294571, 25.953079 ], [ -80.29450199999999, 25.95186 ], [ -80.294487, 25.95163 ], [ -80.294472, 25.951212 ], [ -80.29441799999999, 25.949945 ], [ -80.294296, 25.946936 ], [ -80.294281, 25.946581 ], [ -80.294197, 25.944429 ], [ -80.294128, 25.943003 ], [ -80.29409800000001, 25.942413 ], [ -80.29409, 25.94228 ], [ -80.293854, 25.939285 ], [ -80.293846, 25.939144 ], [ -80.293694, 25.936041 ], [ -80.29362500000001, 25.934875 ], [ -80.293549, 25.933006 ], [ -80.293541, 25.932341 ], [ -80.293533, 25.931826 ], [ -80.29347199999999, 25.931252 ], [ -80.29349499999999, 25.93054 ], [ -80.293373, 25.928652 ], [ -80.29334299999999, 25.928129 ], [ -80.293335, 25.927803 ], [ -80.29331999999999, 25.92738 ], [ -80.293228, 25.925432 ], [ -80.295456, 25.925182 ], [ -80.296936, 25.925102 ], [ -80.297676, 25.925114 ], [ -80.297974, 25.925117 ], [ -80.298866, 25.925131 ], [ -80.30027, 25.925121 ], [ -80.300957, 25.925116 ], [ -80.305336, 25.925138 ], [ -80.306831, 25.925156 ], [ -80.307472, 25.925163 ], [ -80.307686, 25.925158 ], [ -80.308235, 25.92514 ], [ -80.30941, 25.925127 ], [ -80.30940200000001, 25.924763 ], [ -80.313126, 25.924776 ], [ -80.31858099999999, 25.924747 ], [ -80.319275, 25.924746 ], [ -80.319557, 25.924723 ], [ -80.32002300000001, 25.924686 ], [ -80.320137, 25.924664 ], [ -80.320526, 25.924587 ], [ -80.320992, 25.924469 ], [ -80.321259, 25.9244 ], [ -80.32141900000001, 25.924341 ], [ -80.32186900000001, 25.92417 ], [ -80.322388, 25.923891 ], [ -80.32254, 25.923805 ], [ -80.322746, 25.923674 ], [ -80.323059, 25.923479 ], [ -80.32306699999999, 25.923475 ], [ -80.32318100000001, 25.923376 ], [ -80.323235, 25.92333 ], [ -80.32373, 25.922907 ], [ -80.324226, 25.922354 ], [ -80.324783, 25.921375 ], [ -80.324966, 25.920954 ], [ -80.32531, 25.921684 ], [ -80.32532500000001, 25.922615 ], [ -80.32534, 25.923359 ], [ -80.32534, 25.923492 ], [ -80.32534800000001, 25.923607 ], [ -80.325356, 25.923817 ], [ -80.325371, 25.924597 ], [ -80.325401, 25.925245 ], [ -80.32543200000001, 25.925819 ], [ -80.325439, 25.92606 ], [ -80.325462, 25.926447 ], [ -80.325447, 25.926756 ], [ -80.32540899999999, 25.927439 ], [ -80.32556200000001, 25.92762 ], [ -80.325706, 25.927801 ], [ -80.325928, 25.92808 ], [ -80.326218, 25.927971 ], [ -80.326492, 25.927883 ], [ -80.327003, 25.927832 ], [ -80.33033, 25.927818 ], [ -80.333618, 25.927853 ], [ -80.334419, 25.927872 ], [ -80.336128, 25.927896 ], [ -80.336777, 25.927883 ], [ -80.338219, 25.927912 ], [ -80.339294, 25.927912 ], [ -80.33963, 25.927931 ], [ -80.340416, 25.927938 ], [ -80.340919, 25.927923 ], [ -80.341103, 25.927925 ], [ -80.341606, 25.927925 ], [ -80.34166, 25.929146 ], [ -80.34172100000001, 25.930458 ], [ -80.341728, 25.930592 ], [ -80.34176600000001, 25.931606 ], [ -80.341858, 25.933409 ], [ -80.341942, 25.935059 ] ] ] }, type: \"Feature\", properties: { commercial_exposure: 652653581, total_exposure: 3009811397, condo_owners: 49223035, mobile_home: 0, census_year: 2010, tenants: 8631577, residential_exposure: 2299303204, exposure_year: 2014, id: \"ZIP33015\" } }",
"code" : 16755
}
答案 0 :(得分:1)
此问题已发布错误:https://jira.mongodb.org/browse/SERVER-13735
为有效的地理层索引创建“格式错误的几何体”错误 的MultiPolygon
类似的问题,正在为2dsphere索引提交有效的GeoJSON并导致“无法从对象,格式错误的几何体中提取地理位置键?”错误。
有一系列先前的错误,其中有效的GeoJSON导致此错误消息。他们已经修复了2.6.x中的那些,但这似乎是一个新的。我会参与JIRA,因为它有助于优先考虑修复。
答案 1 :(得分:0)
问题可能是因为您的多边形坐标将第一个坐标和最后一个坐标作为相同的值。尝试从多边形中删除最后一个坐标点。