彩票走势图

使用TatukGIS Internet Server (IS) v10轻松实现REST服务

原创|使用教程|编辑:龚雪|2014-01-07 11:00:20.000|阅读 198 次

概述:上篇文章中,我们介绍了使用即将发布的新版IS你可以轻松地将现有的地图项目转换为Web Tiles,本文将为你介绍Internet Server v10如何实现REST服务。

# 慧都年终大促·界面/图表报表/文档/IDE等千款热门软控件火热促销中 >>

相关链接:

TatukGIS Internet Server (IS) v10可以轻松地创建REST服务,使用JSON编码公开完整的TatukGIS功能。

IS v10 Beta版新功能介绍

示例REST项目中,坐标系之间的重投影展示可以在这里进行测试。下面是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>

标签:GIS

本站文章除注明转载外,均为本站原创或翻译。欢迎任何形式的转载,但请务必注明出处、不得修改原文相关链接,如果存在内容上的异议请邮件反馈至chenjj@pclwef.cn

文章转载自:慧都控件网

为你推荐

  • 推荐视频
  • 推荐活动
  • 推荐产品
  • 推荐文章
  • 慧都慧问
扫码咨询


添加微信 立即咨询

电话咨询

客服热线
023-68661681

TOP