Skip to content

Instantly share code, notes, and snippets.

@KMR-zoar
Created December 11, 2018 08:20
Show Gist options
  • Select an option

  • Save KMR-zoar/6692e27f05eebc01970e1c9f29da1e49 to your computer and use it in GitHub Desktop.

Select an option

Save KMR-zoar/6692e27f05eebc01970e1c9f29da1e49 to your computer and use it in GitHub Desktop.
let
filePath = "?????.geojson",
source = Json.Document(File.Contents(filePath)),
converted2Table = Record.ToTable(source),
features = converted2Table{5}[Value],
fearure2table = Table.FromList(
features, Splitter.SplitByNothing(), null, null, ExtraValues.Error
),
expandedColumn1 = Table.ExpandRecordColumn(
fearure2table, "Column1", {
"id", "properties", "geometry"
}, {
"id", "Column1.properties", "Column1.geometry"
}
),
expandedColumn1.properties = Table.ExpandRecordColumn(
expandedColumn1,
"Column1.properties",
{"name"},
{"name"}
),
expandedColumn1.geometry = Table.ExpandRecordColumn(
expandedColumn1.properties,
"Column1.geometry",
{"coordinates"},
{"Column1.geometry.coordinates"}
),
extracted = Table.TransformColumns(
expandedColumn1.geometry, {
"Column1.geometry.coordinates",
each Text.Combine(List.Transform(_, Text.From), ","),
type text
}
),
splitted = Table.SplitColumn(
extracted,
"Column1.geometry.coordinates",
Splitter.SplitTextByDelimiter(",", QuoteStyle.Csv),
{
"lon",
"lat"
}
),
result = Table.TransformColumnTypes(
splitted,{
{"lon", type text},
{"lat", type text}
}
)
in
result
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment