自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

SQL Server 2008空間應用之呈現(xiàn)GeoRSS訂閱的空間數(shù)據(jù)

數(shù)據(jù)庫 SQL Server
GeoRSS是一種描述和查明互聯(lián)網(wǎng)內容所在物理位置的方法。通過使用GeoRSS,搜索Web站點或者與地理位置有關的項目就成為可能。本文我們主要就介紹一下SQL Server 2008空間應用之在Bing Maps呈現(xiàn)GeoRSS訂閱的空間數(shù)據(jù)的相關知識,希望能夠對您有所幫助。

SQL Server 2008空間應用之呈現(xiàn)GeoRSS訂閱的空間數(shù)據(jù)的相關知識是本文我們主要要介紹的內容,接下來就讓我們一起來了解一下這部分內容。GeoRSS是一種描述和查明互聯(lián)網(wǎng)內容所在物理位置的方法。通過使用GeoRSS,搜索Web站點或者與地理位置有關的項目就成為可能。

GeoRSS利用地理標識語言(GML),即利用可擴展標記語言 (Extensible Markup Language, XML)存儲和傳輸?shù)乩頂?shù)據(jù)的方法。原始的GML模型以由World Wide Web聯(lián)盟(W3C)所開發(fā)的資源描述框架(RDF)為基礎。GML保持著RDF的許多特性,包括智能代理和一個用于描述和查詢數(shù)據(jù)的標準語法。

GeoRSS 是在RSS 訂閱源中包含地理空間數(shù)據(jù)時所用的一個標準,它定義了一種名為GeoRSS GML 的特定格式,用來在訂閱源中包含GML 格式的數(shù)據(jù)??蛻舳藨贸绦蚩梢杂嗛咷eoRSS 訂閱源,訂閱方式與訂閱常規(guī) RSS 訂閱源相同。可以輕松地將 GeoRSS 格式的數(shù)據(jù)導入Microsoft Bing Maps、Google Maps中,同樣也可以將空間數(shù)據(jù)庫中的空間數(shù)據(jù)發(fā)布為GeoRss訂閱后快速的在GIS中呈現(xiàn),本篇將介紹如何基于微軟Bing Maps for Silverlight中呈現(xiàn)GeoRss訂閱的空間數(shù)據(jù)。

創(chuàng)建GeoRss閱讀器

創(chuàng)建GeoRss閱讀器的目的是為了動態(tài)的請求GeoRss地址,將GeoRss數(shù)據(jù)解析為自己想要的數(shù)據(jù)結構,如下便是根據(jù)自己的需求結合GeoRss定義的一種數(shù)據(jù)結構樣例。

核心原理就是使用WebClient動態(tài)的發(fā)起http請求,將返回的GeoRss數(shù)據(jù)通過Linq To XML的方式解析為對象結構的數(shù)據(jù)。其實現(xiàn)非常簡單,不做具體分析,詳細代碼如下所示:

  1. usingSystem.Collections.Generic;  
  2. usingSystem;  
  3. usingSystem.Net;  
  4. usingSystem.Xml.Linq;  
  5. usingSystem.Linq;  
  6. usingSystem.Windows;  
  7. usingMicrosoft.Maps.MapControl;  
  8. namespaceGeoRss.Map.GeoRssUtils  
  9. {  
  10. publicdelegatevoidDownloadGeoRssCompletedEventHandler(List<GeoRssItem>items);  
  11. publicdelegatevoidDownloadGeoRssExceptionEventHandler(Exceptione);  
  12. publicclassGeoRssReader  
  13. {  
  14. publicGeoRssReader()  
  15. {  
  16. wc=newWebClient();  
  17. wc.DownloadStringCompleted+=WebClientDownloadGeoRssCompleted;  
  18. }  
  19. publicGeoRssReader(Uriuri)  
  20. :this()  
  21. {  
  22. this.uri=uri;  
  23. }  
  24. publicGeoRssReader(Uriuri,DownloadGeoRssCompletedEventHandlerevh)  
  25. :this(uri)  
  26. {  
  27. DownloadGeoRssCompleted+=evh;  
  28. }  
  29. publicUriuri{get;set;}  
  30. publiceventDownloadGeoRssCompletedEventHandlerDownloadGeoRssCompleted;  
  31. publiceventDownloadGeoRssExceptionEventHandlerDownloadGeoRssException;  
  32. publicvoidReadAsync()  
  33. {  
  34. if(DownloadGeoRssCompleted.Target!=null)  
  35. {  
  36. wc.DownloadStringAsync(uri);  
  37. }  
  38. }  
  39. #region_private  
  40. privatereadonlyWebClientwc;  
  41. privatevoidWebClientDownloadGeoRssCompleted(objectsender,DownloadStringCompletedEventArgse)  
  42. {  
  43. try  
  44. {  
  45. XNamespacensXml="http://www.w3.org/2005/Atom";  
  46. XNamespacensGeorss="http://www.georss.org/georss";  
  47. XNamespacensGeo="http://www.w3.org/2003/01/geo/wgs84_pos#";  
  48. XNamespacensMedia="http://search.yahoo.com/mrss/";  
  49. varitems=fromiteminXElement.Parse(e.Result).Descendants("item")  
  50. selectnewGeoRssItem  
  51. {  
  52. Title=(item.Element("title")!=null)?item.Element("title").Value:null,  
  53. Link=(item.Element("link")!=null)?item.Element("link").Value:null,  
  54. Description=(item.Element("description")!=null)?item.Element("description").Value:null,  
  55. PubData=(item.Element("pubDate")!=null)?item.Element("pubDate").Value:null,  
  56. Locatios=ParserLocations(XElement.Parse(item.LastNode.ToString().Replace(":","X")).Value)  
  57. };  
  58. if(DownloadGeoRssCompleted.Method!=null)  
  59. {  
  60. DownloadGeoRssCompleted.Invoke(items.ToList());  
  61. }  
  62. }  
  63. catch(Exceptionex)  
  64. {  
  65. if(DownloadGeoRssException.Method!=null)  
  66. {  
  67. DownloadGeoRssException.Invoke(ex);  
  68. }  
  69. else  
  70. {  
  71. throw;  
  72. }  
  73. }  
  74. }  
  75. privateLocationCollectionParserLocations(stringpoints)  
  76. {  
  77. LocationCollectionlc=newLocationCollection();  
  78. string[]ps=points.Split('');  
  79. for(inti=0;i<ps.Length;i+=2)  
  80. {  
  81. lc.Add(newLocation(double.Parse(ps[i]),double.Parse(ps[i+1])));  
  82. }  
  83. returnlc;  
  84. }  
  85. #endregion  
  86. }  

基于SLBM呈現(xiàn)GeoRss數(shù)據(jù)

引入Bing Maps Silverlight Control的控件庫,定義一個專門的MapLayer圖層來呈現(xiàn)GeoRss數(shù)據(jù),其Silverlight前臺的代碼如下。

  1. <Gridx:NameGridx:Name="LayoutRoot"Background="White"> 
  2. <map:Mapx:Namemap:Mapx:Name="map"Margin="0,0,0,0"CredentialsProvider="{StaticResourceMyCredentials}" 
  3. ScaleVisibility="Visible" 
  4. CopyrightVisibility="Collapsed"> 
  5. <map:MapLayerNamemap:MapLayerName="mlayer"></map:MapLayer> 
  6. </map:Map> 
  7. </Grid> 

應用程序加載的過程中使用上面所開發(fā)完成的GeoRss閱讀器進行數(shù)據(jù)讀取并解析,隨后將結果呈現(xiàn)在Bing Maps Silverlight Control的應用中。代碼如下:

  1. publicMainPage()  
  2. {  
  3. InitializeComponent();  
  4. stringurl="http://localhost:32484/SHBuildingGeoHandler.ashx";  
  5. GeoRssReaderreader=newGeoRssReader(newUri(url,UriKind.RelativeOrAbsolute));  
  6. reader.DownloadGeoRssCompleted+=newDownloadGeoRssCompletedEventHandler(reader_DownloadGeoRssCompleted);  
  7. reader.ReadAsync();  
  8. }  
  9. voidreader_DownloadGeoRssCompleted(List<GeoRssItem>items)  
  10. {  
  11. //System.Diagnostics.Debug.WriteLine(items.Count);  
  12. foreach(variteminitems)  
  13. {  
  14. MapPolygonmp=newMapPolygon();  
  15. mp.Locations=item.Locatios;  
  16. mp.Fill=newSolidColorBrush(Colors.Red);  
  17. this.mlayer.Children.Add(mp);  
  18. }  

SQL Server 2008空間應用之呈現(xiàn)GeoRSS訂閱的空間數(shù)據(jù)

關于SQL Server 2008空間應用之Bing Maps中呈現(xiàn)GeoRSS訂閱的空間數(shù)據(jù)的相關知識就介紹到這里了,希望本次的介紹能夠對您有所收獲!

【編輯推薦】

  1. SQL Server 2005導入Oracle 10g的C#源碼
  2. SQL Server 2008快速清理日志文件的代碼
  3. SQL Server 2008數(shù)據(jù)庫中CDC的功能使用及說明
  4. SQL Server 2008阻止保存要求重新創(chuàng)建表的更改的問題
  5. SQL Server數(shù)據(jù)庫row_number() over() 來自動產(chǎn)生行號
責任編輯:趙鵬 來源: 博客園
相關推薦

2011-02-21 13:06:42

Microsoft S

2011-03-22 15:10:49

Bing MapsSQL Server

2011-03-22 10:20:18

Bing MapsSQL Server

2011-03-22 09:17:12

SQLCRLSQL Server

2009-04-16 17:55:55

SQL Server 空間數(shù)據(jù).NET

2011-02-21 13:41:14

SQL Server

2011-02-21 10:26:53

Microsoft S

2011-02-21 13:23:54

微軟 SQL Serv

2011-02-21 10:47:44

Microsoft S

2011-02-21 13:06:34

SQL Servr 2

2011-03-22 15:36:44

Spatial TooSQL Server

2009-08-28 11:38:15

MapPoint

2009-04-16 17:38:24

SQL Server 空間數(shù)據(jù)智能

2009-01-20 13:39:56

數(shù)據(jù)挖掘空間數(shù)據(jù)方法

2010-09-07 16:28:58

DB2 空間數(shù)據(jù)

2022-09-14 11:27:19

物聯(lián)網(wǎng)大數(shù)據(jù)智慧城市

2022-03-30 09:30:00

數(shù)據(jù)庫地理空間查詢SQL

2011-08-15 17:55:49

提取MapInfo地圖SQL Server

2024-10-18 17:03:16

Python地理空間數(shù)據(jù)處理

2010-05-07 12:35:05

Oracle spat
點贊
收藏

51CTO技術棧公眾號