Skip to content

Commit

Permalink
warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
jillesvangurp committed Jan 9, 2024
1 parent 1e33722 commit ff8569e
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/commonMain/kotlin/com/jillesvangurp/geojson/json-helpers.kt
Expand Up @@ -37,9 +37,10 @@ val DEFAULT_JSON_PRETTY: Json by lazy {
}


val FeatureCollection.geoJsonIOUrl get() = DEFAULT_JSON.encodeToString(this).let { json->
"https://geojson.io/#data=${"data:application/json,$json".urlEncode()}"
}
val FeatureCollection.geoJsonIOUrl
get() = DEFAULT_JSON.encodeToString(this).let { json ->
"https://geojson.io/#data=${"data:application/json,$json".urlEncode()}"
}

val Geometry.geoJsonIOUrl get() = this.asFeatureCollection.geoJsonIOUrl

Expand All @@ -50,9 +51,9 @@ fun String.urlEncode(): String {
if (char in allowedChars) {
append(char)
} else {
append(char.toByte().toInt().let {
append(char.code.toByte().toInt().let {
"%${it.shr(4).and(0xF).toString(16)}${it.and(0xF).toString(16)}"
}.toUpperCase())
}.uppercase())
}
}
}
Expand Down

0 comments on commit ff8569e

Please sign in to comment.