POV-Ray : Newsgroups : povray.general : POVEarth: how to calculate latitude from distance to the equator? : Re: POVEarth: how to calculate latitude from distance to the equator? Server Time
26 Apr 2024 14:32:56 EDT (-0400)
  Re: POVEarth: how to calculate latitude from distance to the equator?  
From: Jörg "Yadgar" Bleimann
Date: 13 May 2018 08:20:11
Message: <5af82d7b@news.povray.org>
Hi(gh)!

On 11.05.2018 03:23, Jörg "Yadgar" Bleimann wrote:
> Hi(gh)!
> 
> On 11.05.2018 01:57, Bald Eagle wrote:
> 
>> https://lite.qwant.com/?q=convert+from+latitude+to+distance&client=opensearch 
>>
>>
>>
https://gis.stackexchange.com/questions/91865/how-to-convert-distance-into-latitude-longitude

>>
>>
>> http://www.movable-type.co.uk/scripts/latlong.html
>>
>>
https://stackoverflow.com/questions/238260/how-to-calculate-the-bounding-box-for-a-given-lat-lng-location

>>
> 
> Too complicated for my feeble brain... I just once more gave in to 
> pixeling away another three, four or five years of my life, using 
> OpenTopoMaps and OpenStreetMaps, which both are just classical 
> Mercator's projections, which I'm able to handle mathematically!

Meanwhile, I installed the proj-bin package for Debian, a positively 
ancient piece of Unix software dating back to pre-Linux days... and with 
the "invproj" command line tool I'm finally able to convert UTM into 
geographic coordinates!

Here is what the original data (available under 
https://www.opengeodata.nrw.de/produkte/geobasis/dgm/dgm1/, I downloaded 
the Cologne (Köln) data file) looked like - for convenience just a 5 by 
5 slice from the original 2000 by 2000 measuring points (spaced 1 meters):

32342000.00 5658000.00 45.11
32342000.00 5658001.00 45.20
32342000.00 5658002.00 44.96
32342000.00 5658003.00 44.59
32342000.00 5658004.00 44.40
32342001.00 5658000.00 45.16
32342001.00 5658001.00 45.13
32342001.00 5658002.00 45.00
32342001.00 5658003.00 44.67
32342001.00 5658004.00 44.45
32342002.00 5658000.00 45.11
32342002.00 5658001.00 45.13
32342002.00 5658002.00 45.09
32342002.00 5658003.00 44.75
32342002.00 5658004.00 44.48
32342003.00 5658000.00 45.11
32342003.00 5658001.00 45.11
32342003.00 5658002.00 45.12
32342003.00 5658003.00 44.79
32342003.00 5658004.00 44.45
32342004.00 5658000.00 45.10
32342004.00 5658001.00 45.10
32342004.00 5658002.00 45.16
32342004.00 5658003.00 44.87
32342004.00 5658004.00 44.53

The first column contains the right (or east) value in meters, relative 
to the reference meridian of Cologne's UTM zone. In UTM projection, the 
Earth's surface is divided into 60 meridional zones, each one 6 degrees 
wide and numbered, beginning with 180°W. Cologne's UTM zone is 32, with 
9°E being the reference meridian. To avoid negative right values, the 
reference meridian in any zone is given the arbitrary value of 500000 
(so-called "false easting").

The second column contains the distance to the equator, i. e. the high 
(or north) value; the third column is the elevation in meters above sea 
level, which will pass unaltered through the following operations.

As the first column data are concatenated with the zone number (32), in 
each line the first two characters have to be removed. I did this with 
the powerful Unix editor tool sed:

sed -e 's/^32//g' testtile > testtile_no32

...and voilà:

342000.00 5658000.00 45.11
342000.00 5658001.00 45.20
342000.00 5658002.00 44.96
342000.00 5658003.00 44.59
342000.00 5658004.00 44.40
342001.00 5658000.00 45.16
342001.00 5658001.00 45.13
342001.00 5658002.00 45.00
342001.00 5658003.00 44.67
342001.00 5658004.00 44.45
342002.00 5658000.00 45.11
342002.00 5658001.00 45.13
342002.00 5658002.00 45.09
342002.00 5658003.00 44.75
342002.00 5658004.00 44.48
342003.00 5658000.00 45.11
342003.00 5658001.00 45.11
342003.00 5658002.00 45.12
342003.00 5658003.00 44.79
342003.00 5658004.00 44.45
342004.00 5658000.00 45.10
342004.00 5658001.00 45.10
342004.00 5658002.00 45.16
342004.00 5658003.00 44.87
342004.00 5658004.00 44.53

Now the UTM coordinates can be converted to geographic coordinates, and 
as I want to have the resulting ASCII file processed by a POV-Ray 
script, I prefer output in decimal form rather than degrees-minutes-seconds:

invproj +proj=utm +zone=32 -f %.9f testtile_no32 > testtile_degrees

Here we go:

6.745681594	51.051771388 45.11
6.745681158	51.051780374 45.20
6.745680721	51.051789359 44.96
6.745680285	51.051798344 44.59
6.745679848	51.051807330 44.40
6.745695850	51.051771663 45.16
6.745695414	51.051780649 45.13
6.745694977	51.051789634 45.00
6.745694541	51.051798620 44.67
6.745694104	51.051807605 44.45
6.745710106	51.051771938 45.11
6.745709670	51.051780924 45.13
6.745709233	51.051789909 45.09
6.745708797	51.051798895 44.75
6.745708360	51.051807880 44.48
6.745724362	51.051772213 45.11
6.745723926	51.051781199 45.11
6.745723489	51.051790184 45.12
6.745723053	51.051799170 44.79
6.745722616	51.051808155 44.45
6.745738618	51.051772488 45.10
6.745738182	51.051781474 45.10
6.745737745	51.051790459 45.16
6.745737309	51.051799445 44.87
6.745736872	51.051808430 44.53

Afterwards, I will use sed once more to replace the tabs and spaces by 
commas, as well as adding a comma at the end of each line - and then 
programming ultra-high resolution terrain reliefs with POV-Ray can 
begin! I wish I had such accurate data for Afghanistan...

Watch out for the first OpenCologne terrain views in the next few weeks!

See you in Khyberspace!

Yadgar


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.