[SERVER-8907] Add multi{point, line, polygon} and geometrycollection GeoJSON types to 2dsphere index. Created: 08/Mar/13  Updated: 01/Apr/14  Resolved: 26/Jun/13

Status: Closed
Project: Core Server
Component/s: Geo, Querying
Affects Version/s: 2.4.0-rc1
Fix Version/s: 2.5.1

Type: Bug Priority: Minor - P4
Reporter: Robert Moore Assignee: hari.khalsa@10gen.com
Resolution: Done Votes: 13
Labels: 26qa
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Duplicate
is duplicated by SERVER-10052 Add "MultiPolygon" support for GeoJSO... Closed
is duplicated by SERVER-9026 Add "MultiPolygon" support for GeoJSO... Closed
is duplicated by SERVER-8349 Implement storage of multi-polygon Closed
Related
is related to DOCS-1983 Document : Geo add multi{point,line,p... Closed
Operating System: ALL
Steps To Reproduce:

See code above.

Participants:

 Description   

The release notes for the new '2dsphere' index does not indicate if indexing arrays of GeoJSON objects is supported.

It was supported for the '2d' index so I expected it to be supported for the '2dsphere' indexes but I tried it with 2.4.0_rc1 and it returned a "malformed geometry" error:

> db.system.indexes.find();
{ "v" : 1, "key" : { "_id" : 1 }, "ns" : "acceptance_test.geo_2", "name" : "_id_" }
{ "v" : 1, "key" : { "p" : "2dsphere" }, "ns" : "acceptance_test.geo_2", "name" : "p_2dsphere" }
> db.geo_2.insert( { "p" : [ { "type" : "Point", "coordinates" : [ 87.9259315145841, 63.65550362431469 ] }, { "type" : "Point", "coordinates" : [ 88.9259315145841, 64.65550362431469 ] } ] } )
Can't extract geo keys from object, malformed geometry?:{ 0: { type: "Point", coordinates: [ 87.92593151458409, 63.65550362431469 ] }, 1: { type: "Point", coordinates: [ 88.92593151458409, 64.65550362431469 ] } }

I can understand not supporting indexing arrays of GeoJSON documents but it should be documented in the release notes at a minimum.

For grins I also tried the GeometryCollection:

> db.geo_2.insert( { "p" : { "type": "GeometryCollection", "geometries": [ { "type" : "Point", "coordinates" : [ 87.9259315145841, 63.65550362431469 ] }, { "type" : "Point", "coordinates" : [ 88.9259315145841, 64.65550362431469 ] } ] } } )
Can't extract geo keys from object, malformed geometry?:{ type: "GeometryCollection", geometries: [ { type: "Point", coordinates: [ 87.92593151458409, 63.65550362431469 ] }, { type: "Point", coordinates: [ 88.92593151458409, 64.65550362431469 ] } ] }

... and MultiPoint but neither worked.

> db.geo_2.insert( { "p" : { "type" : "MultiPoint", "coordinates" : [ [ 87.9259315145841, 63.65550362431469 ] , [ 88.9259315145841, 64.65550362431469 ] ] } } )
Can't extract geo keys from object, malformed geometry?:{ type: "MultiPoint", coordinates: [ [ 87.92593151458409, 63.65550362431469 ], [ 88.92593151458409, 64.65550362431469 ] ] }



 Comments   
Comment by Daniel Pasette (Inactive) [ 02/Aug/13 ]

It is too risky to backport this to the 2.4 branch.

Comment by auto [ 25/Jun/13 ]

Author:

{u'username': u'hkhalsa', u'name': u'Hari Khalsa', u'email': u'hkhalsa@10gen.com'}

Message: add multipoint/line/poly. SERVER-8907 SERVER-8349
Branch: master
https://github.com/mongodb/mongo/commit/ba239918c950c254056bf589a943a5e88fd4144c

Comment by Frédéric De Jaeger [ 17/Jun/13 ]

me too. That would help to workaround https://jira.mongodb.org/browse/SERVER-9948

Comment by Fritz Richter [ 17/Jun/13 ]

So is there any chance to tell, when this feature is comming? We are SO MUCH looking forward to finally switch from PostgreSQL to MongoDB but this feature is the reason why we can not do it, until now.

Comment by Derick Rethans [ 17/Jun/13 ]

michal.gasek@avtech.aero - I was indeed mistaken there. I am pretty sure I had tested that... but now I've tried it indeed does not work. My apologies!

Comment by Russell de Grove [ 13/Jun/13 ]

This is huge for us. We have a mapping product- MapDotNet- which supports multiple back end spatial stores and I am investigating adding support for MongoDB but this issue probably makes that a non-starter for us until it is resolved.

Comment by Michal Gasek [ 16/May/13 ]

I would really like to see the priority on this one increased as well. Actually at the last MongoDB conference in Stockholm I was (wrongly) informed that the hack with array of GeoJSON points (as in the first example) is supposed to work fine.

Comment by Jim Dagg [ 15/May/13 ]

I agree with Clifford – I'm having to do all kinds of ugly hacks and workarounds in order to get the effect of MultiPolygons, including duplicating documents in the database with different geometries (one for each polygon).

Comment by Clifford Hammerschmidt [ 15/May/13 ]

Can we get the priority increased on this one? It's rather important to anyone using geo data as almost all real world geo data has holes, etc. in it. (Basically city boundaries, state/province boundaries, etc.)

Comment by hari.khalsa@10gen.com [ 08/Mar/13 ]

Hi! We expect to add MultiPoint/MultiLineString/MultiPolygon/GeometryCollection in 2.5 and backport to 2.4.x

Generated at Thu Feb 08 03:18:47 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.