I want to get geometry type for every row (like point, linestring, polygon etc.) from GeoJSON data.
This is my code for reading data.
import argparse
import geopandas as gpd
import os
import sys
import shapely
data = gpd.read_file('data.geojson')
for index, row in data.iterrows():
print('Data: ', row['geometry'])
I have tried these solutions. But con not works. Get a Shapefile Geometry Type
Do you have any idea?
This is my 'data.geojson' file.
{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [102.0, 0.5]
},
"properties": {
"prop0": "value0"
}
},
{
"type": "Feature",
"geometry": {
"type": "LineString",
"coordinates": [
[102.0, 0.0], [103.0, 1.0], [104.0, 0.0], [105.0, 1.0]
]
},
"properties": {
"prop0": "value0",
"prop1": 0.0
}
},
{
"type": "Feature",
"geometry": {
"type": "Polygon",
"coordinates": [
[
[100.0, 0.0], [101.0, 0.0], [101.0, 1.0],
[100.0, 1.0], [100.0, 0.0]
]
]
},
"properties": {
"prop0": "value0",
"prop1": { "this": "that" }
}
}
]
}