Python GIS – Converting XY Point Coordinates to Latitude and Longitude in Python

coordinate systemgeopandaslatitude longitudepythonunited-states

I have data with columns x,y, address.
And no any information about the projection of x,y points.

How can I convert these points to correct lat/long pairs?

1091969,199515,27 HEDGEWAY CT
1092046,199590,4 SARATOGA CIR
1091986,199663,6 SARATOGA CIR
1091928,199696,8 SARATOGA CIR
1091883,199758,2 LEXINGTON CIR
1091948,199825,4 LEXINGTON CIR
1091917,199913,6 LEXINGTON CIR
1091839,199946,8 LEXINGTON CIR
1092026,198875,20 WARNER AVE
1092013,198934,28 WARNER AVE
1092000,198992,32 WARNER AVE
1091988,199050,WARNER AVE
1091974,199111,48 WARNER AVE
1091953,199210,56 WARNER AVE
1091940,199269,62 WARNER AVE
1087464,233134,7 EDGEWOOD LN

I've tried to use GeoPandas.

  1. Create dataframe as epsg: 2236 crs, because its Florida , Nassau county.
  2. Then convert to epsg:4326 (lat/long CRS)
  3. Then I've checked a few points in Google Maps and tried to adopt just add difference in latitude and longitude as Point(p.x + 6.07406, p.y + 15.83704)

But it seems such a linear approach does not work.

Any advice?

    gdf = gpd.GeoDataFrame(df, geometry=gpd.points_from_xy(df.coordinate_x, df.coordinate_y))
    gdf.crs = {'init': 'epsg:2236'}
    gdf['xy_geometry'] = gdf['geometry']

    # convert to latitude/longitude coordinate reference system
    gdf.to_crs({'init': 'epsg:4326'}, inplace=True)
    gdf.rename(columns={'geometry': 'lat_long_geometry'}, inplace=True)

    # correct geometry points with latitude & longitude offsets
    gdf.lat_long_geometry = gdf.lat_long_geometry.apply(lambda p: Point(p.x + 6.07406, p.y + 15.83704))

Best Answer

I tried several coordinate systems for Florida and the various State Plane Florida East zone but the coordinates just didn't seem to fit.

Google kept finding the address in Hempstead, NY, so I tried the Long Island zone, unit of US survey feet, and the results look good. Try EPSG::6539 for the NAD83 (2011) version or EPSG::2908 for NAD83 (HARN). For the generic NAD83 definition, the well-known ID is EPSG::2263. Ooh, perhaps the numbers were transposed?

Related Question