我正在为我们的gis应用程序使用mapdotnet服务来加载shapefile,并且此mapdotnet服务需要proj4详细信息。我从spatialreference.org获取它们,但是对于this projection,proj4的详细信息是blank。如何从.prj文件或shapefile中获取proj4详细信息?

以下是shapefile的.prj:

PROJCS["NAD_1983_HARN_WISCRS_EauClaire_County_Feet",GEOGCS["GCS_North_American_1983_HARN",DATUM["D_North_American_1983_HARN",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Lambert_Conformal_Conic"],PARAMETER["False_Easting",394000.0],PARAMETER["False_Northing",300812.797],PARAMETER["Central_Meridian",-91.28888888888889],PARAMETER["Standard_Parallel_1",45.87228112638889],PARAMETER["Scale_Factor",1.000035079],PARAMETER["Latitude_Of_Origin",45.87228112638889],UNIT["Foot_US",0.3048006096012192]]

最佳答案

您还可以使用以下Python脚本(在Internet上的其他位置看到):

#!/usr/bin/env python

import osr
import sys

def main(prj_file):
    prj_text = open(prj_file, 'r').read()
    srs = osr.SpatialReference()
    if srs.ImportFromWkt(prj_text):
        raise ValueError("Error importing PRJ information from: %s" % prj_file)
    print srs.ExportToProj4()
    #print srs.ExportToWkt()

if __name__=="__main__":
    main(sys.argv[1])

08-24 19:17