When working with spatial data, you may want to view a geometry as an image to understand what the data represents. SQL Anywhere offers two ways of viewing geometries:
Spatial Preview tab The Spatial Preview tab is available from the Results pane in Interactive SQL. It allows you to look at geometry values one at a time in the results.
Each instance of Interactive SQL is associated with a different connection to a database. When you open an instance of the Spatial Viewer from within Interactive SQL, that instance of Spatial Viewer remains associated with that instance of Interactive SQL, and shares the connection to the database.
This means that when you execute a query in the Spatial Viewer, if you attempt to execute a query in the associated instance of Interactive SQL, you will get an error. Likewise, if you have multiple instances of the Spatial Viewer open that were created by the same instance of Interactive SQL, only one of those instances can execute a query at a time; the rest have to wait for the query to finish.
Execute the following query in Interactive SQL:
SELECT * FROM SpatialShapes;
Double-click the any value in the Shapes column in the Results pane to open the value in the Value window.
The value is displayed as text on the Text tab of the Value window.
By default, Interactive SQL truncates values in the Results pane to 256 characters. If Interactive SQL returns an error indicating that the full column value could not be read, increase the truncation value. To do this, choose Tools » Options and pick SQL Anywhere in the left pane. On the Results tab, change Truncation Length to a high value such as 5000. Click OK to save your changes, and execute the query again.
Click the Spatial Preview tab to see the geometry as a Scalable Vector Graphic (SVG).
Use the Previous Row and Next Row buttons to view other rows in the result set.
In Interactive SQL, select Tools » Spatial Viewer.
In the Spatial Viewer, execute the following query in the SQL pane and then click Execute:
SELECT * FROM SpatialShapes;
The image displayed in the Results area reflects all of the geometries in the result set. This is different from viewing geometries in the Spatial Preview tab in Interactive SQL, where you only see a preview of the geometry you selected from the results.
The order of rows in a result matter to how the image appears in the Spatial Viewer because the image is drawn in the order in which the rows are processed, with the most recent appearing on the top. This means that shapes that occur later in a result set can obscure ones that occur earlier in the result set.
You can use the Draw Outlined Polygons tool to remove the coloring from the polygons in a drawing to reveal the outline of all shapes. This tool is located beneath the image, near the controls for saving, zooming, and panning. Here is an example of how the image appears as outlines:
Discuss this page in DocCommentXchange.
|Copyright © 2010, iAnywhere Solutions, Inc. - SQL Anywhere 12.0.0|