Locate a district

TatukGIS Internet Server LITE Samples


Choose the "Identify" option and click on the map.

Source code    Project files

This IS LISE sample shows how to access information associated with shapes using the "Identify" option. Function Locate returns a uid to get object data with function Field.

Notice that description for states.shp is not written in the locate.ttkgp file. Here we use the initialization of the states.shp.ini file. This is a very useful method when there is a need to prepare more than one project with shapes that look and work identically.


locate.aspx    Top

                        
<%@ Page Language="VB" Debug="True" %>
<%@ Register TagPrefix="ttkGIS" Namespace="TatukGIS.IS" Assembly="TatukGIS.IS" %>
<script runat="server">

    Sub GIS_FullExtent_Click(sender As Object, e As ImageClickEventArgs)
        GIS.FullExtent
    End Sub

    Sub GIS_ZoomIn_Click(sender As Object, e As ImageClickEventArgs)
        GIS.ZoomIn
    End Sub

    Sub GIS_ZoomOut_Click(sender As Object, e As ImageClickEventArgs)
        GIS.ZoomOut
    End Sub

    Sub GIS_Smaller_Click(sender As Object, e As ImageClickEventArgs)
        GIS.Width  = Unit.Pixel( GIS.Width.Value  - 54 )
        GIS.Height = Unit.Pixel( GIS.Height.Value - 40 )
    End Sub

    Sub GIS_Larger_Click(sender As Object, e As ImageClickEventArgs)
        GIS.Width  = Unit.Pixel( GIS.Width.Value  + 54 )
        GIS.Height = Unit.Pixel( GIS.Height.Value + 40 )
    End Sub

    Sub GIS_Load(sender As Object, e As EventArgs)
        GIS.Open( Page.MapPath( "data/locate.ttkgp" )
    End Sub

    Sub GIS_Click(sender As Object, e As ImageClickEventArgs)
        dim uid as integer

        if CheckBoxIdentify.Checked then
           uid = GIS.Locate( "states", e.X, e.Y )
           session("uid") = uid
           if uid <> 0 then
               GIS.FitScope ( "states", "GIS_UID=" & uid )
               GIS.Zoom=GIS.Zoom * 0.75

               TableDesc.Visible = True
               state.text = GIS.Field("states", uid, "NAME")
               population.text = GIS.Field("states", uid, "POPULATION")
               area.text = GIS.Field("states", uid, "AREA")
               capital.text = GIS.Field("states", uid, "CAPITAL")
           end if
        else
            uid=0
            session("uid") = uid
            TableDesc.Visible = False
        end if
    End Sub

    Sub GIS_AfterPaint(sender As Object, e As PaintEventArgs)
        dim uid as integer

        uid = session("uid")
        if uid <> 0 then
            GIS.DrawScope( "states", "GIS_UID = " & uid, "FlushS" )
        end if
    End Sub

    Sub CheckBoxIdentify_CheckedChanged(sender As Object, e As EventArgs)
        dim uid as integer

        if Not CheckBoxIdentify.Checked then
            uid=0
            session("uid") = uid
            TableDesc.Visible = False
        end if
    End Sub

</script>
<html>
<head>
    <link href="style.css" type="text/css" rel="stylesheet" />
</head>
<body>
    <a name="top">
    <h1>Locate a district
    </h1>
    <h2 class="comment">TatukGIS IS LITE Sample
    </h2>
    <form runat="server">
        <p>
            <br />
        </p>
        <p>
            <table cellspacing="0" cellpadding="0" border="0">
                <tbody>
                    <tr>
                        <td>
                            <asp:ImageButton id="GIS_FullExtent" onclick="GIS_FullExtent_Click" runat="server" ImageUrl="/TatukGIS_IS8/img/fullextent.gif"></asp:ImageButton>
                            <asp:ImageButton id="GIS_ZoomIn" onclick="GIS_ZoomIn_Click" runat="server" ImageUrl="/TatukGIS_IS8/img/zoomin.gif"></asp:ImageButton>
                            <asp:ImageButton id="GIS_ZoomOut" onclick="GIS_ZoomOut_Click" runat="server" ImageUrl="/TatukGIS_IS8/img/zoomout.gif"></asp:ImageButton>
                        </td>
                        <td align="right">
                            <asp:ImageButton id="GIS_Smaller" onclick="GIS_Smaller_Click" runat="server" ImageUrl="/TatukGIS_IS8/img/smaller.gif"></asp:ImageButton>
                            <asp:ImageButton id="GIS_Larger" onclick="GIS_Larger_Click" runat="server" ImageUrl="/TatukGIS_IS8/img/larger.gif"></asp:ImageButton>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2">
                            <p>
                                <ttkGIS:XGIS_VIEWERIS id="GIS" onclick="GIS_Click" runat="server" OnAfterPaint="GIS_AfterPaint" Height="360px" BorderColor="CornflowerBlue" BorderWidth="1px" OnLoad="GIS_Load" Width="460px"></ttkGIS:XGIS_VIEWERIS>
                            </p>
                        </td>
                    </tr>
                </tbody>
            </table>
        </p>
        <p>
            <asp:CheckBox id="CheckBoxIdentify" runat="server" CssClass="bold" Text="Identify" OnCheckedChanged="CheckBoxIdentify_CheckedChanged" AutoPostBack="True"></asp:CheckBox>
        </p>
        <p>
            <asp:Label id="LabelDesc" runat="server" cssclass="comment">Choose the "Identify"
            option and click on the map. </asp:Label>
        </p>
        <p>
            <asp:Table id="TableDesc" runat="server" BorderColor="Desktop" BorderWidth="1px" Width="187px" Visible="False" BorderStyle="Solid" BackColor="Transparent">
                <asp:TableRow>
                    <asp:TableCell Font-Bold="True" Text="State:"></asp:TableCell>
                    <asp:TableCell ID="State"></asp:TableCell>
                </asp:TableRow>
                <asp:TableRow>
                    <asp:TableCell Font-Bold="True" Text="Population:"></asp:TableCell>
                    <asp:TableCell ID="Population"></asp:TableCell>
                </asp:TableRow>
                <asp:TableRow>
                    <asp:TableCell Font-Bold="True" Text="Area:"></asp:TableCell>
                    <asp:TableCell ID="Area"></asp:TableCell>
                </asp:TableRow>
                <asp:TableRow>
                    <asp:TableCell Font-Bold="True" Text="Capital:"></asp:TableCell>
                    <asp:TableCell ID="Capital"></asp:TableCell>
                </asp:TableRow>
            </asp:Table>
        </p>
    </form>
    </a>
</body>
</html>

                        

locate.ttkgp    Top

                        
[TatukGIS]

[TatukGIS Layer1]
path=states.shp
name=states
                        

states.shp.ini    Top

                        
[TatukGIS Layer]
Area.OutlineWidth=-1
Area.OutlineColor=205:100:100
Area.Color=200:230:200

[TatukGIS Layer 1]
Style=FlushS
Area.Pattern=solid
Area.Color=98:180:96
Area.OutlineColor=205:100:100
Area.OutlineStyle=solid
Area.OutlineWidth=-1