Google Firestore Geopoint

Hi everyone,

I’d love to get your support with a workflow using Google Firestore. My workflow is feeding data from airtable to firestore, creating new documents. Everything works as it should but I am facing an issue with firestore geopoint datatype which isn’t a basic datatype. Firestore stores my latitude/longitude either as a string or as a map, whatever format I try. I m setting all data variables in a function item node. Reading the firestore documentation, I would need the sdk to set the data type to GeoPoint. Is it possible to use an external sdk in n8n cloud or do you know by chance how to transform the datatype correctly for Firestore?

Thanks in advance for your help.

Hey @NickKazal,

Welcome to the community :sparkling_heart:

Using external SDKs is currently not supported on the cloud. Can you share the code you’re using and the link to the documentation for Firestore? I’ll try to find a solution, and get back to you :slight_smile:

Hey @harshil1712,

thanks for the quick reply! :slightly_smiling_face:

This is the firestore api reference: https://firebase.google.com/docs/firestore/reference/rest/v1/projects.databases.documents/createDocument

And this is my code:

{
  "name": "Firestore Data Feed",
  "nodes": [
    {
      "parameters": {},
      "name": "Start",
      "type": "n8n-nodes-base.start",
      "typeVersion": 1,
      "position": [
        270,
        270
      ]
    },
    {
      "parameters": {
        "operation": "create",
        "projectId": "cluukflutterapp",
        "collection": "salons",
        "columns": "name,latlng"
      },
      "name": "Google Cloud Firestore",
      "type": "n8n-nodes-base.googleFirebaseCloudFirestore",
      "typeVersion": 1,
      "position": [
        1000,
        270
      ],
      "credentials": {
        "googleFirebaseCloudFirestoreOAuth2Api": "Firestore Creds"
      }
    },
    {
      "parameters": {
        "operation": "list",
        "application": "app2wBtSEGOw9EYfB",
        "table": "Salons1",
        "additionalOptions": {}
      },
      "name": "Airtable",
      "type": "n8n-nodes-base.airtable",
      "typeVersion": 1,
      "position": [
        520,
        270
      ],
      "credentials": {
        "airtableApi": "Airtable Creds New"
      }
    },
    {
      "parameters": {
        "functionCode": "item.name = item.fields.Name;\nitem.latlng = (item.fields.Lat,item.fields.Lng);\nreturn item;"
      },
      "name": "FunctionItem",
      "type": "n8n-nodes-base.functionItem",
      "typeVersion": 1,
      "position": [
        780,
        270
      ]
    }
  ],
  "connections": {
    "Start": {
      "main": [
        [
          {
            "node": "Airtable",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Airtable": {
      "main": [
        [
          {
            "node": "FunctionItem",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "FunctionItem": {
      "main": [
        [
          {
            "node": "Google Cloud Firestore",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {},
  "id": "1007"
}

Hey @NickKazal,

I took a look at the Firestore documentation, and the data-type they’re using for GeoPoint is double. Did you try converting the data to double?

If that doesn’t work out, maybe try looking for an API that you can use? I’ll continue to look into it, and get back to you if I find something more helpful :slight_smile: