Note that there are some explanatory texts on larger screens.

plurals
  1. POConvert planar x/y to lat/long
    primarykey
    data
    text
    <p>Im trying to write a program that takes new york city x/y coords and turns them into lat/lng decimal points. Im new to planar/globe mapping. Ive included the constants that NYC has provided on their website. Also if there is a good article on how to do this I would love to learn! Below is the program I have written along with commented output at the bottom and also what the ideal values should be. Im kinda just stumbling in the dark on this.</p> <pre><code>#!/usr/bin/python from math import * """ Supplied by NYC Lambert Conformal Conic: Standard Parallel: 40.666667 Standard Parallel: 41.033333 Longitude of Central Meridian: -74.000000 Latitude of Projection Origin: 40.166667 False Easting: 984250.000000 False Northing: 0.000000 """ x = 981106 #nyc x coord y = 195544 #nyc y coord a = 6378137 #' major radius of ellipsoid, map units (NAD 83) e = 0.08181922146 #' eccentricity of ellipsoid (NAD 83) angRad = pi/180 #' number of radians in a degree pi4 = pi/4 #' Pi / 4 p0 = 40.166667 * angRad #' latitude of origin p1 = 40.666667 * angRad #' latitude of first standard parallel p2 = 41.033333 * angRad #' latitude of second standard parallel m0 = -74.000000 * angRad #' central meridian x0 = 984250.000000 #' False easting of central meridian, map units m1 = cos(p1) / sqrt(1 - ((e ** 2) * sin(p1) ** 2)) m2 = cos(p2) / sqrt(1 - ((e ** 2) * sin(p2) ** 2)) t0 = tan(pi4 - (p0 / 2)) t1 = tan(pi4 - (p1 / 2)) t2 = tan(pi4 - (p2 / 2)) t0 = t0 / (((1 - (e * (sin(p0)))) / (1 + (e * (sin(p0)))))**(e / 2)) t1 = t1 / (((1 - (e * (sin(p1)))) / (1 + (e * (sin(p1)))))**(e / 2)) t2 = t2 / (((1 - (e * (sin(p2)))) / (1 + (e * (sin(p2)))))**(e / 2)) n = log(m1 / m2) / log(t1 / t2) f = m1 / (n * (t1 ** n)) rho0 = a * f * (t0 ** n) x = x - x0 pi2 = pi4 * 2 rho = sqrt((x ** 2) + ((rho0 - y) ** 2)) theta = atan(x / (rho0 - y)) t = (rho / (a * f)) ** (1 / n) lon = (theta / n) + m0 x = x + x0 lat0 = pi2 - (2 * atan(t)) part1 = (1 - (e * sin(lat0))) / (1 + (e * sin(lat0))) lat1 = pi2 - (2 * atan(t * (part1 ** (e / 2)))) while abs(lat1 - lat0) &lt; 0.000000002: lat0 = lat1 part1 = (1 - (e * sin(lat0))) / (1 + (e * sin(lat0))) lat1 = pi2 - (2 * atan(t * (part1 ^ (e / 2)))) lat = lat1 / angRad lon = lon / angRad print lat,lon #output : 41.9266666432 -74.0378981653 #should be 40.703778, -74.011829 </code></pre> <p>Im pretty stuck, I have a ton of these that need geo-coded Thanks for any help! </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload