2

I'm trying to create some software for an airport and they require me to place icons of aircraft in their position based on GPS. I have 10x10 tiles each tile being 256x256 pixels and the origin point being top left and measured in pixels.

This leaves me with a canvas of 200 tiles adding up to 5120x5120 pixels. I need a way to place an icon on top of a pixel based on GPS long and lat regardless of zoom! I don't understand the type of math involved as I have never done it before! The top left of the canvas is x:0,y:0. Can somebody please point in the right direction please?

The language I'm using is JS and it's for a .net application in unity3d.

1

Converting geographic (latitude-longitude) coordinates to plane (X-Y or row-column) coordinates is a matter of map projection.

Your main constraint is probably the projection which is already being used to map the other features (runways, terminals, etc). That is, if they are already recorded/stored/displayed in some flat X-Y system, then you need to determine what projection is being used and then find out how to convert (or project) the GPS coordinates.

If, however, the other features are provided in the same geographic coordinates system as GPS, then you can choose which projection to use. The very simplest one being the plate carrée (it has many other names, e.g., "simple cylindrical"). In that case, it's a simple matter of using a single, convenient, constant factor, K,

pixel row = –K latitude
pixel column = K longitude

and the size of K depending on the lat-long ranges of the airport and the screen pixel ranges.

Maybe look at google.com/maps...javascript, Geo-Paths and Geo-Projections for some relevant JavaScript examples and libraries.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.