Giter Club home page Giter Club logo

Comments (7)

rt-bishop avatar rt-bishop commented on August 17, 2024

For conversion between lat/lon and x/y(0,1) you could use something like this:

fun Double.latToY01(): Double {
    val sinus = sin(clipLat(this) * PI / MAX_LONGITUDE)
    return 0.5 - ln((1 + sinus) / (1 - sinus)) / (4 * PI)
}

fun Double.lonToX01(): Double {
    return (clipLon(this) - MIN_LONGITUDE) / (MAX_LONGITUDE - MIN_LONGITUDE)
}

fun Double.y01ToLat(): Double {
    return 90 - 360 * atan(exp((this - 0.5) * 2 * PI)) / PI
}

fun Double.x01ToLon(): Double {
    return MIN_LONGITUDE + (MAX_LONGITUDE - MIN_LONGITUDE) * this
}

Ref code. I do agree though it would be great to have this inside the library with the checks for exceeding the MIN/MAX values.

from mapcompose.

p-lr avatar p-lr commented on August 17, 2024

This library isn't tied to any measurement system. A map could be taken from a scanned paper or may represent the whole world. In the latter case, lat/lon make sense. However lat/lon may be irrelevant in other use cases.
Also, the relative to lat/lon formulas depend on the projection used to make the map.

Please provide more details about your usage of the library.

from mapcompose.

Nohus avatar Nohus commented on August 17, 2024

from mapcompose.

kmbisset89 avatar kmbisset89 commented on August 17, 2024

@Nohus I am guessing that you just figured out how to put your projection on the Number of Block - Width x Number of Blocks -Height and figured out how to stack your imagery there. I will investigate putting WGS-84 on the map. The renderer of this map does seem really good to try and figure that out.

When I do that I can try and figure out each boxes bound points of lat and long and determine image coverage. Sorry I am talking this out loud so that it might paint a better picture. Then I can associate zoom to the respective 1:Altitude ratio of the imagery.

from mapcompose.

p-lr avatar p-lr commented on August 17, 2024

Typically you know the extent in latitude and longitude of what you're rendering. Let's say Ya and Yb are respectively the projected coordinate in Y dimension of the top and the bottom. When y is a relative coordinate, it's projected coordinate in Y dimension is is Ya + y*(Yb-Ya). Then, the corresponding latitude is obtained using the relevant formula (which depends on the projection).

from mapcompose.

kmbisset89 avatar kmbisset89 commented on August 17, 2024

I am not sure I understand completely but I will try my best to see what I can do. I understand the relative calculation, but I am trying to think of how to get the "blue marble map" to project correctly

from mapcompose.

kmbisset89 avatar kmbisset89 commented on August 17, 2024

I think I will have to split bitmaps over a projection.

from mapcompose.

Related Issues (20)

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.