All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.jetbrains.letsPlot.toolkit.geotools.CRSUtil.kt Maven / Gradle / Ivy

Go to download

Lets-Plot Kotlin GeoTools Bridge. Requires GeoTools artifacts: - org.geotools:gt-main:[30,) - org.geotools:gt-geojson:[30,)

There is a newer version: 4.8.0
Show newest version
/*
 * Copyright (c) 2022. JetBrains s.r.o.
 * Use of this source code is governed by the MIT license that can be found in the LICENSE file.
 */

package org.jetbrains.letsPlot.toolkit.geotools

import org.jetbrains.letsPlot.spatial.CRSCode
import org.geotools.api.referencing.crs.CoordinateReferenceSystem
import org.geotools.api.referencing.cs.CoordinateSystem

internal object CRSUtil {
    @Suppress("FunctionName")
    fun isWGS84_2D(crs: CoordinateReferenceSystem): Boolean {
        return crs.coordinateSystem.dimension == 2 &&
                isWGS84Code(crs.name.code)
    }

    @Suppress("FunctionName")
    fun isWGS84_2D(cs: CoordinateSystem): Boolean {
        return cs.dimension == 2 &&
                isWGS84Code(cs.name.code)
    }

    fun isWGS84Code(code: String?): Boolean {
        if (code == null) {
            return false
        }

        return CRSCode.isWGS84Code(code)
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy