Created
August 7, 2024 18:11
-
-
Save wchargin/601b71939958b83c862a8ee0414ca9e2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Create GeoJSON `Feature` values | |
def feature: {type: "Feature", properties: {}, geometry: .}; | |
# Create GeoJSON `Geometry` values | |
def geometry($type): {$type, geometry: .}; | |
def point: geometry("Point"); | |
def multipoint: geometry("MultiPoint"); | |
def linestring: geometry("LineString"); | |
def multilinestring: geometry("MultiLineString"); | |
def polygon: geometry("Polygon"); | |
def multipolygon: geometry("MultiPolygon"); | |
# Convert from latitude/longitude structs to GeoJSON coordinates | |
def lnglat: [.lng, .lat]; | |
def lonlat: [.lon, .lat]; | |
def tude: [.longitude, .latitude]; | |
# Convert from GeoJSON coordinates to latitude/longitude structs | |
def mklnglat: {lng: .[0], lat: .[1]}; | |
def mklonlat: {lon: .[0], lat: .[1]}; | |
def mktude: {longitude: .[0], latitude: .[1]}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment