- 
    Type:
Bug
 - 
    Resolution: Done
 - 
    Priority:
Major - P3
 - 
    None
 - 
    Affects Version/s: None
 - 
    Component/s: Read Operations
 - 
    None
 
- 
        None
 
- 
        None
 - 
        None
 - 
        None
 - 
        None
 - 
        None
 - 
        None
 
I am using the Within query and I need to specify the CRS so that it works for "big polygons" so I have tired this:
 
            GeoJsonCoordinateReferenceSystem crs = new GeoJsonNamedCoordinateReferenceSystem("urn:x-mongodb:crs:strictwinding:EPSG:4326");
            GeoJsonObjectArgs<GeoJson2DGeographicCoordinates> args = new GeoJsonObjectArgs<GeoJson2DGeographicCoordinates>();
            args.CoordinateReferenceSystem = crs;
 
and use it in this call:
 
           IMongoQuery geoQuery = Query.Within<GeoJson2DGeographicCoordinates>(MongoItem.PolygonRegionProperty, new GeoJsonPolygon<GeoJson2DGeographicCoordinates>(args, new GeoJsonPolygonCoordinates<GeoJson2DGeographicCoordinates>(new GeoJsonLinearRingCoordinates<GeoJson2DGeographicCoordinates>(polygon.Select(i => new GeoJson2DGeographicCoordinates(i.Longitude, i.Latitude))))));
 
but this returns this:
 
"$geometry" : { "type" : "Polygon", "crs" : { "type" : "name", "properties" : 
 }, "coordinates" : [[[-34.353119999999997, -50.140853], [-34.353119999999997, 76.184997999999993], [146.24300500000001, 76.184997999999993], [146.24300500000001, -50.140853], [-34.353119999999997, -50.140853]]] } } }
 
whereas I need this:
 
        "$geometry" :{ 
            "type" : "Polygon", "coordinates" : [[[-34.353119999999997, -50.140853], [146.24300500000001, -50.140853], [146.24300500000001, 
 
76.184997999999993], [-34.353119999999997, 76.184997999999993], [-34.353119999999997, -50.140853]]],    
            crs: 
            } 
        }
 
i.e. the crs setting is in the wrong place and I cannot work out how to get it in the correct place. There is no way to set the CRS correctly using the within query.
- related to
 - 
                    
SERVER-38765 Geo within query requires custom crs to specify the larger of the two areas
-         
 - Closed
 
 -