Skip to content

Instantly share code, notes, and snippets.

@frewsxcv
Created January 19, 2014 03:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save frewsxcv/20b6522d8242ede00bb3 to your computer and use it in GitHub Desktop.
Save frewsxcv/20b6522d8242ede00bb3 to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
{"coordinates": [[[3.75, 9.25], [-130.95, 1.52]], [[23.15, -34.25], [-1.35, -4.65], [3.45, 77.95]]], "type": "MultiLineString"}
@ingriddiniz
Copy link

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment