1

I am at my wit's end here!

For a project at work, I am plotting a simple map in Power BI that pinpoints some of our internal utility permitting activity. One of the datasets I have been given appears to have X and Y coordinates, and I was told that the coordinates are in NAD83 Texas North Central. The data set does not have latitude and longitude. I am looking for the python script to change them or even the formula.

Here are some examples of the coordinates (X, Y):

2389721.373 7120786.992
2404093.075 7121270.858
2399450.901 7108775.082
2390198.570 7122950.801
2388505.487 7129711.434

I have tried the following code, but I get lat and lon decimals that are nowhere near where they should be on the map.

conv = 0.3408

x1, y1 = 2389721.373 * conv, 7120786.992 * conv # feet to meters

p2 = Proj('4326', proj="utm", zone=14)
lon, lat = p2(x1, y1, inverse=True)

...which yields:

lat, lon
(21.91704812776455, -95.95674542629739)
# Nowhere near Denton, Texas

Any help would be immensely helpful. For reference, the lat lon points should end up in the Denton, Texas area.

3
  • I think that you are looking for the transformer class. See: pyproj4.github.io/pyproj/stable/examples.html
    – snowman2
    Commented May 16, 2020 at 16:09
  • snowman2, I have reviewed this documentation, but I can't ever seem to get what I am looking for. Could you possibly provide an example? I'm beginning to think that the X and Y coordinates are not actually NAD83, but it would be nice to see someone who has familiarity with this subject to see if they get nonsensical lat lon points too. Thx for the quick reply.
    – MPA_nerd
    Commented May 16, 2020 at 16:14
  • 1
    You are using UTM, try this: epsg.io/2276
    – snowman2
    Commented May 16, 2020 at 16:31

1 Answer 1

3

This should do it:

from pyproj import Transformer
trans = Transformer.from_crs(2276, 4326, always_xy=True)
trans.transform(2389721.373, 7120786.992)
2
  • This is it! I actually figured out and was coming back to thank you. Your input made me try out the Transformer.from_crs function again with the right ESPG codes. I owe you a beer, good sir.
    – MPA_nerd
    Commented May 16, 2020 at 16:50
  • Glad to hear that it worked 👍
    – snowman2
    Commented May 16, 2020 at 17:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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