1

I convert the geojson Feature geometry into a geoJsonPolygon for Mongo, and the result is a
however, i keep getting the error:

 message='location object expected, location array not in correct format', details={}}, BulkWriteError{index=1, code=16804, message='location object expected, location array not in correct format'
 

Below is the content of the GeoJsonPolygon I am saving:

   {
"index": 645227130288087715,
"name": [
    "abanda"
],
"polygon": "Polygon: [Point [x=-85.516685, y=33.102539],Point [x=-85.516685, y=33.102539],Point [x=-85.516953, y=33.102458],Point [x=-85.517482, y=33.102458],Point [x=-85.518043, y=33.102524],Point [x=-85.518494, y=33.102607],Point [x=-85.518657, y=33.102612],Point [x=-85.519069, y=33.102569],Point [x=-85.519663, y=33.102463],Point [x=-85.519872, y=33.102530],Point [x=-85.520107, y=33.102497],Point [x=-85.520591, y=33.102338],Point [x=-85.521009, y=33.102173],Point [x=-85.521355, y=33.101992],Point [x=-85.521473, y=33.101882],Point [x=-85.521675, y=33.101568],Point [x=-85.521885, y=33.100991],Point [x=-85.522061, y=33.100612],Point [x=-85.522264, y=33.100277],Point [x=-85.522460, y=33.100068],Point [x=-85.522532, y=33.099947],Point [x=-85.522800, y=33.099013],Point [x=-85.522826, y=33.098804],Point [x=-85.522925, y=33.098584],Point [x=-85.523036, y=33.098425],Point [x=-85.523565, y=33.097886],Point [x=-85.523905, y=33.097583],Point [x=-85.523810, y=33.097547],Point [x=-85.523838, y=33.097513],Point [x=-85.523755, y=33.097462],Point [x=-85.523546, y=33.097380],Point [x=-85.523317, y=33.097430],Point [x=-85.523154, y=33.097507],Point [x=-85.522618, y=33.097847],Point [x=-85.522298, y=33.097979],Point [x=-85.521991, y=33.098039],Point [x=-85.521788, y=33.098106],Point [x=-85.521364, y=33.098391],Point [x=-85.520678, y=33.098748],Point [x=-85.520508, y=33.098824],Point [x=-85.520397, y=33.098802],Point [x=-85.520299, y=33.098681],Point [x=-85.520286, y=33.098666],Point [x=-85.520214, y=33.098325],Point [x=-85.520155, y=33.098187],Point [x=-85.520103, y=33.098149],Point [x=-85.519933, y=33.098104],Point [x=-85.519711, y=33.098104],Point [x=-85.519541, y=33.098050],Point [x=-85.519241, y=33.097808],Point [x=-85.519039, y=33.097681],Point [x=-85.518712, y=33.097555],Point [x=-85.518477, y=33.097505],Point [x=-85.518314, y=33.097423],Point [x=-85.517929, y=33.097290],Point [x=-85.517602, y=33.097125],Point [x=-85.517204, y=33.096977],Point [x=-85.516975, y=33.096922],Point [x=-85.516799, y=33.096812],Point [x=-85.516512, y=33.096564],Point [x=-85.516309, y=33.096504],Point [x=-85.515983, y=33.096289],Point [x=-85.515813, y=33.096091],Point [x=-85.515630, y=33.095585],Point [x=-85.515507, y=33.095332],Point [x=-85.515252, y=33.095067],Point [x=-85.515128, y=33.095008],Point [x=-85.514939, y=33.094952],Point [x=-85.514749, y=33.094831],Point [x=-85.513999, y=33.093989],Point [x=-85.513509, y=33.093517],Point [x=-85.512896, y=33.092698],Point [x=-85.512804, y=33.092440],Point [x=-85.512667, y=33.092301],Point [x=-85.512413, y=33.092219],Point [x=-85.512328, y=33.092165],Point [x=-85.511864, y=33.091714],Point [x=-85.511518, y=33.091461],Point [x=-85.511251, y=33.091219],Point [x=-85.511094, y=33.091020],Point [x=-85.510390, y=33.089882],Point [x=-85.509743, y=33.088997],Point [x=-85.509182, y=33.088326],Point [x=-85.508667, y=33.087781],Point [x=-85.508243, y=33.087380],Point [x=-85.507916, y=33.087033],Point [x=-85.507538, y=33.086554],Point [x=-85.507362, y=33.086269],Point [x=-85.507297, y=33.086033],Point [x=-85.507323, y=33.085850],Point [x=-85.507552, y=33.085372],Point [x=-85.507624, y=33.085109],Point [x=-85.507604, y=33.084944],Point [x=-85.507356, y=33.084383],Point [x=-85.507278, y=33.084114],Point [x=-85.507259, y=33.083927],Point [x=-85.507298, y=33.083399],Point [x=-85.507266, y=33.083163],Point [x=-85.507248, y=33.083115],Point [x=-85.507658, y=33.083087],Point [x=-85.507984, y=33.083056],Point [x=-85.508146, y=33.083036],Point [x=-85.508306, y=33.083011],Point [x=-85.508622, y=33.082949],Point [x=-85.508933, y=33.082870],Point [x=-85.509242, y=33.082782],Point [x=-85.509547, y=33.082682],Point [x=-85.510144, y=33.082462],Point [x=-85.511181, y=33.082064],Point [x=-85.511482, y=33.081957],Point [x=-85.511636, y=33.081907],Point [x=-85.512103, y=33.081778],Point [x=-85.512419, y=33.081699],Point [x=-85.512738, y=33.081631],Point [x=-85.513219, y=33.081547],Point [x=-85.513708, y=33.081485],Point [x=-85.515217, y=33.081308],Point [x=-85.515574, y=33.081277],Point [x=-85.515604, y=33.080914],Point [x=-85.515614, y=33.080361],Point [x=-85.515611, y=33.080229],Point [x=-85.515616, y=33.079954],Point [x=-85.515613, y=33.079811],Point [x=-85.515618, y=33.079602],Point [x=-85.515610, y=33.079396],Point [x=-85.515620, y=33.079256],Point [x=-85.515625, y=33.076960],Point [x=-85.515667, y=33.076853],Point [x=-85.515782, y=33.076675],Point [x=-85.515922, y=33.076487],Point [x=-85.516071, y=33.076318],Point [x=-85.516124, y=33.076265],Point [x=-85.516237, y=33.076165],Point [x=-85.516422, y=33.076029],Point [x=-85.516555, y=33.075946],Point [x=-85.516693, y=33.075871],Point [x=-85.516834, y=33.075805],Point [x=-85.517127, y=33.075687],Point [x=-85.517583, y=33.075526],Point [x=-85.517964, y=33.075398],Point [x=-85.518871, y=33.075080],Point [x=-85.519470, y=33.074861],Point [x=-85.519624, y=33.074810],Point [x=-85.519783, y=33.074765],Point [x=-85.519875, y=33.074745],Point [x=-85.519943, y=33.074731],Point [x=-85.520107, y=33.074706],Point [x=-85.520273, y=33.074695],Point [x=-85.520602, y=33.074694],Point [x=-85.521379, y=33.074734],Point [x=-85.521541, y=33.074739],Point [x=-85.521700, y=33.074738],Point [x=-85.521861, y=33.074728],Point [x=-85.522023, y=33.074714],Point [x=-85.522186, y=33.074694],Point [x=-85.522349, y=33.074666],Point [x=-85.522507, y=33.074633],Point [x=-85.522666, y=33.074593],Point [x=-85.523132, y=33.074458],Point [x=-85.523446, y=33.074379],Point [x=-85.523761, y=33.074315],Point [x=-85.523925, y=33.074294],Point [x=-85.524089, y=33.074280],Point [x=-85.524126, y=33.074278],Point [x=-85.524416, y=33.074270],Point [x=-85.524580, y=33.074269],Point [x=-85.526698, y=33.074309],Point [x=-85.527026, y=33.074317],Point [x=-85.527188, y=33.074326],Point [x=-85.527351, y=33.074342],Point [x=-85.527510, y=33.074365],Point [x=-85.527671, y=33.074396],Point [x=-85.527829, y=33.074437],Point [x=-85.528135, y=33.074534],Point [x=-85.528440, y=33.074638],Point [x=-85.528787, y=33.074742],Point [x=-85.528948, y=33.074776],Point [x=-85.529071, y=33.074795],Point [x=-85.529234, y=33.074798],Point [x=-85.529398, y=33.074785],Point [x=-85.529560, y=33.074765],Point [x=-85.529878, y=33.074708],Point [x=-85.530923, y=33.074506],Point [x=-85.531076, y=33.074474],Point [x=-85.531232, y=33.074432],Point [x=-85.532025, y=33.074160],Point [x=-85.532482, y=33.074019],Point [x=-85.532798, y=33.073940],Point [x=-85.532957, y=33.073909],Point [x=-85.533122, y=33.073881],Point [x=-85.533288, y=33.073863],Point [x=-85.533460, y=33.073853],Point [x=-85.533548, y=33.073853],Point [x=-85.533635, y=33.073844],Point [x=-85.534164, y=33.073869],Point [x=-85.534144, y=33.074019],Point [x=-85.533936, y=33.074817],Point [x=-85.533678, y=33.075896],Point [x=-85.533603, y=33.076166],Point [x=-85.533560, y=33.076299],Point [x=-85.533512, y=33.076428],Point [x=-85.533400, y=33.076687],Point [x=-85.533333, y=33.076813],Point [x=-85.533107, y=33.077180],Point [x=-85.532725, y=33.077784],Point [x=-85.532402, y=33.078269],Point [x=-85.532313, y=33.078387],Point [x=-85.532122, y=33.078620],Point [x=-85.531923, y=33.078845],Point [x=-85.531603, y=33.079167],Point [x=-85.531275, y=33.079470],Point [x=-85.530994, y=33.079711],Point [x=-85.530645, y=33.079988],Point [x=-85.529777, y=33.080654],Point [x=-85.529702, y=33.080711],Point [x=-85.529588, y=33.080806],Point [x=-85.529480, y=33.080905],Point [x=-85.529377, y=33.081010],Point [x=-85.529283, y=33.081117],Point [x=-85.529194, y=33.081231],Point [x=-85.529030, y=33.081466],Point [x=-85.528957, y=33.081587],Point [x=-85.528893, y=33.081710],Point [x=-85.528837, y=33.081839],Point [x=-85.528789, y=33.081970],Point [x=-85.528630, y=33.082499],Point [x=-85.528484, y=33.083032],Point [x=-85.528453, y=33.083166],Point [x=-85.528428, y=33.083298],Point [x=-85.528419, y=33.083357],Point [x=-85.528600, y=33.083357],Point [x=-85.528757, y=33.083391],Point [x=-85.529044, y=33.083556],Point [x=-85.529260, y=33.083726],Point [x=-85.529586, y=33.083858],Point [x=-85.529860, y=33.083837],Point [x=-85.529997, y=33.083782],Point [x=-85.530252, y=33.083776],Point [x=-85.530605, y=33.084325],Point [x=-85.530840, y=33.084634],Point [x=-85.530983, y=33.084766],Point [x=-85.532015, y=33.085639],Point [x=-85.533777, y=33.086944],Point [x=-85.534300, y=33.087367],Point [x=-85.534358, y=33.087473],Point [x=-85.534513, y=33.087412],Point [x=-85.534659, y=33.087336],Point [x=-85.534785, y=33.087241],Point [x=-85.534963, y=33.087141],Point [x=-85.535003, y=33.087128],Point [x=-85.535216, y=33.087150],Point [x=-85.535340, y=33.087179],Point [x=-85.535478, y=33.087263],Point [x=-85.535872, y=33.087539],Point [x=-85.535979, y=33.087600],Point [x=-85.536270, y=33.087750],Point [x=-85.536314, y=33.087767],Point [x=-85.536272, y=33.087873],Point [x=-85.536050, y=33.087978],Point [x=-85.535690, y=33.088242],Point [x=-85.535599, y=33.088324],Point [x=-85.535514, y=33.088472],Point [x=-85.535553, y=33.088654],Point [x=-85.535645, y=33.088769],Point [x=-85.536023, y=33.089121],Point [x=-85.536062, y=33.089193],Point [x=-85.536115, y=33.089340],Point [x=-85.536062, y=33.089567],Point [x=-85.536023, y=33.089616],Point [x=-85.536017, y=33.089677],Point [x=-85.536134, y=33.089917],Point [x=-85.536134, y=33.090012],Point [x=-85.536114, y=33.090166],Point [x=-85.535957, y=33.090643],Point [x=-85.535964, y=33.090891],Point [x=-85.536023, y=33.091006],Point [x=-85.536251, y=33.091248],Point [x=-85.536819, y=33.091562],Point [x=-85.537035, y=33.091738],Point [x=-85.537165, y=33.092002],Point [x=-85.537178, y=33.092095],Point [x=-85.537119, y=33.092695],Point [x=-85.537152, y=33.092942],Point [x=-85.537250, y=33.093179],Point [x=-85.537459, y=33.093448],Point [x=-85.537700, y=33.093668],Point [x=-85.537824, y=33.093811],Point [x=-85.538066, y=33.094253],Point [x=-85.538203, y=33.094504],Point [x=-85.538333, y=33.094625],Point [x=-85.538549, y=33.094757],Point [x=-85.538738, y=33.094949],Point [x=-85.539156, y=33.095747],Point [x=-85.539620, y=33.096477],Point [x=-85.540096, y=33.097499],Point [x=-85.540148, y=33.097566],Point [x=-85.540442, y=33.097792],Point [x=-85.540645, y=33.098039],Point [x=-85.540736, y=33.098188],Point [x=-85.540886, y=33.098599],Point [x=-85.540886, y=33.098776],Point [x=-85.540835, y=33.099083],Point [x=-85.540821, y=33.099172],Point [x=-85.540840, y=33.099308],Point [x=-85.541238, y=33.100248],Point [x=-85.541258, y=33.100898],Point [x=-85.541349, y=33.101058],Point [x=-85.541734, y=33.101503],Point [x=-85.541884, y=33.101799],Point [x=-85.541943, y=33.102383],Point [x=-85.541936, y=33.102960],Point [x=-85.542015, y=33.103268],Point [x=-85.542028, y=33.103702],Point [x=-85.541923, y=33.103867],Point [x=-85.541805, y=33.104598],Point [x=-85.541531, y=33.105086],Point [x=-85.541485, y=33.105230],Point [x=-85.541452, y=33.105351],Point [x=-85.541446, y=33.105587],Point [x=-85.541459, y=33.105764],Point [x=-85.541570, y=33.106153],Point [x=-85.541674, y=33.106346],Point [x=-85.541720, y=33.106577],Point [x=-85.541752, y=33.106594],Point [x=-85.541772, y=33.106830],Point [x=-85.541715, y=33.107017],Point [x=-85.541635, y=33.107281],Point [x=-85.541576, y=33.107681],Point [x=-85.541556, y=33.107704],Point [x=-85.541510, y=33.107930],Point [x=-85.541499, y=33.108095],Point [x=-85.538605, y=33.108137],Point [x=-85.532988, y=33.108239],Point [x=-85.531654, y=33.108261],Point [x=-85.530822, y=33.108276],Point [x=-85.530649, y=33.108279],Point [x=-85.530341, y=33.108285],Point [x=-85.526011, y=33.108449],Point [x=-85.525727, y=33.108451],Point [x=-85.524988, y=33.108454],Point [x=-85.519749, y=33.108660],Point [x=-85.514376, y=33.108672],Point [x=-85.514369, y=33.108537],Point [x=-85.514180, y=33.108190],Point [x=-85.513964, y=33.107954],Point [x=-85.513892, y=33.107839],Point [x=-85.513834, y=33.107646],Point [x=-85.513848, y=33.106536],Point [x=-85.513887, y=33.106277],Point [x=-85.513992, y=33.105947],Point [x=-85.513952, y=33.105877],Point [x=-85.513861, y=33.105722],Point [x=-85.513874, y=33.105463],Point [x=-85.513835, y=33.105013],Point [x=-85.513783, y=33.104870],Point [x=-85.513633, y=33.104655],Point [x=-85.513594, y=33.104512],Point [x=-85.513588, y=33.104408],Point [x=-85.513679, y=33.104166],Point [x=-85.513875, y=33.104089],Point [x=-85.514084, y=33.103968],Point [x=-85.514600, y=33.103595],Point [x=-85.516685, y=33.102539]]",
"state": "al"

}

Original feature: GeoJson Feature of Abanda https://gist.github.com/boundaries-io/bfb3fe947499e279b0e2f9e163fd4202 enter image description here

2 Answers 2

1

MongoDB expects a well-formatted GeoJSON geometry as per RFC 7946 - not sure if your attempted format is a legacy one of some sort?

Example on Humongous MongoDB Playground

0

I ended up using the GeoJsonModule that comes with Spring-Data-mongo.

ObjectMapper mapper = new ObjectMapper();
            mapper.registerModule(GeoJsonModule.serializers());
            mapper.registerModule(GeoJsonModule.deserializers());

    String langleyWa = FileUtils.readFileToString(new File("src/test/resources/langley-polygon.geojson"));
        GeoJsonPolygon geoJsonPolygon =   mapper.readValue(langleyWa, GeoJsonPolygon.class);
    

Now I can save into Mongodb with no issues for a GeoJsonPolygon.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.