MongoDB: "Malformed geo query" with $geoIntersect on a polygon - mongodb

I have events in a collection, each containing a desired location, set a GeoJSON Polygon.
I also have service providers in another collection, also with a GeoJSON Polygon, indicating the area where they can deliver.
For a given service provider, I'm trying to list all the events that are in a compatible area.
However, I get this error:
Malformed geo query: { $geoIntersects: { $geometry: { type: "Polygon", coordinates: [ [ [ -31.59327575763251, 115.8574693000001 ], [ -31.59676306691357, 115.9162469300458 ], [ -31.60715789289806, 115.9738935747774 ], ...
My Polygons are closed (first and last coords are identical), so that's not coming from there.
Here are the events:
Events:
[
{
"_id": "5237d4bd9899e67c0e000004",
"area": "area",
"authtoken": "e3bf38ff9a1f132a7cc86ea045cf3951",
"budget": 1800,
"creation_date": {
"sec": 1379390653,
"usec": 0
},
"description": "Banana banana banana banana banana banana banana banana bananaaaaaaaaaaaaaaaaa!!!",
"ends": {
"sec": 1383343200,
"usec": 0
},
"geo": {
"type": "Polygon",
"coordinates": [
[
[
-33.740154878816,
150.9241267
],
[
-33.741901642057,
150.95422987078
],
[
-33.747108144055,
150.98375074498
],
[
-33.755673663135,
151.01211808166
],
[
-33.767432456928,
151.03878255704
],
[
-33.782156913661,
151.0632272399
],
[
-33.799561885809,
151.08497749366
],
[
-33.819310129033,
151.10361012448
],
[
-33.841018749004,
151.11876160464
],
[
-33.819310129033,
150.74464327552
],
[
-33.799561885809,
150.76327590634
],
[
-33.782156913661,
150.7850261601
],
[
-33.767432456928,
150.80947084296
],
[
-33.755673663135,
150.83613531834
],
[
-33.747108144055,
150.86450265502
],
[
-33.741901642057,
150.89402352922
],
[
-33.740154878816,
150.9241267
]
]
]
},
"guests": 180,
"loc": {
"city": "Liverpool",
"state": "NSW",
"country": "AU",
"lat": -33.9200192,
"lng": 150.9241267,
"timezone": "Australia\/Sydney"
},
"name": "Bananaaaaaaaa!",
"services": [
{
"creation_date": {
"sec": 1379390661,
"usec": 0
},
"data": {
"name": "Bananaaaaaaaaaaa!!!!!",
"request": "Banana!",
"description": " banana banana banana banana banana banana banana banana banana",
"budget": "1400"
},
"event": "aaca6751-75b2-4cd9-a76a-99d4ee56fb6a",
"service": "a9fe4bd0-d4f2-4f2c-8b81-4899ac19c44f",
"uid": "0d92f274-67a3-4d2f-b1c8-d771fd84c113",
"uuid": "15ceedd5-608b-48e4-8a05-b60ee4c4c5bb",
"type": "Food & Drinks"
}
],
"starts": {
"sec": 1383300000,
"usec": 0
},
"type": {
"_id": "521666701e6accf7afc1a0e3",
"icon": "uploads\/event-types\/icon-3891a6f4-760f-43f2-ab3a-a51c61fd8d0d.png?rnd=0.6323562911552134",
"name": "Meeting",
"uuid": "3891a6f4-760f-43f2-ab3a-a51c61fd8d0d"
},
"uid": "0d92f274-67a3-4d2f-b1c8-d771fd84c113",
"uuid": "aaca6751-75b2-4cd9-a76a-99d4ee56fb6a",
"within": {
"km": 20,
"addr": "liverpool, nsw"
}
},
{
"_id": "5237d50a9899e67c0e000005",
"area": "area",
"authtoken": "e3bf38ff9a1f132a7cc86ea045cf3951",
"budget": 1800,
"creation_date": {
"sec": 1379390730,
"usec": 0
},
"description": "Boo!!!",
"ends": {
"sec": 1383285600,
"usec": 0
},
"geo": {
"type": "Polygon",
"coordinates": [
[
[
-32.086853059112,
116.0081156
],
[
-32.088163946126,
116.03027505189
],
[
-32.092071203806,
116.05200507521
],
[
-32.098499107954,
116.07288445521
],
[
-32.1073230624,
116.09250825588
],
[
-32.118371984525,
116.11049558927
],
[
-32.131431584032,
116.12649694645
],
[
-32.146248475035,
116.14020095399
],
[
-32.330851613336,
116.10195418015
],
[
-32.289125251893,
115.86992020233
],
[
-32.2721989398,
115.86018847275
],
[
-32.254291845681,
115.85334073219
],
[
-32.235752983166,
115.84950870874
],
[
-32.098499107954,
115.94334674479
],
[
-32.092071203806,
115.96422612479
],
[
-32.088163946126,
115.98595614811
],
[
-32.086853059112,
116.0081156
]
]
]
},
"guests": 700,
"loc": {
"city": "Byford",
"state": "WA",
"country": "AU",
"zipcode": "6122",
"lat": -32.2217513,
"lng": 116.0081156,
"timezone": "Australia\/Perth"
},
"name": "Halloween",
"services": [
{
"creation_date": {
"sec": 1379390749,
"usec": 0
},
"data": {
"name": "Badass lighting",
"description": "Boom! I want that!",
"type": [
"Furniture",
"Lighting\/lasers",
"LED screens",
"Dancefloor"
],
"budget": "800"
},
"event": "a6c28e98-b647-4224-8bff-f0b7e5c453c3",
"service": "4d4f370e-5780-4794-b988-df9d7a9ed644",
"uid": "0d92f274-67a3-4d2f-b1c8-d771fd84c113",
"uuid": "217c4896-a986-4c0a-a6c7-46c9aa74cf27",
"type": "Equipment Hire"
}
],
"starts": {
"sec": 1383256800,
"usec": 0
},
"type": {
"_id": "521666701e6accf7afc1a0e3",
"icon": "uploads\/event-types\/icon-3891a6f4-760f-43f2-ab3a-a51c61fd8d0d.png?rnd=0.6323562911552134",
"name": "Meeting",
"uuid": "3891a6f4-760f-43f2-ab3a-a51c61fd8d0d"
},
"uid": "0d92f274-67a3-4d2f-b1c8-d771fd84c113",
"uuid": "a6c28e98-b647-4224-8bff-f0b7e5c453c3",
"within": {
"km": 15,
"addr": "byford"
}
}
]
And here is my query object:
db.events.find({
"geo": {
"$geoIntersects": {
"$geometry": {
"type": "Polygon",
"coordinates": [
[
[
-31.593275757633,
115.8574693
],
[
-31.596763066914,
115.91624693005
],
[
-32.087153956437,
116.25114123685
],
[
-32.13233852915,
116.22535569049
],
[
-32.174036124673,
116.19236795072
],
[
-32.304841443191,
115.76898154226
],
[
-32.290955790481,
115.7119268346
],
[
-31.841206471153,
115.45474133646
],
[
-31.794742552646,
115.4770638401
],
[
-31.751364552714,
115.50675244396
],
[
-31.711911850434,
115.5432228167
],
[
-31.677146863424,
115.58576206658
],
[
-31.607157892898,
115.74104502522
],
[
-31.596763066914,
115.79869166995
],
[
-31.593275757633,
115.8574693
]
]
]
}
}
}
})
What am I missing?
My query seems to be identical to the official mongodb doc for geo queries.
Thanks in advance!

Your coordinates are specified as [latitude, longitude]. MongoDB requires that you specify coordinates in the opposite order for 2dsphere geometry: [longitude, latitude].
Your query worked for me once I swapped the coordinate order.

Related

can't able to store fhir resource in mongodb using asymmetrik mongodb fhir-core-server

i'm running node-fhir-server-mongo(Asymmetrik github repo)..when i put resource using PUT method and it stores in mongodb...everything works fine...but the data is partially stored...when i try to access the data i stored in database it only shows few pieces only...
below code is the data i want to store..
{
"resourceType": "Patient",
"id": "example3",
"text": {
"status": "generated",
},
"identifier": [
{
"use": "usual",
"type": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/v2-0203",
"code": "MR"
}
]
},
"system": "urn:oid:1.2.36.146.595.217.0.1",
"value": "12345",
"period": {
"start": "2001-05-06"
},
"assigner": {
"display": "Acme Healthcare"
}
}
],
"active": true,
"name": [
{
"use": "official",
"family": "Chalmers",
"given": [
"Peter",
"James"
]
},
{
"use": "usual",
"given": [
"Jim"
]
},
{
"use": "maiden",
"family": "Windsor",
"given": [
"Peter",
"James"
],
"period": {
"end": "2002"
}
}
],
"telecom": [
{
"use": "home"
},
{
"system": "phone",
"value": "(03) 5555 6473",
"use": "work",
"rank": 1
},
{
"system": "phone",
"value": "(03) 3410 5613",
"use": "mobile",
"rank": 2
},
{
"system": "phone",
"value": "(03) 5555 8834",
"use": "old",
"period": {
"end": "2014"
}
}
],
"gender": "male",
"birthDate": "1974-12-25",
"_birthDate": {
"extension": [
{
"url": "http://hl7.org/fhir/StructureDefinition/patient-birthTime",
"valueDateTime": "1974-12-25T14:35:45-05:00"
}
]
},
"deceasedBoolean": false,
"address": [
{
"use": "home",
"type": "both",
"text": "534 Erewhon St PeasantVille, Rainbow, Vic 3999",
"line": [
"534 Erewhon St"
],
"city": "PleasantVille",
"district": "Rainbow",
"state": "Vic",
"postalCode": "3999",
"period": {
"start": "1974-12-25"
}
}
],
"contact": [
{
"relationship": [
{
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/v2-0131",
"code": "N"
}
]
}
],
"name": {
"family": "du Marché",
"_family": {
"extension": [
{
"url": "http://hl7.org/fhir/StructureDefinition/humanname-own-prefix",
"valueString": "VV"
}
]
},
"given": [
"Bénédicte"
]
},
"telecom": [
{
"system": "phone",
"value": "+33 (237) 998327"
}
],
"address": {
"use": "home",
"type": "both",
"line": [
"534 Erewhon St"
],
"city": "PleasantVille",
"district": "Rainbow",
"state": "Vic",
"postalCode": "3999",
"period": {
"start": "1974-12-25"
}
},
"gender": "female",
"period": {
"start": "2012"
}
}
],
"managingOrganization": {
"reference": "Organization/1"
} }
and the actual data is stored on the mongodb is....
_id: "example3" id: "example3" meta: Object versionId: "1" lastUpdated: "2022-06-28T08:44:44+00:00" resourceType: "Patient"
if anyone know the answer or how to solve please let me know....thanks in advance!

How to find distinct values of fields using facet operation in mongodb

The filteredAccording part and the categorizedBy is working as expected using the query which I provided in the link but I am facing issues in the findDistinct part.
In mongodb I have the following data:
{
"_id": 10001,
"university": "SPYU",
"Courses": [
"English",
"French"
],
"dept": [
"Literature"
],
"type": [
"Autonomous"
],
"status": "ACTIVE",
"isMarked": true
},
{
"_id": 10002,
"university": "SPYU",
"Courses": [
"English",
"French"
],
"dept": [
"Literature"
],
"type": [
"Autonomous"
],
"status": "NON-ACTIVE",
"isMarked": true
}
I wanted the response to be:
"university": [
{
"name": "Literature",
"values": [
{
"_id": 10001,
"university": "SPYU",
"Courses": [
"English",
"French"
],
"dept": [
"Literature"
],
"type": [
"Autonomous"
],
"status": "ACTIVE",
"isMarked": true
},
{
"_id": 10002,
"university": "SPYU",
"Courses": [
"English",
"French"
],
"dept": [
"Literature"
],
"type": [
"Autonomous"
],
"status": "NON-ACTIVE",
"isMarked": true
}
]
}
],
"findDistinct": [
{​​​​​​​​
"name": "Courses",
"values": [
"English",
"French"
]
}​​​​​​​​,
{​​​​​​​​
"name": "Status",
"values": [
"ACTIVE",
"NON-ACTIVE"
]
}​​​​​​​​
]
I tried it using this link but the response is not coming as expected.
https://mongoplayground.net/p/XECZvRMmt3T
Right now, the response is coming like this
"universities": [
{
"name": "Literature",
"values": [
{
"_id": 10001,
"university": "SPYU",
"Courses": [
"English",
"French"
],
"dept": [
"Literature"
],
"type": [
"Autonomous"
],
"status": "ACTIVE",
"isMarked": true
},
{
"_id": 10002,
"university": "SPYU",
"Courses": [
"English",
"French"
],
"dept": [
"Literature"
],
"type": [
"Autonomous"
],
"status": "NON-ACTIVE",
"isMarked": true
}
]
}
],
"findDistinct": [
{​​​​​​​​
"Courses": [
"English",
"French"
]
}​​​​​​​​,
{​​​​​​​​
"status": [
"ACTIVE",
"NON-ACTIVE"
]
}​​​​​​​​
]
Any Help will be appreciated!!
Quick fixes in your query,
universities:
$addFields, remove $project and add only one operation for isMarked
$unwind deconstruct dept array
$group by dept and get values array of root
findDistinct:
$group by null and get unique courses array and status
$reduce to iterate loop of Courses nested array and get unique array using $setUnion
Make array of course and status in dest field
$unwind deconstruct dest array
$replaceRoot replace dest object to root
db.collection.aggregate([
{ $match: { university: "SPYU" }
},
{
$facet: {
universities: [
{ $addFields: { isMarked: { $in: ["French", "$Courses"] } } },
{ $unwind: "$dept" },
{
$group: {
_id: "$dept",
values: { $push: "$$ROOT" }
}
}
],
findDistinct: [
{
$group: {
_id: null,
Courses: { $addToSet: "$Courses" },
Status: { $addToSet: "$status" }
}
},
{
$project: {
_id: 0,
dist: [
{
name: "Courses",
values: {
$reduce: {
input: "$Courses",
initialValue: [],
in: { $setUnion: ["$$this", "$$value"] }
}
}
},
{
name: "Status",
values: "$Status"
}
]
}
},
{ $unwind: "$dist" },
{ $replaceRoot: { newRoot: "$dist" } }
]
}
}
])
Playground

Leaflet - Filtering GeoJSONs data using Selects values

I have a bus network with 2 GeoJSONs : one for stations (points) and the other for lines between them.
I have 3 selects :first one to select the bus line and filter the stations on the other two that are for origin and destination stations.
What I want to do is to dynamically filter the bus lines on the first select and the bus stations on the last two selects.
Something like this :
User selects L1 on first select > Map only shows Line 1 (both geojsons, points and lines) and hide the other Lines that were showing.
User selects Station x on select 2 and Station y on select 3 > Map only shows these stations and the ones in between (both geojsons, points and lines).
Stations GeoJSON (not complete) :
var station ={
"type": "FeatureCollection",
"name": "test",
"crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:OGC:1.3:CRS84" } },
"features": [
{ "type": "Feature", "properties": { "id": 0, "nom": "JAMAA EL FNA", "ligne": "L1", "ville": "MARRAKECH", "direction": "A" }, "geometry": { "type": "Point", "coordinates": [ -7.991506070410076, 31.624380871588261 ] } },
{ "type": "Feature", "properties": { "id": 1, "nom": "KOUTOUBIA", "ligne": "L1", "ville": "MARRAKECH", "direction": "A" }, "geometry": { "type": "Point", "coordinates": [ -7.993921192850516, 31.62551706188404 ] } },
{ "type": "Feature", "properties": { "id": 2, "nom": "HOTE DE VILLE", "ligne": "L1", "ville": "MARRAKECH", "direction": "A" }, "geometry": { "type": "Point", "coordinates": [ -7.997800602958748, 31.627492814514493 ] } },
{ "type": "Feature", "properties": { "id": 3, "nom": "R.P BERDII", "ligne": "L1", "ville": "MARRAKECH", "direction": "A" }, "geometry": { "type": "Point", "coordinates": [ -8.003733858117105, 31.630010280990067 ] } },
{ "type": "Feature", "properties": { "id": 4, "nom": "GRAND POSTE", "ligne": "L1", "ville": "MARRAKECH", "direction": "A" }, "geometry": { "type": "Point", "coordinates": [ -8.009040991276375, 31.633004916540266 ] } },
{ "type": "Feature", "properties": { "id": 5, "nom": "CAREE EDEN", "ligne": "L1", "ville": "MARRAKECH", "direction": "A" }, "geometry": { "type": "Point", "coordinates": [ -8.011327830139466, 31.634311225216251 ] } },....
Lines GeoJSON (not complete) :
var lignemarrakech = {
"type": "FeatureCollection",
"name": "ligne",
"crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:OGC:1.3:CRS84" } },
"features": [
{ "type": "Feature", "properties": { "id": 0, "ligne_bus": "L1", "direction": "A", "from_st": null, "to_st": null, "ville": "MARRAKECH" }, "geometry": { "type": "LineString", "coordinates": [ [ -7.991506070410076, 31.624380871588261 ], [ -7.99177772113954, 31.62455510452893 ], [ -7.992132146977649, 31.624680377597475 ], [ -7.992359514496435, 31.624737319845583 ], [ -7.992653754814866, 31.624862592668791 ], [ -7.993295733691442, 31.625147303003317 ], [ -7.993583286729908, 31.625306740410121 ], [ -7.993921192850516, 31.62551706188404 ] ] } },
{ "type": "Feature", "properties": { "id": 1, "ligne_bus": "L1", "direction": "A", "from_st": null, "to_st": null, "ville": "MARRAKECH" }, "geometry": { "type": "LineString", "coordinates": [ [ -7.993929771507931, 31.625520494421043 ], [ -7.993921192850516, 31.62551706188404 ], [ -7.994251765813826, 31.625734485234361 ], [ -7.994613027718003, 31.625968537122866 ], [ -7.994699416434219, 31.626022034614714 ], [ -7.995311990967388, 31.626396516196305 ], [ -7.995618278233972, 31.626550320694935 ], [ -7.995971686618494, 31.626730873477591 ], [ -7.99655284707304, 31.627018419778416 ], [ -7.997188982165176, 31.627279216817595 ], [ -7.997597365187289, 31.627433019856959 ], [ -7.997800602958748, 31.627492814514493 ] ] } },
{ "type": "Feature", "properties": { "id": 2, "ligne_bus": "L1", "direction": "A", "from_st": null, "to_st": null, "ville": "MARRAKECH" }, "geometry": { "type": "LineString", "coordinates": [ [ -7.997800602958748, 31.627492814514493 ], [ -7.998131404523898, 31.627586822642048 ], [ -7.998704711458787, 31.62774731223368 ], [ -7.999246604315053, 31.627847618087841 ], [ -7.999898446446502, 31.627981359058502 ], [ -8.000487460420704, 31.628188657183067 ], [ -8.001194277189745, 31.628529695028082 ], [ -8.001987482675004, 31.628984410209988 ], [ -8.00258435016886, 31.629345505977 ], [ -8.002796395199573, 31.629499305600273 ], [ -8.002835662797853, 31.629606296492579 ], [ -8.002859223356822, 31.629659791892589 ], [ -8.002906344474757, 31.629686539581062 ], [ -8.002984879671317, 31.629726661099347 ], [ -8.00307912190719, 31.629733348017368 ], [ -8.003181217662718, 31.629726661099347 ], [ -8.003401116213087, 31.629820277908031 ], [ -8.003733858117105, 31.630010280990067 ] ] } },...
This is what I could do for the first select :
$('#selectLine').on('change', function() {
console.log("chosen_line= " + this.value);
chosen_line = this.value;
filterLines();
if (chosen_line= 'L1'){
L.geoJSON(lignemarrakech, {
filter: function(feature, layer) {
return feature.properties.ligne='L1';
}
}).addTo(mymap);
}
else{
}
});
Beside the fact that it's not generalised, it doesn't work as intended (show only L1 when L1 is selected), it just display all the lines again on top.
if (chosen_line= 'L1')
should be
if (chosen_line == 'L1')

Getting Lifetime Values from Google Analytics API

Google Analytics API documentation shows that, for fetching the lifetime values, the date ranges should not be specified. But when I make such a request (without date range), it returns empty dimension and metrics result. But when I use date range, it returns dimension and metrics values for that date range.
The following is an excerpt from the API documentation :
Date ranges should not be specified for cohorts or Lifetime value
requests.
For example, if I make the request without date range, as follows:
{
"reportRequests": [
{
"viewId": "XXXXXXXXX",
"dimensions": [
{
"name": "ga:date"
},
{
"name": "ga:eventLabel"
}
],
"metrics": [
{
"expression": "ga:totalEvents"
}
]
}
]
}
I get the following response:
{
"reports": [
{
"columnHeader": {
"dimensions": [
"ga:date",
"ga:eventLabel"
],
"metricHeader": {
"metricHeaderEntries": [
{
"name": "ga:totalEvents",
"type": "INTEGER"
}
]
}
},
"data": {
"totals": [
{
"values": [
"0"
]
}
]
}
}
]
}
However, if I include the date range,
{
"reportRequests": [
{
"viewId": "XXXXXXXX",
"dimensions": [
{
"name": "ga:date"
},
{
"name": "ga:eventLabel"
}
],
"metrics": [
{
"expression": "ga:totalEvents"
}
],
"dateRanges": [
{
"startDate": "2016-01-01",
"endDate": "2016-04-30"
}
]
}
]
}
I get the following response:
{
"reports": [
{
"columnHeader": {
"dimensions": [
"ga:date",
"ga:eventLabel"
],
"metricHeader": {
"metricHeaderEntries": [
{
"name": "ga:totalEvents",
"type": "INTEGER"
}
]
}
},
"data": {
"rows": [
{
"dimensions": [
"20160412",
"http://mytestblog.com/"
],
"metrics": [
{
"values": [
"1"
]
}
]
},
{
"dimensions": [
"20160412",
"http://mytestblog.com/2016/04/first-post.html"
],
"metrics": [
{
"values": [
"3"
]
}
]
},
{
"dimensions": [
"20160419",
"http://mytestblog.com/"
],
"metrics": [
{
"values": [
"4"
]
}
]
},
{
"dimensions": [
"20160419",
"http://mytestblog.com/2016/04/fourth.html"
],
"metrics": [
{
"values": [
"13"
]
}
]
}
],
"totals": [
{
"values": [
"21"
]
}
],
"rowCount": 4,
"minimums": [
{
"values": [
"1"
]
}
],
"maximums": [
{
"values": [
"13"
]
}
]
}
}
]
}
Why is it that, even though specified in the documentation, I have to specify date range in the ReportRequest to get the values? Am I misunderstanding the meaning of Lifetime values here?
The reportRequest object should have either a value for dateRanges or a definition value for cohortGroup. When you omit both the requests assumes the default values for a startDate of 7daysAgo and an endDate of yesterday.
The correct interpretation of the docs is that the reportRequest should not have a dateRange defined for cohort and LTV requests. But in order to make a cohort or lifetime value request you must add a cohort definition. For Lifetime value requests the cohort definition should have a specific dateRange in addition to the lifetimeValue field set to true:
POST https://analyticsreporting.googleapis.com/v4/reports:batchGet
{
"reportRequests": [
{
"viewId": "XXXX",
"dimensions": [
{"name": "ga:cohort" },
{"name": "ga:cohortNthWeek" }],
"metrics": [
{"expression": "ga:cohortTotalUsersWithLifetimeCriteria"},
{"expression": "ga:cohortRevenuePerUser"}
],
"cohortGroup": {
"cohorts": [{
"name": "cohort 1",
"type": "FIRST_VISIT_DATE",
"dateRange": {
"startDate": "2015-08-01",
"endDate": "2015-09-01"
}
},
{
"name": "cohort 2",
"type": "FIRST_VISIT_DATE",
"dateRange": {
"startDate": "2015-07-01",
"end_date": "2015-08-01"
}
}],
"lifetimeValue": True
}
}]
}

Importing GeoJSON into MongoDB

I'm just trying out some stuff with GeoJSON's by figuring out how to import them into MongoDB. Here is a snippet of the JSON data that I'm trying to import:
{
"type": "FeatureCollection",
"crs": {
"type": "name",
"properties": {
"name": "urn:ogc:def:crs:OGC:1.3:CRS84"
}
},
"source": "© GeoBasis-DE / BKG 2013 (Daten verändert)",
"features": [
{
"type": "Feature",
"properties": {
"RS": "051580004004",
"DES": "Stadt",
"GEN": "Erkrath",
"EWZ_M": 20929,
"EWZ_W": 22883,
"SHAPE_AREA": 26441754.911268
},
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
6.88238674728364,
51.24166234476658
],
[
6.881975279589705,
51.23757802188462
],
[
6.891756626701045,
51.23929422878399
],
[
6.903180857084263,
51.23707789012778
],
[
6.908259412237354,
51.24206723420193
],
[
6.918977412277895,
51.24041847413137
],
[
6.926662904165135,
51.24253596694298
],
[
6.937590326994132,
51.23093391057761
],
[
6.94295724765998,
51.2299892278866
],
[
6.939417113978845,
51.227341409094315
],
[
6.951333593915336,
51.22740615125517
],
[
6.950253526637431,
51.224656373607054
],
[
6.955765647972802,
51.22167757046095
],
[
6.964606469495985,
51.22457614378809
],
[
6.975480633820623,
51.223046741435965
],
[
6.973404761769492,
51.22089502422256
],
[
6.980214287180364,
51.21998473062592
],
[
6.982741542191386,
51.214167748907066
],
[
6.994804384322499,
51.215655729126155
],
[
6.994747626413055,
51.21224925095131
],
[
6.985928005605313,
51.20743852466108
],
[
6.98828820437737,
51.20347146797952
],
[
6.944606700602787,
51.198908942197114
],
[
6.943253716046289,
51.19637267292547
],
[
6.937329237188316,
51.19846226521679
],
[
6.932905519738434,
51.194111787062006
],
[
6.907388585403191,
51.19594285093562
],
[
6.903803051706552,
51.20313804926765
],
[
6.910551758112292,
51.21099091708282
],
[
6.878932812936605,
51.21491884904021
],
[
6.872564112818471,
51.219486802570856
],
[
6.873244797535404,
51.226155851357795
],
[
6.878496898776498,
51.22869664243089
],
[
6.872981880136851,
51.232966792978665
],
[
6.871618163754948,
51.24209470504303
],
[
6.88238674728364,
51.24166234476658
]
]
]
}
},
{
"type": "Feature",
"properties": {
"RS": "051160000000",
"DES": "Stadt",
"GEN": "Mönchengladbach",
"EWZ_M": 123662,
"EWZ_W": 131172,
"SHAPE_AREA": 170540962.920759
},
"geometry": {
"type": "Polygon",
"coordinates": [
[
.....
.....
I want now to import this data into my MongoDB instance. When I tried the following, I ran into some errors:
mongoimport --db /Users/joe/mongodb-data -c points --file "gemeinden_simplify200.geojson" --jsonArray
connected to: 127.0.0.1
assertion: 13106 nextSafe(): { $err: "Invalid ns [/Users/joe/mongodb-data.points]", code: 16256 }
I think you need to try-
mongoimport --db test -c points --file "gemeinden_simplify200.geojson" --jsonArray
Here test is database name.