Instantly share code, notes, and snippets.
import json
geojson = { "type": "Feature", "geometry": { "type": "LineString", "coordinates": [ [0, 0], [1, 1], [2, 2] ] }, "properties": { "color": "red" # Definir a cor como "red" } }
geojson_str = json.dumps(geojson)
print(geojson_str)
Sorry, something went wrong.
import json
Criar um objeto GeoJSON com uma "linestring"
geojson = {
"type": "Feature",
"geometry": {
"type": "LineString",
"coordinates": [
[0, 0],
[1, 1],
[2, 2]
]
},
"properties": {
"color": "red" # Definir a cor como "red"
}
}
Converter o objeto GeoJSON em uma string JSON
geojson_str = json.dumps(geojson)
Exibir o GeoJSON resultante
print(geojson_str)