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

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

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

    posts - 41,  comments - 90,  trackbacks - 0
      2010年12月1日

    Android老大哥安迪魯賓近日在發布2.3姜餅系統和Nexus S的時候曾演示了最新版本的Google Maps 5.0手機地圖,最大的變化就是采用了全3D地圖。

    在新版手機地圖中,矢量圖將替換原本的2D畫面為用戶呈現出全新的3D界面,用戶可以自由的轉動和縮放。此外用戶還將會獲得離線地圖瀏覽功能,不用在瀏覽地圖時保持在線狀態。

    Google現在在其官方手機頻道又放出了一段用Nexus S運行新版Maps應用的全功能演示,這款軟件將會隨Nexus S上市,之后提供其他設備更新,但是對手機硬件有一定的要求,新款800MHz至1GHz處理器且配有專用圖形核心的手機才能支持3D視圖。



    原文見驅動之家
    http://news.mydrivers.com/1/181/181818.htm
    posted @ 2010-12-12 21:54 天狼 閱讀(606) | 評論 (1)編輯 收藏
    天地圖官方網站提供的二次開發文檔和例子過于簡單,很多關鍵信息沒有給予說明,例如給出了WFS服務接口,卻沒有提供詳細的開發文檔。
    不過這并不影響我們的使用,因為OGC WFS規范包含元數據查詢命令,通過發送getCapabilities請求,我們可以得知服務器提供哪些WFS服務。

    獲取WFS服務器元數據
    http://search.tianditu.com/wfs?request=getCapabilities
    返回信息如下:
    <WFS_Capabilities version="1.0.0" xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengeospatial.net//wfs/1.0.0/WFS-capabilities.xsd">
    <Service>
    <Name>GeoGlobe WFS</Name>
    <Title>GeoGlobe網絡要素服務器</Title>
    <Abstract>武大吉奧信息技術有限公司GeoGlobe網絡要素服務器</Abstract>
    <KeywordList/>
    <OnlineResource>http://search.tianditu.com:80/wfs</OnlineResource>
    </Service>
    <Capability>
    <Request>
    <GetCapabilities>
    <DCPType>
    <HTTP>
    <Get onlineResource="http://search.tianditu.com:80/wfs"/>
    </HTTP>
    </DCPType>
    </GetCapabilities>
    <GetFeature>
    <ResultFormat>
    <GML2/>
    </ResultFormat>
    <DCPType>
    <HTTP>
    <Get onlineResource="http://search.tianditu.com:80/wfs"/>
    <Post onlineResource="http://search.tianditu.com:80/wfs"/>
    </HTTP>
    </DCPType>
    </GetFeature>
    <DescribeFeatureType>
    <SchemaDescriptionLanguage>
    <XMLSCHEMA/>
    </SchemaDescriptionLanguage>
    <DCPType>
    <HTTP>
    <Get onlineResource="http://search.tianditu.com:80/wfs"/>
    </HTTP>
    </DCPType>
    </DescribeFeatureType>
    </Request>
    <VendorSpecificCapabilities/>
    </Capability>
    <FeatureTypeList>
    <Operations>
    <Query/>
    </Operations>
    <FeatureType>
    <Name>DOMAIN_POI_NEW</Name>
    <Title>DOMAIN_POI_NEW</Title>
    <Abstract>DOMAIN_POI_NEW</Abstract>
    <Keywords>DOMAIN_POI_NEW</Keywords>
    <SRS>EPSG:4326</SRS>
    <LatLongBoundingBox minx="-180.0" miny="-90.0" maxx="180.0" maxy="90.0"/>
    </FeatureType>
    <FeatureType>
    <Name>iso19112:SI_Gazetteer</Name>
    <Title>iso19112:SI_Gazetteer</Title>
    <SRS>EPSG:4326</SRS>
    <LatLongBoundingBox minx="-180.0" miny="-90.0" maxx="180.0" maxy="90.0"/>
    </FeatureType>
    </FeatureTypeList>
    <ogc:Filter_Capabilities>
    <ogc:Spatial_Capabilities>
    <ogc:Spatial_Operators>
    <ogc:BBOX/>
    <ogc:Equals/>
    <ogc:Disjoint/>
    <ogc:Intersect/>
    <ogc:Touches/>
    <ogc:Crosses/>
    <ogc:Within/>
    <ogc:Contains/>
    <ogc:Overlaps/>
    <ogc:Beyond/>
    </ogc:Spatial_Operators>
    </ogc:Spatial_Capabilities>
    <ogc:Scalar_Capabilities>
    <ogc:Logical_Operators/>
    <ogc:Comparison_Operators>
    <ogc:Simple_Comparisons/>
    <ogc:Like/>
    <ogc:Between/>
    </ogc:Comparison_Operators>
    </ogc:Scalar_Capabilities>
    </ogc:Filter_Capabilities>
    </WFS_Capabilities>

    返回信息包含了WFS服務器的開發單位(武大吉奧),WFS圖層的名稱(DOMAIN_POI_NEW和iso19112:SI_Gazetteer),支持的邏輯操作符和空間操作符。

    繼續測試
    http://search.tianditu.com/wfs?request=GetFeature&version=1.0.0&typeName=DOMAIN_POI_NEW&BBOX=105.99,29.99,106,30
    返回
    <wfs:FeatureCollection xsi:schemaLocation="http://www.opengis.net/wfs WFS_Basic.xsd http://www.geostart.com.cn/geoglobe describe.xsd">
    <gml:boundedBy>
    <gml:Box>
    <gml:coordinates>-180.0,-90.0 180.0,90.0</gml:coordinates>
    </gml:Box>
    </gml:boundedBy>
    <gml:featureMember>
    <DOMAIN_POI_NEW>
    <OID>6764930</OID>
    <Geometry>
    <gml:Point srsName="-1">
    <gml:coordinates>105.999183,29.995258</gml:coordinates>
    </gml:Point>
    </Geometry>
    <DOMAINNAME>梅子村</DOMAINNAME>
    <DOMAINCODE>1CHN50022400000130172</DOMAINCODE>
    <NLEVEL>16</NLEVEL>
    <X>105.999183</X>
    <Y>29.995258</Y>
    <COLDATE/>
    <NAMETIME/>
    <ENDTIME/>
    <CLASSID/>
    <STANDARDNAME>亞洲中國重慶市銅梁縣梅子村</STANDARDNAME>
    <TELEPHONE/>
    <ADDRESS/>
    <KIND>BB80</KIND>
    <ZIPCODE/>
    <ADMINCODE>500224</ADMINCODE>
    <POI_ID>5000000130172</POI_ID>
    <PID/>
    <DATATYPE>chinapoi</DATATYPE>
    <FENAME/>
    <locationType>
    <SI_LocationType>
    <name>DOMAIN_POI_NEW</name>
    </SI_LocationType>
    </locationType>
    </DOMAIN_POI_NEW>
    </gml:featureMember>
    </wfs:FeatureCollection>

    分析返回的GML數據,可知DOMAIN_POI_NEW是地名圖層,包含名稱、代碼、類別碼等屬性字段。

    將圖層改為iso19112:SI_Gazetteer,沒有返回任何信息,google ISO19112,得到如下解釋:
    DIN EN ISO 19112-2005 地理信息.通過地理標識符的空間定位 標準號: DIN EN ISO 19112-2005 標準名稱: 地理信息.通過地理標識符的空間定位

    得到以上信息后,我們嘗試使用Openlayers獲取,即全國地名數據庫。

    通過URL(GET方式)訪問“天地圖”WFS服務,可以使用OpenLayers.Request.GET類,示例代碼如下:
       //使用FEATUREID查詢

       new OpenLayers.Request.GET( {
            url : "http://search.tianditu.com/wfs?request=GetFeature",
            params: {
                typeName: "DOMAIN_POI_NEW",
                FEATUREID: "DOMAIN_POI_NEW.6649356"
            },
            callback : handler
        });


       //使用BBOX查詢

        new OpenLayers.Request.GET( {
            url : "http://search.tianditu.com/wfs?request=GetFeature",
            params: {
                typeName: "DOMAIN_POI_NEW",
                BBOX: "105.99,29.99,106,30"  //map.getExtent().toBBOX()
            },
            callback : handler
        });


    說明:
    url WFS服務器地址,必須加上?request=GetFeature
    typeName 圖層名稱
    FEATUREID WFS的圖元ID,采用標準格式: [圖層名].[OID編號]
    BBOX 指定區域查詢,注意不要設置過大,否則瀏覽器可能失去響應。

    通過POST方式訪問“天地圖”WFS服務,可以使用OpenLayers.Request.POST類,示例代碼如下:

        var xmlPara = "<?xml version='1.0' encoding='UTF-8'?>"
                + "<wfs:GetFeature maxFeatures='100' service='WFS' version='1.0.0' "
                + "xmlns:wfs='http://www.opengis.net/wfs' "
                + "xmlns:gml='http://www.opengis.net/gml' "
                + "xmlns:ogc='http://www.opengis.net/ogc' "
                + "xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' "
                + "xsi:schemaLocation='http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.0.0/wfs.xsd'>"
                + "<wfs:Query typeName='iso19112:SI_Gazetteer' srsName='EPSG:4326'>"
                + "<ogc:Filter xmlns:ogc='http://www.opengis.net/ogc'>"
                + "<ogc:And><ogc:PropertyIsLike wildCard='*' singleChar='.' escape='!'>"
                + "<ogc:PropertyName>STANDARDNAME</ogc:PropertyName>"
                + "<ogc:Literal>*解放碑*</ogc:Literal>"
                + "</ogc:PropertyIsLike></ogc:And></ogc:Filter>"
                + "</wfs:Query></wfs:GetFeature>";
        
        var request = OpenLayers.Request.POST( {
            url : "http://search.tianditu.com/wfs?",
            data : xmlPara,
            callback : handler
        });
    };

    說明:

    url WFS服務器地址

    data WFS請求正文,返回的GML由回調函數handler處理

    handler負責處理服務端返回的GML數據,也就是矢量化的地圖數據,根據應用需求編寫代碼,獲取feature的通用代碼如下:
    var g = new OpenLayers.Format.GML();
    var features = g.read(req.responseText);
    for ( var i = 0; i < features.length; ++i) {
       var feature = features[i];
       var geometry = feature.geometry;
       var attributes = feature.attributes;
    }

    定義過濾條件時請使用STANDARDNAME字段,不要使用DOMAINNAME字段,前者應該有索引支持,而后者沒有,查詢速度差別很大。

    經過測試,typeName="DOMAIN_POI_NEW"和typeName="iso19112:SI_Gazetteer"都能返回結果。由于缺少官方文檔說明,不知道這兩個圖層有何區別。

    嘗試使用OpenLayers.Protocol.WFS無法訪問“天地圖”WFS服務,服務器返回: 請求參數[REQUEST]的值為空或不正確。

    提醒: 使用POST查詢時,頁面文件或代碼文件務必保存為utf-8編碼,如果使用gbk、gb2312編碼,漢字地名會變成亂碼,導致javascript代碼錯誤。

    posted @ 2010-12-10 16:22 天狼 閱讀(5936) | 評論 (3)編輯 收藏
    國家測繪局2010年10月21日正式發布中國公眾版國家地理信息公共服務平臺“天地圖”,作為中國境內數據資源最全的地理信息服務網站,“天地圖”將為公眾提供權威、可信、統一的地理信息資源。

    “天地圖”公開開放了地圖數據服務接口,第三方使用者可以直接通過互聯網獲取地圖數據,無需授權認證,在公眾服務信息公開方面可以說是一次非常大的進步。
    “天地圖”的在線服務數據近10TB以下是“天地圖”提供的在線地理信息數據資源:

    數據類型

    數據源

    級別

    服務地址

    線劃地圖

    全球1:100萬地理底圖

    2-10

    http://tile0.tianditu.com/services/A0512_EMap

    http://tile0.tianditu.com/services/AB0512_Anno

    全國1:25萬公開版數字地形圖

    11-12

    http://tile0.tianditu.com/services/B0627_EMap1112

    全國車載導航

    13-18

    http://tile0.tianditu.com/services/siwei0608

    衛星影像

    全球250米衛星影像 (MODIS)

    2-7

    http://tile0.tianditu.com/services/sbsm0210

    全國15米衛星影像 (ETM)

    8-10

    全國2.5米衛星影像 (P5)

    11-14

    http://tile0.tianditu.com/services/e11

    http://tile0.tianditu.com/services/e12
    http://tile0.tianditu.com/services/e13
    http://tile0.tianditu.com/services/eastdawnall

    地級城市0.6米衛星影像

     (QuickBirdWorldView IWorldView II)

    15-18

    http://tile0.tianditu.com/services/sbsm1518

    數字高程模型

    全球90X90米數字高程模型

     

    http://tile0.tianditu.com/services/J07098

    地名地址

    全球1:100萬地名地址

     

    http://search.tianditu.com/wfs

    全國1:25萬地名地址


    全國車載導航地名地址


    除地名地址數據使用OGC WFS協議發布外,其他數據全部采用基于OGC WMS-C協議的分級瓦片形式發布,工作原理類似于谷歌地圖和OSM(OpenStreetMap)。

    類似谷歌地圖,“天地圖”為互聯網開發人員提供了二次開發API(武大吉奧開發的GeoGlobe二維地圖API)。

    通過分析GeoGlobe API代碼,發現它源自Openlayers,大部分代碼除了把Openlayers換成GeoSurf外,沒有任何變化。不知道Openlayers項目組就此作何感想。
    正因為如此,我們可以參考OpenLayers.Layer.TileCache和OpenLayers.Layer.XYZ類,編寫一個專用于讀取“天地圖”的TDTLayer類,使Openlayers能夠直接訪問“天地圖”的在線地圖數據。

    “天地圖”采用256×256像素,png格式的地圖瓦片文件,讀取單個文件需要四個參數:T、X、Y、L
    T=瓦片(Tile)名稱,X=瓦片橫向編碼,Y=瓦片縱向編碼,L=瓦片級別
    這個是一個完整的請求示例:http://tile0.tianditu.com/DataServer?T=AB0512_Anno&X=50&Y=12&L=6

    天地圖”地理信息數據資源列表將地圖瓦片分為16級(L=2-18),其中L=2級比例尺最小,對應全球地圖。
    L=2級只有8個瓦片文件,分別是

     X= 0 1 2 3 0 1 2 3
     Y= 0 0 0 0 1 1 1 1
    L=3級有32個瓦片文件,分別是:
     X= 0-7
     Y= 0-3
    L=4級有128個瓦片文件,分別是:
     X= 0-15
     Y= 0-7
    其余各級以此類推,每級的瓦片文件數比前一級增加4倍,其中線劃地圖10級以上,衛星地圖8級以上只提供中國境內的數據,沒有覆蓋全球。

    查看
    GeoGlobe API主代碼GeoSurfJSAPI.js文件(相當于Openlayers.js,可以了解X(x_num)、Y(y_num)、L(level)的生成方法,偽代碼如下:
    level=getLevelForResolution(map.getResolution()); //計算瓦片級別
    coef=TopTileSize.w/Math.pow(2,level); //中間系數
    x_num=this.pyramid.topTileFromX<this.pyramid.topTileToX?Math.round((bounds.left-this.pyramid.topTileFromX)/coef):Math.round((this.pyramid.topTileFromX-bounds.right)/coef);
    y_num=this.pyramid.topTileFromY<this.pyramid.topTileToY?Math.round((bounds.bottom-this.pyramid.topTileFromY)/coef):Math.round((this.pyramid.topTileFromY-bounds.top)/coef);
    根據當前分辨率計算地圖瓦片級別
    function getLevelForResolution(res){
    var ratio=map.getMaxResolution()/res;
    if(ratio<1)return 0;
    for(var level=0;ratio/2>=1;)
    {level++;ratio/=2;}
    return level;
    }

    經過簡單測試,“天地圖”和谷歌地圖在數據上差別不大,二次開發方面借助于強大的Openlayers地圖客戶端引擎不會弱于Google Map API,唯獨在速度上與谷歌地圖存在較大差距,特別是地圖放大到13級-18級時,延遲變得非常明顯,有時甚至無法顯示。
    使用Firebug跟蹤運行發現,大約1/3的地圖瓦片請求超時,導致客戶端讀取失敗。
    “天地圖”目前還處于測試階段,希望相關單位繼續改進和提升服務器端性能,快速穩定的響應大量客戶端發出的并發請求。
    測試中發現,“天地圖”開放的地圖數據服務接口從tile0.tianditu.com一直到tile7.tianditu.com。依次ping 這8個服務接口,tile1到tile7的響應速度相對較快。修改客戶端js代碼,將瓦片地圖請求平均發送給tile0到tile7 八個服務接口,可以有效加快地圖顯示速度。“天地圖”提供的GeoSurfJSAPI.js中已經包含相關代碼,通過給Layer的mirrorUrl屬性賦值,可以均衡讀取指定的多個服務接口,代碼如下:
                            var layer3 = new GeoSurf.Layer.GlobeTile("siwei0608", "http://tile6.tianditu.com/services/siwei0608", {
                                    transitionEffect: "resize",
                                    topLevel: 13,
                                    bottomLevel: 18,
                                    maxExtent: new GeoSurf.Bounds(100, 27, 110, 34),
                                    mirrorUrls: [
                                        "http://tile1.tianditu.com/services/siwei0608",
                                        "http://tile2.tianditu.com/services/siwei0608",
                                        "http://tile3.tianditu.com/services/siwei0608",
                                        "http://tile4.tianditu.com/services/siwei0608",
                                        "http://tile5.tianditu.com/services/siwei0608",
                                        "http://tile6.tianditu.com/services/siwei0608"
                                    ]
                                });

    客戶端使用上述讀取策略后,即便放大到17-18級,整幅地圖也能夠完全顯示,速度有明顯的提升。


    posted @ 2010-12-06 14:06 天狼 閱讀(8589) | 評論 (5)編輯 收藏
    發布WFS矢量地圖

    OGC WFS協議定義了地圖客戶端查詢和傳送矢量數據的方法,在查詢、分析、動態繪圖等實際應用中非常有用。MapServer支持OGC WFS 1.0.0和1.1.0規范。

    重新定義一個Mapfile文件,命名為ext2.map,內容如下:
    MAP

      NAME "vector"
        SHAPEPATH "I://cn_data"
        
        FONTSET fonts.txt
        IMAGECOLOR 255 255 255
        IMAGETYPE agg

        SIZE 800 600
        STATUS ON
        UNITS DD
        EXTENT 115.275 39.2204 117.475 40.9462
       
        OUTPUTFORMAT
            NAME agg
            DRIVER AGG/PNG
            IMAGEMODE RGB
            FORMATOPTION "INTERLACE=false"
            MIMETYPE "image/png"
        END

        PROJECTION
            "init=epsg:4326"
        END

        WEB
            METADATA
                "wms_title"                       "road wms"
                "wfs_title"                       "road wfs"
                "wms_onlineresource"              "http://192.98.151.23/cgi-bin/mapserv.exe?"  #mapserver服務器的url
                "wms_srs"                         "EPSG:4326"   #地圖坐標系        
            END
        END

        LAYER
            NAME "road"
            METADATA
                "wms_title"                       "road"
                "wfs_title"                       "road"
                "wms_srs"                         "EPSG:4326"  #圖層坐標系
                "gml_include_items"             "all"
                "gml_featureid"                 "id" #必須指定id
            END
            STATUS ON
            DATA "roa_4m.shp"
            TYPE line
            DUMP TRUE
            CLASS
                STYLE
                    COLOR "#00FF00"
                END
            END
        END

    END

    該文件中有兩組METADATA標簽,是WFS(WMS) Server所需要的,分別是MAP的METADATA標簽和LAYER的METADATA標簽。
    前者是針對整個地圖的全局定義,后者是每個圖層的元數據定義。

    保存Mapfile文件,打開瀏覽器進行測試
    http://192.98.151.23/cgi-bin/mapserv.exe?map=I:/cn_data/ext2.map&SERVICE=WFS&VERSION=1.0.0&REQUEST=GetCapabilities
    正常情況下,可以看到以下返回信息
    <WFS_Capabilities version="1.0.0" updateSequence="0" xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.0.0/WFS-capabilities.xsd">
    <!--
     MapServer version 5.2.1 OUTPUT=GIF OUTPUT=PNG OUTPUT=JPEG OUTPUT=WBMP OUTPUT=PDF OUTPUT=SWF OUTPUT=SVG SUPPORTS=PROJ SUPPORTS=AGG SUPPORTS=FREETYPE SUPPORTS=ICONV SUPPORTS=FRIBIDI SUPPORTS=WMS_SERVER SUPPORTS=WMS_CLIENT SUPPORTS=WFS_SERVER SUPPORTS=WFS_CLIENT SUPPORTS=WCS_SERVER SUPPORTS=SOS_SERVER SUPPORTS=FASTCGI SUPPORTS=THREADS SUPPORTS=GEOS SUPPORTS=RGBA_PNG INPUT=JPEG INPUT=POSTGIS INPUT=ORACLESPATIAL INPUT=OGR INPUT=GDAL INPUT=SHAPEFILE
    -->
    <Service>
    <Name>MapServer WFS</Name>
    <Title>road wfs</Title>
    <OnlineResource>
    http://192.98.151.23/cgi-bin/mapserv.exe?map=I:/cn_data/ext2.map&
    </OnlineResource>
    </Service>
    <Capability>
    <Request>
    <GetCapabilities>
    <DCPType>
    <HTTP>
    <Get onlineResource="http://192.98.151.23/cgi-bin/mapserv.exe?map=I:/cn_data/ext2.map&"/>
    </HTTP>
    </DCPType>
    <DCPType>
    <HTTP>
    <Post onlineResource="http://192.98.151.23/cgi-bin/mapserv.exe?map=I:/cn_data/ext2.map&"/>
    </HTTP>
    </DCPType>
    </GetCapabilities>
    <DescribeFeatureType>
    <SchemaDescriptionLanguage>
    <XMLSCHEMA/>
    </SchemaDescriptionLanguage>
    <DCPType>
    <HTTP>
    <Get onlineResource="http://192.98.151.23/cgi-bin/mapserv.exe?map=I:/cn_data/ext2.map&"/>
    </HTTP>
    </DCPType>
    <DCPType>
    <HTTP>
    <Post onlineResource="http://192.98.151.23/cgi-bin/mapserv.exe?map=I:/cn_data/ext2.map&"/>
    </HTTP>
    </DCPType>
    </DescribeFeatureType>
    <GetFeature>
    <ResultFormat>
    <GML2/>
    </ResultFormat>
    <DCPType>
    <HTTP>
    <Get onlineResource="http://192.98.151.23/cgi-bin/mapserv.exe?map=I:/cn_data/ext2.map&"/>
    </HTTP>
    </DCPType>
    <DCPType>
    <HTTP>
    <Post onlineResource="http://192.98.151.23/cgi-bin/mapserv.exe?map=I:/cn_data/ext2.map&"/>
    </HTTP>
    </DCPType>
    </GetFeature>
    </Request>
    </Capability>
    <FeatureTypeList>
    <Operations>
    <Query/>
    </Operations>
    <FeatureType>
    <Name>road</Name>
    <Title>road</Title>
    <SRS>EPSG:4326</SRS>
    <LatLongBoundingBox minx="80.3869" miny="18.2823" maxx="132.515" maxy="49.6272"/>
    </FeatureType>
    </FeatureTypeList>
    <ogc:Filter_Capabilities>
    <ogc:Spatial_Capabilities>
    <ogc:Spatial_Operators>
    <ogc:Equals/>
    <ogc:Disjoint/>
    <ogc:Touches/>
    <ogc:Within/>
    <ogc:Overlaps/>
    <ogc:Crosses/>
    <ogc:Intersect/>
    <ogc:Contains/>
    <ogc:DWithin/>
    <ogc:BBOX/>
    </ogc:Spatial_Operators>
    </ogc:Spatial_Capabilities>
    <ogc:Scalar_Capabilities>
    <ogc:Logical_Operators/>
    <ogc:Comparison_Operators>
    <ogc:Simple_Comparisons/>
    <ogc:Like/>
    <ogc:Between/>
    </ogc:Comparison_Operators>
    </ogc:Scalar_Capabilities>
    </ogc:Filter_Capabilities>
    </WFS_Capabilities>

    在OpenLayers中加載WFS圖層

    OpenLayers是一個功能強大的Web地圖客戶端引擎。

    接下來,我們利用OpenLayers的OpenLayers.Protocol.WFS類,顯示剛才發布的WFS圖層,代碼如下

           var protocol = OpenLayers.Protocol.WFS({
                        url: "http://192.98.151.23/cgi-bin/mapserv.exe?map=I:/cn_data/ext2.map&", //mapserver地圖服務器的url,加上mapfi了文件的路徑
                        featureType: "road", //layer的名稱
                        srsName: "EPSG:4326", //layer的坐標系
                        geometryName: "msGeometry", //geometry字段的名稱
                        featurePrefix: "ms"
                    });

    以下是全部javascript代碼:
            window.onload = function() {
                    var map = new OpenLayers.Map('mapdiv', {
                        projection: "EPSG:4326",
                        units: "degree"
                    });
                    
                    var roads = new OpenLayers.Layer.WMS("road", "http://192.98.151.23/cgi-bin/mapserv.exe?map=I:/cn_data/ext2.map&", {
                        layers: 'road',
                        transparent: 'true',
                        format: 'image/png'
                    }, {
                        isBaseLayer: false,
                        visibility: true,
                        buffer: 0
                    });
                    
                    
                    var empty = new OpenLayers.Layer("empty", {
                        isBaseLayer: true
                    });
                    
                    var select = new OpenLayers.Layer.Vector("Selection", {
                        styleMap: new OpenLayers.Style(OpenLayers.Feature.Vector.style["select"]),
                        displayInLayerSwitcher: false
                    });
                    
                    var hover = new OpenLayers.Layer.Vector("Hover", {
                        displayInLayerSwitcher: false
                    });
                    
                    map.addLayers([roads, hover, select, empty]);
                    
                    var protocol = OpenLayers.Protocol.WFS({
                        url: "http://192.98.151.23/cgi-bin/mapserv.exe?map=I:/cn_data/ext2.map&",
                        featureType: "road",
                        srsName: "EPSG:4326",
                        geometryName: "msGeometry",
                        featurePrefix: "ms"
                    });
                    
                    var control = new OpenLayers.Control.GetFeature({
                        protocol: protocol,
                        box: true,
                        hover: true,
                        multipleKey: "shiftKey",
                        toggleKey: "ctrlKey"
                    });
                    
                    control.events.register("featureselected", this, function(e){
                        select.addFeatures([e.feature]);
                    });
                    control.events.register("featureunselected", this, function(e){
                        select.removeFeatures([e.feature]);
                    });
                    control.events.register("hoverfeature", this, function(e){
                        hover.addFeatures([e.feature]);
                    });
                    
                    control.events.register("outfeature", this, function(e){
                        hover.removeFeatures([e.feature]);
                    });
                    
                    map.addControl(control);
                    control.activate();
                    
                    map.addControl(new OpenLayers.Control.LayerSwitcher());
                    map.addControl(new OpenLayers.Control.MousePosition());
                    
                    if (!map.getCenter()) {
                        map.zoomToMaxExtent();
                    }

                }

    在瀏覽器中運行html頁面,國道數據將以矢量方式傳送到客戶端,由openlayers動態繪制,鼠標移動到道路上或者選中道路,道路將實時改變顏色,在Web上實現與傳統桌面GIS應用類似的體驗效果。

    posted @ 2010-12-01 15:00 天狼 閱讀(2520) | 評論 (0)編輯 收藏
    在今年的FOSS4G國際大會上,geoserver項目組發布了2.1beta1版本。
    新版本增加了多項引人注目的功能,原文如下:

    WMS Cascading

    Something users have asked for since the addition of WMS support itself is cascading, the ability of GeoServer to proxy for another remote WMS server like MapServer or another GeoServer. This feature has many uses such as pulling in a remote base layer and overlaying local vector data onto it or securing a locally unsecured map server. Special thanks to the University of Perugia for sponsoring this feature.

    Read more about WMS cascading.

    Virtual Services

    Anyone who has published a large number of layers or feature types with GeoServer has probably at some point been annoyed by the fact that every single layer is published by a single global service. WMS has the ability to group and nest layers but WFS and WCS have no such equivalent. Well now with virtual services one can create multiple service endpoints within a single physical geoserver instance.

    Special thanks to Landgate for funding this work.

    Read more about virtual services.

    Layers from SQL

    GeoServer has always been good at publishing a flat database table. But users often need to do more such as pre filter the data in a table, or join two tables together, or generate column values on the fly with a function. Before this feature the recommendation was to create a view. However views can be a maintenance burden and are at times problematic.

    Now one can create a layer directly from an SQL query. And on top of that query definitions can be parameterized which allows one to create dynamic queries on the fly. These parameters can be restricted with regular expressions in order to prevent an SQL injection security hole.

    Special thanks to Andrea for spending much of his personal time on this one. And also to OBIS who provided the funding for the parametric component of the work.

    Read more about SQL layers.

    WPS

    With 2.1 and the arrival of WPS we welcome a new OGC service to the family. The Web Processing Service is an OGC service for performing geospatial analysis functions over the web. The specification is extensible in nature and allows for simple processes like buffering a geometry to more complex processes such as image processing.

    Historically GeoServer has been focused primarily on data delivery without any tools for performing analysis of spatial data. WPS fills that gap making GeoServer a more compete solution for geospatial web services.

    Thanks to Refractions Research for the initial contribution of the WPS module and to Andrea once again for taking personal time to bring WPS support to its current state.

    Read more about WPS. Download the WPS extension now to try it out.

    Unit of Measure

    Support for units in SLD allows one to specify values in measurements other than pixels such as feet or meters. This adds a very powerful capability to SLD that in many cases alleviates the need for multiple scale dependent rendering rules. This has the upside of greatly simplifying complex SLD documents.

    Special thanks to Milton Jonathan who did the initial GeoTools work to make unit of measure support possible and to Andrea for working with Milton to improve the initial patch. Note that this feature has also been backported to the stable 2.0.x branch. Thanks to SWECO and Malmö City of Sweden for sponsoring the backport.

    Read more about UOM support.

    DPI Scaling

    By default GeoServer renders images at a resolution of 90 DPI. While this is acceptable for the standard screen it is not acceptable for print which requires a higher resolution. Now it is possible to supply a format option to a WMS request on the fly that controls the DPI setting.

    Special thanks again to SWECO and to Malmö City of Sweden for sponsoring this work. Note also that this feature has also been backported to the stable 2.0.x branch.

    Read more about DPI scaling.



    posted @ 2010-12-01 10:42 天狼 閱讀(1761) | 評論 (0)編輯 收藏
    主站蜘蛛池模板: 日韩免费高清播放器| 一本久久免费视频| 7x7x7x免费在线观看| 久久综合九九亚洲一区| 久久久WWW免费人成精品| 亚洲日韩欧洲无码av夜夜摸| 一级女人18片毛片免费视频| 国产成人aaa在线视频免费观看 | h视频在线免费观看| 亚洲精品A在线观看| 一区视频免费观看| 亚洲精品tv久久久久久久久| 日本免费中文字幕| 亚洲人色大成年网站在线观看| 欧美男同gv免费网站观看 | 日本免费高清一本视频| 久久久久亚洲国产AV麻豆| 免费播放春色aⅴ视频| 国产精品hd免费观看| 久久精品国产亚洲网站| 99热这里有免费国产精品| 亚洲av永久综合在线观看尤物| 成人毛片免费在线观看| 日日躁狠狠躁狠狠爱免费视频 | 亚洲综合一区二区国产精品| 免费精品国产自产拍在线观看图片 | 最近2019中文字幕免费直播| 亚洲精品国产免费| 国产三级电影免费观看| 少妇性饥渴无码A区免费| 国产.亚洲.欧洲在线| 亚洲国产香蕉人人爽成AV片久久| 一个人看的www免费视频在线观看| 亚洲欧洲在线观看| 国产真人无遮挡作爱免费视频 | 亚洲AV日韩AV天堂久久| 午夜一区二区免费视频| 暖暖日本免费中文字幕| 亚洲精品蜜夜内射| 亚洲精品无码久久久影院相关影片| 免费黄色福利视频|