Giter Site home page Giter Site logo

atgczcl / lonlattounity Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 1.3 MB

将经纬度坐标转换为Web墨卡托投影坐标,再转换为unity内某个位置的相对坐标(Convert the earth's longitude and latitude coordinates to unity coordinates)

License: Other

C# 100.00%

lonlattounity's Introduction

LonLatToUnity

将经纬度坐标转换为Web墨卡托投影坐标,再转换为unity内某个位置的相对坐标(Convert the earth's longitude and latitude coordinates to unity coordinates)

git clone https://github.com/atgczcl/LonLatToUnity.git

导入包:

unitypackage manager add git url:

https://github.com/atgczcl/LonLatToUnity.git#upm

Use:

/// <summary>
/// Calculates Unity coordinates based on a string containing longitude and latitude.
/// </summary>
/// <param name="lonLatStr">A string representing the longitude and latitude.</param>
/// <returns>A Vector2 representing the calculated position in Unity coordinates.</returns>
public Vector2 CalculateUnityPos(string lonLatStr)
{
    // Initialize the GeoCoordinateModel with the provided longitude and latitude string.
    GeoCoordinateModel geoCoordinateModel = new GeoCoordinateModel(lonLatStr);

    // Get the Unity coordinates of the center point.
    Vector2 centerUnityPos = new Vector2(CenterLocaterObj.transform.position.x, CenterLocaterObj.transform.position.z);
    
    // Compute the scaled Unity coordinates.
    var scaledUnityPos = geoCoordinateModel.CalculateScaledUnityPos(centerUnityPos, Scale);
    
    return scaledUnityPos;
}

lonlattounity's People

Contributors

atgczcl avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.