5

GIS アプリケーションに mapdotnet サービスを使用してシェープファイルをロードしていますが、この mapdotnet サービスは proj4 の詳細を必要としています。私は spatialreference.org からそれらを取得していますが、この投影では、proj4 の詳細は空白です。.prj ファイルまたはシェープファイルから proj4 の詳細を取得するにはどうすればよいですか?

以下はシェープファイルの .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]]
4

5 に答える 5

6

このPythonスクリプト(インターネット上の他の場所で見られる)を使用することもできます。

#!/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])
于 2011-10-05T23:33:11.387 に答える
2

と rgdal ライブラリを使用する代替:

library(rgdal)
# read the .shp file - layer is the same name but without the .shp
mymap <- readOGR("CA_tract_2000.shp", layer="CA_tract_2000") 
# proj4 info is located in the layer's proj4string slot
mymap@proj4string
于 2011-02-14T04:42:41.843 に答える
2

perl スクリプトを使用した別のソリューション (Geo::GDAL が必要):

#!/usr/bin/perl -w
use strict;
use Geo::OSR;
my $srs = Geo::OSR::SpatialReference->new;
my $prj_text = do { open my $fh, shift or die $!; local $/; <$fh> };
$srs->ImportFromWkt($prj_text);
print $srs->ExportToProj4, "\n";
于 2012-01-09T09:38:17.230 に答える
0

It should be possible to work it out from the individual components. Proj.4 allows everything to be specified. You will need the ESRI documentation for their PRJ files. This will include their definitions (eg. what is the difference between NAD83_HARN and normal NAD83? they migth be the same but I don't know)

another approach might be to look at the GDAL/OGR library and utilities. These are capable of reading most PRJ files.

于 2010-11-18T22:55:38.313 に答える