In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
The usage of GeoRSS in SQL Server 2008 spatial data application is believed to be at a loss for many inexperienced people. Therefore, this paper summarizes the causes and solutions of the problem. Through this article, I hope you can solve this problem.
GeoRSS is a way to describe and locate the physical location of Internet content. By using GeoRSS, it is possible to search for Web sites or geographically related projects. GeoRSS uses Geographic markup language (GML), that is, the method of storing and transmitting geographic data using Extensible markup language (Extensible Markup Language, XML). The original GML model is based on the Resource description Framework (RDF) developed by the World Wide Web Alliance (W3C). GML maintains many of the features of RDF, including intelligent agents and a standard syntax for describing and querying data. GeoRSS is a standard used to include geospatial data in RSS feeds. It defines a specific format called GeoRSS GML, which is used to include data in GML format in the feed. Client applications can subscribe to GeoRSS feeds in the same way as regular RSS feeds. You can easily import data in GeoRSS format into Microsoft Bing Maps and Google Maps.
I. GeoRSS aggregation format
It is believed that many friends have played RSS subscriptions, and the format of their aggregated data is carried by XML, which mainly includes header information and body information, which may be composed of one or more items of data. The following is the aggregation format of RSS:
The name of the website or column
The URL address of the website or column
A brief introduction to a website or column
News headlines
Link address of the news
Brief introduction of the news
Press release time
Name of the news author
……
The XML data format of GeoRSS is almost the same as that of RSS, but the description information of geospatial data is extended by using GML on the basis of RSS, such as GeoRSS data.
Urn:uuid:7e8ee974-9181-4eae-ad65-55d29175d942
Urn:uuid:53664db3-4598-45d4-a727-022c6203322e
Convention Center
43.296700-87.987500 43-88-44-89
2. GeoRSS space coding
There are usually three kinds of GeoRSS encodings, namely simple encoding, GML encoding, and W3C coding. For details, please refer to:.
Simple coding is usually used to define regular spatial data such as points, lines and polygons, while GML is usually suitable for defining irregular spatial data, such as prefecture and city areas.
Define GeoRSS data
Defining GeoRSS data is mainly about playing with GeoRSS spatial coding, knowing how to define points, lines, polygons, and irregular spatial graphics. The following GeoRSS defines a point (Chongqing) coordinate.
Chongqing
Chongqing coordinates
Urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a
2011-3-25 23:35:00
Summary >
29.5076372217973 106.489384971208
The same definition of a spatial line segment, but the use of different GeoRSS coding, the following definition of [Chengdu-Chongqing] spatial line segment example.
30.6666587469201 104.062021177233 29.5076372217973 106.489384971208
Fourth, create GeoRSS aggregate stored procedures
The function of creating GeoRSS aggregate stored procedure is to format spatial data into GeoRSS data format, query spatial data in the stored procedure, convert spatial data to GML and construct the data output of GeoRSS. In the article "SQL Server 2008 Spatial data Application Series 9: importing map data in ESRI format using spatial tools (Spatial Tools)", it is realized to import shp data into SQL Server 2008. This article takes this data as an example to create a stored procedure to publish GeoRSS.
USE [BingMapsDB]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo]. [CQGeoRSSFeeder]
AS
BEGIN
SET NOCOUNT ON
-- define XML type variables to store GeoRSS content
DECLARE @ GeoRSS xml
WITH XMLNAMESPACES (
'http://www.opengis.net/gml' AS gml
'http://www.georss.org/georss' AS georss
)
SELECT @ GeoRSS =
(SELECT
[NAME] AS title
[NAME] AS description
'http://www.beginningspatial.com/' + CAST ([ID] AS varchar (8)) AS link
Geom.AsGml () AS [georss:where]
FROM
CQ_Region
FOR XML PATH ('item'), ROOT (' channel')
)
/ * *
* use XQuery to format XML results
* * /
SELECT @ GeoRSS.query ('
SQL Server 2008 GeoRSS
GeoRSS data description
Http://www.beginningspatial.com
{
For $e in channel/item
Return
{$e/title/text ()}
{$e/description/text ()}
{$e/link/text ()}
{$e/pubDate/text ()}
{
For $child in $eCompact GeorssWhere *
Return
If (fn:local-name ($child) = "Point") then {$child/*}
Else if (fn:local-name ($child) = "LineString") then {$child/*}
Else if (fn:local-name ($child) = "Polygon") then {$child/*}
Else if (fn:local-name ($child) = "MultiPoint") then {$child/*}
Else if (fn:local-name ($child) = "MultiCurve") then {$child/*}
Else if (fn:local-name ($child) = "MultiSurface") then {$child/*}
Else if (fn:local-name ($child) = "MultiGeometry") then {$child/*}
Else ()
}
}
') AS GeoRSSFeed
End
Note: after the implementation of the stored procedure, you can establish the GeoRSS output of all the spatial data in the table, the output content is relatively large, here do not paste the XML results, along with the sample code at the end of this article to provide to you.
.net Publishing GeoRSS subscription
The .net server can publish GeoRSS subscription services through ASPX, ASHX, etc. This step is actually very simple, which is to directly call the above stored procedure, and the spatial data in can be output to the client in the data format of GeoRSS. The following is a detailed code implementation:
Using System
Using System.Collections.Generic
Using System.Linq
Using System.Web
Using System.Data.SqlClient
Namespace GeoRSSService
{
/ / /
/ / publish the spatial data in SQL Server 2008 as GeoRSS.
/ / /
Public class GeoRSSHandler: IHttpHandler
{
Public void ProcessRequest (HttpContext context)
{
Context.Response.ContentType = "text/xml"
Context.Response.Charset = "iso-8859-1"
Context.Response.CacheControl = "no-cache"
Context.Response.Expires = 0
SqlConnection myConn = new SqlConnection (
@ "server=.;database=BingMapsDB;uid=sa;pwd=beniao;")
MyConn.Open ()
String myQuery = "exec dbo.CQGeoRSSFeeder"
SqlCommand myCMD = new SqlCommand (myQuery, myConn)
SqlDataReader myReader = myCMD.ExecuteReader ()
While (myReader.Read ())
{
/ / output GeoRSS to the client
Context.Response.Write (myReader ["GeoRSSFeed"] .ToString ()
}
MyReader.Close ()
MyConn.Close ()
}
Public bool IsReusable
{
Get
{
Return false
}
}
}
}
After reading the above, have you mastered the usage of GeoRSS in SQL Server 2008 spatial data applications? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.