Skip to content
This repository has been archived by the owner on Mar 25, 2022. It is now read-only.

How to insert GeoJSON object with multiple features into PostgreSQL using pg-format #31

Open
1Map opened this issue Nov 16, 2021 · 0 comments

Comments

@1Map
Copy link

1Map commented Nov 16, 2021

I Have following geojson object with 2 features: My question is: How do I go about inserting this 2 features in a Postgresql Table with pg-format?

{
  "type": "FeatureCollection",
  "crs": {
    "type": "name",
    "properties": {
      "name": "EPSG:4326"
    }
  },
  "features": [
    {
      "type": "Feature",
      "id": 6195898,
      "geometry": {
        "type": "Polygon",
        "coordinates": [
          [
            [
              19.75889040800007,
              -31.466254463
            ],
            [
              19.75889586500006,
              -31.46648844699997
            ],
            [
              19.759105202000057,
              -31.46648545899996
            ],
            [
              19.759100205000035,
              -31.466250463999966
            ],
            [
              19.75889040800007,
              -31.466254463
            ]
          ]
        ]
      },
      "properties": {
        "OBJECTID": 6195898,
        "GID": 2168525,
        "PRCL_KEY": "N065C015000200003929000001",
        "PRCL_TYPE": "E",
        "LSTATUS": "R",
        "WSTATUS": "C",
        "GEOM_AREA": 518.0799,
        "COMMENTS": " ",
        "TAG_X": 19.758913,
        "TAG_Y": -31.46638,
        "TAG_VALUE": "RE/3929",
        "TAG_SIZE": 0.000026,
        "TAG_ANGLE": 0.002022,
        "TAG_JUST": "L",
        "ID": "C01500020000392900000",
        "DATE_STAMP": 1517529600000,
        "DATE_PROCESSED": 1635015671000,
        "SHAPE_Length": 0.000888289181740557,
        "SHAPE_Area": 4.915952156191992e-8,
        "PROVINCE": "NORTHERN CAPE",
        "MAJ_REGION": "CALVINIA",
        "MAJ_CODE": "C0150000",
        "MIN_REGION": "CALVINIA",
        "MIN_CODE": "C0150002",
        "PARCEL_NO": 3929,
        "PORTION": 0,
        "SS_NAME": " ",
        "DSG_NO": " ",
        "SR_NO": " ",
        "SS_NO": " "
      }
    },
    {
      "type": "Feature",
      "id": 6195899,
      "geometry": {
        "type": "Polygon",
        "coordinates": [
          [
            [
              23.068871573000024,
              -28.336274698999947
            ],
            [
              23.069115587000056,
              -28.336471700999937
            ],
            [
              23.069310598000072,
              -28.336282697999923
            ],
            [
              23.069308603000028,
              -28.336240698999973
            ],
            [
              23.069092589000036,
              -28.33606670399996
            ],
            [
              23.068871573000024,
              -28.336274698999947
            ]
          ]
        ]
      },
      "properties": {
        "OBJECTID": 6195899,
        "GID": 2168614,
        "PRCL_KEY": "N085C031000300000638000000",
        "PRCL_TYPE": "E",
        "LSTATUS": "R",
        "WSTATUS": "C",
        "GEOM_AREA": 1013.394276,
        "COMMENTS": " ",
        "TAG_X": 23.069061,
        "TAG_Y": -28.336332,
        "TAG_VALUE": "638",
        "TAG_SIZE": 0.000031,
        "TAG_ANGLE": 6.269028,
        "TAG_JUST": "L",
        "ID": "C03100030000063800000",
        "DATE_STAMP": 1591315200000,
        "DATE_PROCESSED": 1635015671000,
        "SHAPE_Length": 0.0012081009337222054,
        "SHAPE_Area": 9.317254943786774e-8,
        "PROVINCE": "NORTHERN CAPE",
        "MAJ_REGION": "HAY",
        "MAJ_CODE": "C0310000",
        "MIN_REGION": "POSTMASBURG",
        "MIN_CODE": "C0310003",
        "PARCEL_NO": 638,
        "PORTION": 0,
        "SS_NAME": " ",
        "DSG_NO": " ",
        "SR_NO": " ",
        "SS_NO": " "
      }
    }
  ]
}
@1Map 1Map changed the title Ho to insert multiple GeoJSON objects with pg-format How to insert GeoJSON object with multiple features into PostgreSQL using pg-format Nov 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant