TatukGIS Internet Server (IS) v10可以輕松地創(chuàng)建REST服務(wù),使用JSON編碼公開完整的TatukGIS功能。
IS v10 Beta版新功能介紹
示例REST項(xiàng)目中,坐標(biāo)系之間的重投影展示可以在這里進(jìn)行測試。下面是Geometry/Project示例的代碼:
<%@ Page Language="VB" Debug="True" %>
<%@ Import Namespace="TatukGIS.IS.Extensions.Rest" %>
<%@ Import Namespace="TatukGIS.NDK" %>
<!DOCTYPE html>
<script runat="server">
Function DoRest(_context As RestHelper) As Object
Dim geo As JsonGeometry
Dim res As JsonGeometry
Dim i_from_cs As Integer = _context.ParamAsInteger("FromCS")
Dim i_to_cs As Integer = _context.ParamAsInteger("ToCS")
Dim s_geo As String = _context.ParamAsString("Geometry")
Dim from_cs As TGIS_CSCoordinateSystem = TGIS_CSFactory.ByEPSG(i_from_cs)
If from_cs.EPSG = 0 Then
Throw New Exception("'FromCS' is unknown")
End If
Dim to_cs As TGIS_CSCoordinateSystem = TGIS_CSFactory.ByEPSG(i_to_cs)
If to_cs.EPSG = 0 Then
Throw New Exception("'ToCS' is unknown")
End If
If from_cs.EPSG = to_cs.EPSG Then
_context.Message = "'FromCS & 'ToCS' represent same CS"
End If
Try
geo = _context.FromJson(Of JsonGeometry)(s_geo)
Catch ex_tmp As Exception
Throw New Exception("Bad 'geometry'. " + ex_tmp.Message)
End Try
If (geo.Value Is Nothing) Or (geo.Value.IsEmpty) Then
Throw New Exception("'Geometry' is null or empty")
End If
Dim la As TGIS_LayerVector = New TGIS_LayerVector()
la.CS = from_cs
la.Open()
Dim shp_tmp = la.AddShape(geo.Value)
res.Value = shp_tmp.CreateCopyCS(to_cs)
Return res
End Function
Sub Page_Load()
Dim rest As New RestHelper( AddressOf DoRest )
End Sub
</script>
<head runat="server">
<title>Rest - Project</title>
</head>
<body>
Usage etc.
</body>
</html>
標(biāo)簽:
GIS
本站文章除注明轉(zhuǎn)載外,均為本站原創(chuàng)或翻譯。歡迎任何形式的轉(zhuǎn)載,但請務(wù)必注明出處、不得修改原文相關(guān)鏈接,如果存在內(nèi)容上的異議請郵件反饋至chenjj@fc6vip.cn
文章轉(zhuǎn)載自:慧都控件網(wǎng)