<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    zhyiwww
    用平實的筆,記錄編程路上的點點滴滴………
    posts - 536,comments - 394,trackbacks - 0
    [1]把shp數(shù)據(jù)導(dǎo)入到postgres(postgis)
    [2]road.map文件內(nèi)容如下

    # Map file generated by QGIS version 0.7.4
    # Edit this file to customize for your interface
    # Not all sections are complete. See comments for details.
    NAME road
    STATUS ON

    # Map image size. Change size as desired
    SIZE 256 256
    #
    # Start of web interface definition. Only the TEMPLATE parameter
    # must be specified to display a map. See Mapserver documentation
    #
    WEB
    ? # HEADER
    ? # TEMPLATE
    ? # FOOTER
    MINSCALE 1
    ? MAXSCALE 8
    # Set IMAGEPATH to the path where mapserver should
    # write its output
    ?IMAGEPATH 'd:\\tmp\\'
    # Set IMAGEURL to the url that points to IMAGEPATH
    ?#IMAGEURL '/map_output/'
    END

    PROJECTION
    ??? "init=epsg:4326"
    END

    # Extent based on full extent of QGIS view
    EXTENT 115.275 39.2204 117.475 40.9462

    UNITS METERS

    IMAGECOLOR 255 255 255
    IMAGETYPE gif
    # Projection definition
    # Projections are not currenlty supported. If desired, add your own
    # projection information based on Mapserver documentation.
    #
    LAYER
    ? NAME road
    ? TYPE LINE
    ? STATUS ON

    ? CONNECTIONTYPE POSTGIS
    ? CONNECTION "host=localhost dbname=mapdb? user=postgres password=postgres port=5432"
    ? DATA "the_geom from beijing_polyline using unique gid using srid=4326"


    ? #DATA? "d:\\wwwroot\\shp\\Rbeijing.shp"

    ? CLASS
    ??? NAME "ROAD"
    ??? # TEMPLATE
    ??? OUTLINECOLOR 112 238 238
    ? END
    END
    END # Map File

    藍色的部分就是連接postgis數(shù)據(jù)庫的部分,和取數(shù)據(jù)的部分

    [3]road.html
    <html xmlns="http://www.w3.org/1999/xhtml">
    ? <head>
    ??? <style type="text/css">
    ??????? ##mapdiv {
    ??????????? width: 800px;
    ??????????? height: 475px;
    ??????????? border: 1px solid black;
    ??????? }
    ??? </style>
    ??? <script src="/OpenLayers/OpenLayers.js"></script>

    ??? <script type="text/javascript">
    ??????? //Google has 20 scales
    ??????? //Resolutions always start big to small, descending order
    ??????? //numZoomLevels=20 (corresponds to Googles 20 zoom levels)
    ??????? //map.setCenter(center, 19); (Zoom Level starts at 0 and ends in 19)

    ??????? window.onload = function() {

    ??????????? map = new OpenLayers.Map('mapdiv');

    ??????????? var serverURL = "/cgi-bin/mapserv";

    ??????????? var layer_obj = new OpenLayers.Layer.WMS(
    ??????????????? "road",
    ??????????????? serverURL,
    ??????????????? {??
    ??????????????????? layers: 'road',
    ??? ??? ??? map : 'd:\\wwwroot\\postgis\\road.map',

    ??????????????????? format: 'gif'
    ??????????????? },
    ??????????????? {
    ??????????????????? //reproject: false,
    ??????????????????? 'numZoomLevels': 20,
    ??????????????????? gutter: 15,
    ??????????????????? buffer: 0
    ??????????????? }
    ??????????? );
    ??????????? layer_obj.setIsBaseLayer(true);??
    ??????????? layer_obj.setVisibility(true);??
    ??????????? map.addLayer(layer_obj);

    ??????????? map.addControl(new OpenLayers.Control.PanZoomBar());
    ??????????? map.addControl(new OpenLayers.Control.MousePosition());
    ??????????? map.addControl(new OpenLayers.Control.LayerSwitcher());
    ??????????? map.addControl(new OpenLayers.Control.Scale());
    ??????????? var center = new OpenLayers.LonLat(116.39166, 39.90625);
    ??????????? map.setCenter(center, 8);
    ??????? }
    ?????????
    ??? </script>
    ? </head>
    ? <body>
    ??? <div id="mapdiv"></div>
    ? </body>
    </html>


    訪問http://localhost:8888/postgis/road.html,可以看到地圖結(jié)果如下:

    mapserver_postgis.PNG






    |----------------------------------------------------------------------------------------|
                               版權(quán)聲明  版權(quán)所有 @zhyiwww
                引用請注明來源 http://www.tkk7.com/zhyiwww   
    |----------------------------------------------------------------------------------------|
    posted on 2009-02-20 18:19 zhyiwww 閱讀(2563) 評論(4)  編輯  收藏 所屬分類: gisPostgis

    FeedBack:
    # re: Mapserver配置postgis數(shù)據(jù)源[未登錄]
    2010-03-11 21:26 | 石頭
    為什么訪問端口號是8888呢,我照樣在linux運行,顯示的頁面時空白的。  回復(fù)  更多評論
      
    # re: Mapserver配置postgis數(shù)據(jù)源
    2010-03-18 09:33 | zhyiwww
    端口是自己指定的,可以修改。  回復(fù)  更多評論
      
    # re: Mapserver配置postgis數(shù)據(jù)源
    2010-04-26 20:26 | 騎馬人
    請問可不可以寫篇安裝qgis的文章,我在windows下安裝qgis后,導(dǎo)出mapfile文件時總是出錯。懷疑是安裝的問題。  回復(fù)  更多評論
      
    # re: Mapserver配置postgis數(shù)據(jù)源
    2010-08-04 20:37 | myy
    哥們 能留你的qq嗎 我的顯示不出來啊  回復(fù)  更多評論
      
    主站蜘蛛池模板: 亚洲av日韩av高潮潮喷无码| 亚洲一区中文字幕久久| 亚洲最大福利视频| 可以免费看黄视频的网站| 亚洲小说区图片区| 亚洲色成人四虎在线观看| 亚洲视频在线免费看| 亚洲成av人片不卡无码| 无码区日韩特区永久免费系列| 亚洲色成人网一二三区| 草久免费在线观看网站| 亚洲人成网站免费播放| 亚洲va国产va天堂va久久| 亚洲JIZZJIZZ妇女| 热re99久久6国产精品免费| 亚洲第一区香蕉_国产a| 99精品视频免费在线观看| 精品日韩99亚洲的在线发布| 免费无码精品黄AV电影| 爱情岛论坛亚洲品质自拍视频网站| 免费看国产一级片| 亚洲欧美日韩一区二区三区| 97国产在线公开免费观看| 中文字幕亚洲图片| 国产日韩一区二区三免费高清| 免费国内精品久久久久影院| 亚洲免费观看网站| 免费鲁丝片一级观看| 一级毛片在线免费播放| 亚洲AV福利天堂一区二区三| 91在线视频免费看| 成人午夜影视全部免费看| 久久亚洲国产视频| 成全高清视频免费观看| 亚洲w码欧洲s码免费| 免费观看国产小粉嫩喷水| 拍拍拍无挡免费视频网站| 亚洲中文字幕无码不卡电影| 99视频有精品视频免费观看| 亚洲欧美黑人猛交群| 亚洲日韩av无码|