从十六进制形状更改espg(使用shapely.wkb.loads转换)

时间:2018-02-16 06:11:51

标签: python shapely geopandas fiona

我正在使用名为college3

的地理数据框
college3 = gpd.GeoDataFrame(pd.read_table('data.txt'),crs = {'init': 'epsg:4269'})

shape列最初的格式为:

country type    color   relver  shape   _imported   _dataset    uniq_id pop
67  10  1781    1788    166452  Lesley University   Art Institute of  Boston    700 Beacon Street   Boston  MA  2215    ... 25025   USA 4-Year, Private 10  1.13.3  0106000020157C01000100000001030000000100000005...   2013-09-24 09:14:10 2013-01-01 00:00:00 d7a43fd5b64ce70481de5e6f057e99f4    480.694851
68  10  1995    2002    165167  Cambridge College   Main Campus 1000 Massachusetts Avenue, Suite 31 Cambridge   MA  2138    ... 25017   USA 4-Year, Private 0   1.13.3  0106000020157C01000200000001030000000100000005...   2013-09-24 09:14:10 2013-01-01 00:00:00 b57a1f68ea10a72ec9f53fece669f2cb    8942.000000
69  10  1025    1026    166513  University of Massachusetts Lowell  UML South   1 Solomont Way  Lowell  MA  1854    ... 25017   USA NaN 5   1.13.3  0106000020157C01000100000001030000000100000021...   2013-09-24 09:14:10 2013-01-01 00:00:00 a961b9066a579a5d6d56a0e91f3ce1be    10456.345189
70  10  509 509 164924  Boston College  Newton Campus   885 Centre Street   Newton Centre   MA  2459    ... 25017   USA NaN 10  1.13.3  0106000020157C01000100000001030000000100000030...   2013-09-24 09:14:10 2013-01-01 00:00:00 d8f31b0bde7553d795bd68ba697c6b5c    5589.823847
72  10  2160    2167    167376  Northern Essex Community College    Main    100 Elliot Street   Haverhill   MA  1843    ... 25009   USA 2-Year, Public  0   1.13.3  0106000020157C0100010000000103000000010000007F...   2013-09-24 09:14:10 2013-01-01 00:00:00 dc686ca64b68ad0e18137f576caee96a    19264.000000

我通过执行以下操作转换了十六进制形状:

college3['geometry'] = np.nan
for i in range(0, len(college3)):
    college3['geometry'].iloc[i] = shapely.wkb.loads(hex=True,data=college3['shape'].iloc[I])

产生了新的college3['geometry']

0    (POLYGON ((1045282.478239882 1257128.653710355...
1    (POLYGON ((1114508.897557752 1243969.445296504...
2    (POLYGON ((1023386.780084164 1265306.580706236...
3    (POLYGON ((1043605.376445292 1281471.656769202...
4    (POLYGON ((1064893.875765753 1254220.62727893,...

但是,我想将college3['geometry']投射到epsg=4269。当我尝试

college3 = college3.to_crs(epsg=4269)
college3['geometry'].head()

我得到了相同的结果:

0    (POLYGON ((1045282.478239882 1257128.653710355...
1    (POLYGON ((1114508.897557752 1243969.445296504...
2    (POLYGON ((1023386.780084164 1265306.580706236...
3    (POLYGON ((1043605.376445292 1281471.656769202...
4    (POLYGON ((1064893.875765753 1254220.62727893,...

如何将college3['geometry']更改为lat long epsg=4269?我非常感谢任何帮助

0 个答案:

没有答案