<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-1250">
<TITLE>Message</TITLE>
<META content="MSHTML 6.00.6000.16544" name=GENERATOR></HEAD>
<BODY>
<DIV><FONT face=Arial size=2><SPAN class=775083821-21102007>Hi
all</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=775083821-21102007>First post for me so
hope it is not too dumb - have searched archives but not found
answers...</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=775083821-21102007></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=775083821-21102007>I have SQL Server
tables containing WKT in a "memo" field, plus X/Y fields plus MINX, MINY, MAXX,
MAXY fields defining the bounding boxes for each record.</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=775083821-21102007></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=775083821-21102007>I'm dishing this up
as a WMS just fine through MapServer, and I love this, it's so nice compared to
shapefiles/MapInfo tables etc. BUT two problems...</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=775083821-21102007></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=775083821-21102007>1. When I access the
layer in MapInfo Pro, my "identify" tool (GetFeatureInfo) works fine on
MapServer POINT layersgenerated from the WKT, but does not find anything for
POLYGON or LINE layers. The layers are set up identically (DUMP, META etc)
- I can give more info if required. Is GetFeatureInfo not supported
for WKT polys/lines? Will it be in future?</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=775083821-21102007></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN
class=775083821-21102007></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=775083821-21102007>2. Spatial
indexing. If I define a OGR VRT to use the X/Y fields, then the
query sent to SQL Server is intelligent, e.g.</SPAN></FONT></DIV>
<DIV><SPAN class=639401110-21102007><FONT face=Arial color=#0000ff size=2>SELECT
* FROM GatewayGeometry WHERE X > 614184.893276474 AND X < 631578.629575045
AND Y > 159333.447265398 AND Y < 171142.163554331</FONT></SPAN></DIV>
<DIV><SPAN class=639401110-21102007><FONT face=Arial color=#0000ff size=2><SPAN
class=775083821-21102007>which is nice and quick as these fields are
indexed.</SPAN></FONT></SPAN></DIV>
<DIV><SPAN class=639401110-21102007><FONT face=Arial color=#0000ff size=2><SPAN
class=775083821-21102007></SPAN></FONT></SPAN> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=775083821-21102007>but if I use the WKT
with this </SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=775083821-21102007><FONT
color=#0000ff><GeometryField encoding='WKT'
field='Geometry'/></FONT></SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=775083821-21102007></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=775083821-21102007>then MapServer calls
the whole table:</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN class=775083821-21102007><SPAN
class=639401110-21102007><FONT face=Arial color=#0000ff size=2><SPAN
class=639401110-21102007><FONT face=Arial color=#0000ff size=2>SELECT * FROM
GatewayGeometry
</FONT></SPAN></FONT></SPAN></SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=775083821-21102007><SPAN
class=639401110-21102007><FONT face=Arial size=2><SPAN
class=639401110-21102007><FONT face=Arial size=2>(and then obviously does the
spatial filtering in MapServer).</FONT></SPAN></FONT></SPAN></SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=775083821-21102007><SPAN
class=639401110-21102007><FONT face=Arial size=2><SPAN
class=639401110-21102007></SPAN></FONT></SPAN></SPAN></FONT> </DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN class=775083821-21102007><SPAN
class=639401110-21102007><FONT face=Arial color=#0000ff size=2><SPAN
class=639401110-21102007><FONT color=#000000>I've also tried the other method
where I just connect with</FONT> </SPAN></FONT></SPAN></SPAN></FONT></DIV>
<DIV><FONT><SPAN class=775083821-21102007><SPAN class=639401110-21102007><SPAN
class=639401110-21102007><FONT face=Arial color=#0000ff size=2>
CONNECTIONTYPE OGR<BR> CONNECTION
"ODBC:myusername/mypassword@myDSN"</FONT>
<DIV><SPAN class=639401110-21102007><FONT face=Arial color=#0000ff size=2><SPAN
class=639401110-21102007> DATA "<SPAN
class=775083821-21102007>mytable</SPAN>"</SPAN></FONT></SPAN></DIV>
<DIV><SPAN class=639401110-21102007><FONT face=Arial size=2><SPAN
class=639401110-21102007><SPAN class=775083821-21102007>and have a table in the
database called Geometry_columns etc.</SPAN></SPAN></FONT></SPAN></DIV>
<DIV><SPAN class=639401110-21102007><FONT face=Arial size=2><SPAN
class=639401110-21102007><SPAN class=775083821-21102007>This works fine, but
again it fails to send through any querying of the bounding box and just queries
the whole table every time.</SPAN></SPAN></FONT></SPAN></DIV>
<DIV><SPAN class=639401110-21102007><FONT face=Arial size=2><SPAN
class=639401110-21102007><SPAN
class=775083821-21102007></SPAN></SPAN></FONT></SPAN> </DIV>
<DIV><SPAN class=639401110-21102007><FONT face=Arial size=2><SPAN
class=639401110-21102007><SPAN class=775083821-21102007>I have seen <SPAN
class=639401110-21102007><FONT face=Arial size=2>conflicting messages on this in
MapServer and OGR help. One bit says it wants to use MINX etc as a spatial
index, but another bit says that WKT never uses a spatial
index.</FONT></SPAN></SPAN></SPAN></FONT></SPAN></DIV>
<DIV><SPAN class=639401110-21102007><FONT face=Arial size=2><SPAN
class=639401110-21102007><SPAN class=775083821-21102007><SPAN
class=639401110-21102007>Seems to me there's no reason not to use the bounding
boxes to speed things up, but some dodgy stored procedure calls seems to come
through to SQL Server, and perhaps MapServer cannot work out whether the fields
exist...</SPAN></SPAN></SPAN></FONT></SPAN></DIV>
<DIV><SPAN class=639401110-21102007><FONT face=Arial size=2><SPAN
class=639401110-21102007><SPAN class=775083821-21102007><SPAN
class=639401110-21102007>These commands hit the SQL
server:</SPAN></SPAN></SPAN></FONT></SPAN></DIV>
<DIV><SPAN class=639401110-21102007><FONT><SPAN class=639401110-21102007><SPAN
class=775083821-21102007><SPAN class=639401110-21102007>
<DIV><SPAN class=639401110-21102007><FONT face=Arial color=#0000ff size=2>SELECT
f_table_name, f_geometry_column, geometry_type FROM
geometry_columns</FONT></SPAN></DIV>
<DIV><SPAN class=639401110-21102007><FONT face=Arial size=2><SPAN
class=775083821-21102007> (OK)</SPAN></FONT></SPAN></DIV>
<DIV><SPAN class=639401110-21102007><FONT face=Arial color=#0000ff size=2>exec
..sp_pkeys N'GatewayGeometry', N'', N''</FONT></SPAN></DIV>
<DIV><SPAN class=639401110-21102007><FONT face=Arial><FONT color=#0000ff><FONT
size=2> <SPAN class=775083821-21102007><FONT
color=#000000>(fails)</FONT></SPAN></FONT></FONT></FONT></SPAN></DIV>
<DIV><SPAN class=639401110-21102007><FONT face=Arial color=#0000ff size=2><SPAN
class=775083821-21102007><SPAN class=639401110-21102007><FONT face=Arial
color=#0000ff size=2>exec sp_pkeys N' ', N'',
NULL</FONT></SPAN></SPAN></FONT></SPAN></DIV>
<DIV><SPAN class=639401110-21102007><FONT><SPAN class=775083821-21102007><SPAN
class=639401110-21102007></SPAN></SPAN></FONT><SPAN
class=775083821-21102007></SPAN><FONT face=Arial><FONT color=#0000ff><FONT
size=2> <SPAN class=775083821-21102007><FONT color=#000000>
(returns nothing)</FONT></SPAN></FONT></FONT></FONT></SPAN></DIV>
<DIV><SPAN class=639401110-21102007><FONT face=Arial color=#0000ff size=2>exec
sp_columns N'GatewayGeometry', NULL, NULL, NULL</FONT></SPAN></DIV>
<DIV><SPAN class=639401110-21102007><SPAN class=775083821-21102007><FONT
face=Arial color=#0000ff size=2> <FONT
color=#000000>(OK)</FONT></FONT></SPAN></SPAN></DIV>
<DIV><SPAN class=639401110-21102007><SPAN class=775083821-21102007><FONT
face=Arial color=#0000ff size=2>and finally</FONT></SPAN></SPAN></DIV>
<DIV><SPAN class=639401110-21102007><SPAN class=775083821-21102007><SPAN
class=639401110-21102007><FONT face=Arial color=#0000ff size=2><SPAN
class=639401110-21102007><FONT face=Arial color=#0000ff size=2>SELECT * FROM
GatewayGeometry</FONT></SPAN></FONT></SPAN></SPAN></SPAN></DIV>
<DIV><SPAN class=639401110-21102007><SPAN class=775083821-21102007><SPAN
class=639401110-21102007><FONT face=Arial color=#0000ff size=2><SPAN
class=639401110-21102007></SPAN></FONT></SPAN></SPAN></SPAN> </DIV>
<DIV><SPAN class=639401110-21102007><SPAN class=775083821-21102007><SPAN
class=639401110-21102007><FONT face=Arial color=#0000ff size=2><SPAN
class=639401110-21102007>Can I do better?
</SPAN></FONT></SPAN></SPAN></SPAN></DIV>
<DIV><SPAN class=639401110-21102007><SPAN class=775083821-21102007><SPAN
class=639401110-21102007><FONT face=Arial color=#0000ff size=2><SPAN
class=639401110-21102007></SPAN></FONT></SPAN></SPAN></SPAN> </DIV>
<DIV><SPAN class=639401110-21102007><SPAN class=775083821-21102007><SPAN
class=639401110-21102007><FONT face=Arial color=#0000ff size=2><SPAN
class=639401110-21102007>best wishes</SPAN></FONT></SPAN></SPAN></SPAN></DIV>
<DIV><SPAN class=639401110-21102007><SPAN class=775083821-21102007><SPAN
class=639401110-21102007><FONT face=Arial color=#0000ff size=2><SPAN
class=639401110-21102007></SPAN></FONT></SPAN></SPAN></SPAN> </DIV>
<DIV><SPAN class=639401110-21102007><SPAN class=775083821-21102007><SPAN
class=639401110-21102007><FONT face=Arial color=#0000ff size=2><SPAN
class=639401110-21102007>Crispin</SPAN></FONT></SPAN></SPAN></SPAN></DIV>
<DIV><SPAN class=639401110-21102007><SPAN class=775083821-21102007><SPAN
class=639401110-21102007><FONT face=Arial color=#0000ff size=2><SPAN
class=639401110-21102007></SPAN></FONT></SPAN></SPAN></SPAN> </DIV></SPAN></SPAN></SPAN></FONT></SPAN></DIV></SPAN></SPAN></SPAN></FONT></DIV></BODY></HTML>
<BR>
<P><FONT SIZE=2>No virus found in this outgoing message.<BR>
Checked by AVG Free Edition.<BR>
Version: 7.5.488 / Virus Database: 269.15.3/1082 - Release Date: 20/10/2007 14:59<BR>
</FONT> </P>