I am trying to convert a simple point object created using shapely to a shapefile using fiona as instructed in this post. I pretty much followed line by line except that I changed the crs as I need it in another coordinate system.
The code I used:
##Creating the point
o = Point(-75.478003, 40.603155)
o
##Convert the point to shapefile using code from @Mike T :
from shapely.geometry import mapping
import fiona
schema = {
'geometry': 'Point',
'properties': {'id': 'int'},
}
with fiona.open('L:\lvpcgis\BowenLiuTemporary\ExtendLinesToLayer\my_shp1.shp', 'w', 'ESRI Shapefile', schema,
crs=bldg.crs) as c:
c.write({
'geometry': mapping(o),
'properties': {'id': 1},
})
The only thing I changed here is crs by specifying crs = bldg.crs
bldg. crs
{'proj': 'lcc',
'lat_1': 39.93333333333333,
'lat_2': 40.96666666666667,
'lat_0': 39.33333333333334,
'lon_0': -77.75,
'x_0': 600000,
'y_0': 0,
'datum': 'NAD83',
'units': 'us-ft',
'no_defs': True}
After running the code, I get a point shapefile my_shp1. However, when I add it in ArcGIS to check its accuracy, it shows up at the wrong location with lon, lat of 84.6941252°W 39.1210089°N with a projected coordinate system of "Lambert Conformal Conic" and geographic coordinate system of EPSG:4269.
I realize I must have somehow the coordinate system somehow but I just don't know where.
And it'd be better if there is a better way to convert shapely object to a shapefile.
crs=bldg.crspart. Why would I want to reproject it to the LCC CRS? I never wanted it in LCC anyway. Thanks. – Bowen Liu Apr 24 '19 at 19:39crs mismatchUserWarning everywhere now. Please help me out. Please help me out. With my own knowledge of crs, I will never finish this on time. I created a newbldggeodataframe and somehow itsprojislcc. At which step did I identify the data as LCC? Thanks again! – Bowen Liu Apr 24 '19 at 19:56bldg.crsdoesn't change the coordinates of the point. Use pyprog transform as per the duplicate post https://gis.stackexchange.com/q/121441/2856 and change the lcc crs to bldg.crs. – user2856 Apr 24 '19 at 23:17