I have a Geojson in a google sheet cell. I'd like to extract coordinates from that. I tried using Regexextract function but I'm really having trouble in making the regex work.
This is a sample structure:
{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"properties": {},
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
62.22656249999999,
61.438767493682825
],
[
54.140625,
44.33956524809713
],
[
79.453125,
48.45835188280866
],
[
62.22656249999999,
61.438767493682825
]
]
]
}
}
]
}
what I want to obtain is
[[[62.22656249999999,61.438767493682825],[54.140625,44.33956524809713],[79.453125,48.45835188280866],[62.22656249999999,61.438767493682825]]]
Can you help me with that?
Thanks
=REGEXREPLACE(A5,"[^\[\]\.\d+,]",)
Anything except [].,
and digits gives a close approximation.
EDIT:
=REGEXEXTRACT(A5,"(?s)(\[\s+\[\s+\[.*\]\s+\]\s+\])")
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.