gospodarka-przestrzenna / MongoConnector

Qgis mongodb plugin
GNU General Public License v2.0
10 stars 5 forks source link

Don't take account geometry field #11

Closed Vonisoa closed 4 years ago

Vonisoa commented 4 years ago

Hi all, I am new to mongoconnector. I've just installed this plugin and when I try to load layer, I choose the geometry field of my data. But I think that it only read the _id of the data cause it always give me this error: Error: Unknown geometry in object 5f621b1ff3a79411f03cc26b

where 5f621b1ff3a79411f03cc26bis the _id of the first line in my data.

mk45 commented 4 years ago

Can you share the record?

Vonisoa commented 4 years ago

Here is the first line

{ "_id": { "$oid": "5f621b1ff3a79411f03cc26b" }, "post": "as andry added a new photo to the album sary fahiny3 , "time": "2020-07-06 7:25:30", "topic": "First", "location": "Alasora", "FOKONTANY": "Alasora", "P_CODE": "MDG11102010001", "F_CODE": "001", "COMMUNE": "Alasora", "COM_PCODE": "MDG11102010", "C_CODE": "102010", "DISTRICT": "Antananarivo Avaradrano", "DIST_PCODE": "MDG11102", "D_CODE": "102", "REGION": "Analamanga", "REG_PCODE": "MDG11", "R_CODE": "11", "SOURCE": "BNGRC", "x": "5295288.749955864", "y": "-2149661.5232557207", "geometry": "POINT (5295288.749955864 -2149661.523255721)" }

mk45 commented 4 years ago

Field "geometry" is in WKT format. This type of geometry is not yet supported as geojson geometry format seems to be more natural in mongo as all documents are JSON. You should have something like: "geometry": { "type": "Point", "coordinates": [5295288.749955864, -2149661.523255721]} As an alternative MongoConnector supports simple (raw) geometry notation (require option geojson geometry unchecked) ex: "geometry": [5295288.749955864, -2149661.523255721] You must change this in your documents to work.

Vonisoa commented 4 years ago

thanks, I will try.

Vonisoa commented 4 years ago

My data on mongo is now like this but I still get the error "_id": { "$oid": "5f64c51d2334a22578d65920" }, "x": "5295288.749955864", "y": "-2149661.5232557207", "geometry": "[5295288.749955864, -2149661.5232557207]" }

Here is the error: Error: Unknown geometry in object 5f64c51d2334a22578d65920

mk45 commented 4 years ago

"geometry": "[5295288.749955864, -2149661.5232557207]" "[ .. ]" watch out quotations! this a text, not an object.

Vonisoa commented 4 years ago

Thank you, when I use a csv format to load on mongo, it takes the geometry as string. But when using a json format, everything is OK.