2011-08-20 50 views
3

嗨,我試圖從PostGIS的形狀文件導入問題

http://www.nyc.gov/html/dcp/html/bytes/bytesarchive.shtml

導入的形狀文件到PostGIS的數據庫。上面的文件在使用shp2pgsql導入時創建了MULTIPOLYGONS。

然後我試圖簡單地確定緯度/長點都包含在我的multipolygons

但是我選擇的不工作,當我打印出我的the_geom列的poitns這似乎是很破。

select st_astext(geom) from (select (st_dumppoints(the_geom)).* from nybb where borocode =1) foo; 

給出結果...

  st_astext 
------------------------------------------ 
POINT(1007193.83859999 257820.786899999) 
POINT(1007209.40620001 257829.435100004) 
POINT(1007244.8654 257833.326199993) 
POINT(1007283.3496 257839.812399998) 
POINT(1007299.3502 257851.488900006) 
POINT(1007320.1081 257869.218500003) 
POINT(1007356.64669999 257891.055800006) 
POINT(1007385.6197 257901.432999998) 
POINT(1007421.94509999 257894.084000006) 
POINT(1007516.85959999 257890.406100005) 
POINT(1007582.59110001 257884.7861) 
POINT(1007639.02150001 257877.217199996) 
POINT(1007701.29170001 257872.893099993) 
... 

在紐約分,這是很關..我到底做錯了什麼?

+1

這個問題可能會更適合http://gis.stackexchange.com你可能會考慮讓一個主持人把它移到那裏。 – steenhulthin

回答

4

積分不是。所引用的空間數據不在lat/long中。這就是爲什麼數字與你所期望的不同。如果你需要它在長/緯度,它必須重新投影。查看更多這裏:http://postgis.refractions.net/news/20020108/

數據的投影似乎在NAD_1983_StatePlane_New_York_Long_Island_FIPS_3104_Feet座標系統(根據元數據 - 見代碼)。

<spref> 
    <horizsys> 
     <planar> 
      <planci> 
       <plance Sync="TRUE">coordinate pair</plance> 
       <coordrep> 
        <absres Sync="TRUE">0.000000</absres> 
        <ordres Sync="TRUE">0.000000</ordres> 
       </coordrep> 
       <plandu Sync="TRUE">survey feet</plandu> 
      </planci> 
      <mapproj><mapprojn Sync="TRUE">Lambert Conformal Conic</mapprojn><lambertc><stdparll Sync="TRUE">40.666667</stdparll><stdparll Sync="TRUE">41.033333</stdparll><longcm Sync="TRUE">-74.000000</longcm><latprjo Sync="TRUE">40.166667</latprjo><feast Sync="TRUE">984250.000000</feast><fnorth Sync="TRUE">0.000000</fnorth></lambertc></mapproj></planar> 
     <geodetic> 
      <horizdn Sync="TRUE">North American Datum of 1983</horizdn> 
      <ellips Sync="TRUE">Geodetic Reference System 80</ellips> 
      <semiaxis Sync="TRUE">6378137.000000</semiaxis> 
      <denflat Sync="TRUE">298.257222</denflat> 
     </geodetic> 
     <cordsysn> 
      <geogcsn Sync="TRUE">GCS_North_American_1983</geogcsn> 
      <projcsn Sync="TRUE">NAD_1983_StatePlane_New_York_Long_Island_FIPS_3104_Feet</projcsn> 
     </cordsysn> 
    </horizsys> 
</spref> 

如果你對空間數據工作太多,我建議你閱讀更多關於map projection

+3

使用shp2pgsql中的-s標誌將SRID設置爲[2263](http://prj2epsg.org/epsg/2263)。然後,您可以使用[ST_Transform](http://postgis.refractions.net/docs/ST_Transform.html)轉換爲4326. –

+0

另一種可能性 - 將'''-s 2263:4326'''傳遞給shp2pgsql。爲你轉換嗎? – Alastair

0

我認爲這不是PostGIS的問題。我檢查輸入ESRI形文件nybb.shpAvisMap Free Viewer,當你看到點古怪本身:

enter image description here

但是有一些有趣的事情在nybb.shp.xml元數據文件:

<spdom> 
    <bounding> 
     <westbc Sync="TRUE">-74.257465</westbc> 
     <eastbc Sync="TRUE">-73.699450</eastbc> 
     <northbc Sync="TRUE">40.915808</northbc> 
     <southbc Sync="TRUE">40.495805</southbc> 
    </bounding> 
    <lboundng> 
     <leftbc Sync="TRUE">913090.770096</leftbc> 
     <rightbc Sync="TRUE">1067317.219904</rightbc> 
     <bottombc Sync="TRUE">120053.526313</bottombc> 
     <topbc Sync="TRUE">272932.050103</topbc> 
    </lboundng> 
</spdom> 

我不熟悉的那些工具包(ESRI ArcCatalog),但很可能您需要在使用該元數據導入後重新調整點。