Saturday, 15 February 2014

Mongodb error : Can't extract geo keys from object, malformed geometry? -


I can not separate MongoDB 2.4.3

The following error object with Xiao Keys , From perverse geometry

  {type :? "Polygon", Coordinate: [[103.8324334524412, 1.284232321447769], [103.8342325475588, 1.284232321447769], [103.8342325469261, 1.282433678236006], [103.8324334530738, 1.282433678236006]]]   

Can help in understanding? It looks like a valid geographical element. My index type is 2dsphere

The two steps I'm running are:.

  collection.ensureIndex {'geometry': "2dsphere"}, (error) = & gt; # Check some error # and then the collection.insert features, (error) = & gt; # Features Geographic Features # {"Type": "Feature" # "Geometry" Objects: & lt; Polygon Object Up & gt; }   

This error comes from the inclusion query. The full document I am trying to insert is:

  {"type": "feature" , "Geometry": {"type": "polygon", "coordinate": [[[103.83243345244122, 1.2842323214477689], [103.83423254755876,1.2842323214477689], [103.83423254692615,1.2824336782360055], [103.83243345307383,1.2824336782360055]]]}, "Properties" : {"Name": "My place"}}    

polygon object in GeoJSON first The point is required ([longitude, latitude]) done as the last point Right. By making this change:

  {type: "polygon", coordinates: [[[103.8324334524412, 1.284232321447769], [103.8342325475588, 1.284232321447769], [103.8342325469261, 1.282433678236006], [103.8324334530738, 1.282433678236006], [ 103.8324334524412, 1.284232321447769]]]}   

The insert query works fine.

No comments:

Post a Comment