Dear MapX gurus
I have a (major) speed problem using MapX version 4 and hope that
someone can give me the solution that seems to be hiding from me!
I am trying to convert a mapping application from MapInfo Pro (used as an
OLE automation object) to MapX. The core of the application involves
making a series of SQL selections from a number of open MapInfo tables
(which are quite large - potentially hundreds of thousands of records -
and are not themselves displayed), and displaying the selectons as a
series of layers on a map. The selection criteria may be updated quite
frequently (perhaps every few minutes, perhaps several times with a few
seconds between each update) and the map redrawn. Speed is obviously of
the essence.
Using MapInfo Pro, I simply add the queries as layers to the map and they
plot almost instantaneously - the whole process of querying and replotting
the map takes at most a few seconds.
In MapX I use Search to create a features collection, create a new map
layer, and then add the features collection to the map layer (code below).
My couple of seconds has now turned into several minutes (with about 8000
objects in the selection) and that's just for one miserable points layer
-- there could be 10 or 20 layers, including complex line and area
features. The speed is -- perhaps unsurprisingly -- reminiscent of the
speed of creation of objects in MapBasic.
Although there are a couple of tweeks I can apply, such as using
BeginAccess/EndAccess, I am not anticipating that this is going to solve
the problem. What I really need is a substantially different way of doing
things.
So, can anyone help with a way of displaying a selection or feature
collection as a new map layer without having to insert the objects into a
new layer. Thematic mapping with non-selected objects rendered invisible
is not really an option, because one could be waiting minutes while all
the invisible objects draw.
I hope there IS a solution ... Help!
Ian Johnson
------------------------------------
function DoLocalSQLselect(WhereClause :String;
Var tmLayer:LayerInfoRecType;
GeneratedLayerName :String): Integer;
{ DoSQLSelect: Runs an SQL selection to create a collection of features
and add the collection to a new layer}
Var i:integer; unusedParam: OleVariant;
ds, ftrs, Lyr, NewLayer: Variant;
Begin
TVarData(unusedParam).vType := varError;
TVarData(unusedParam).vError := DISP_E_PARAMNOTFOUND;
{Select features from a table in the overview map}
lyr := OverviewMap.Layers.item(tmLayer.SourceDatasetTable);
{Make the MapInfo table fields accessible to search}
ds := OverviewMap.Datasets.Add(midatasetlayer, Lyr, unusedParam,
unusedParam,unusedParam, Lyr.Name,unusedParam,unusedParam);
ftrs:=OverviewMap.Layers.
Item(tmLayer.SourceDatasetTable).Search(WhereClause);
{Create a new map layer as layer 1 on the main map}
NewLayer:=MainMap.Layers.CreateLayer
(GeneratedLayerName,'',1,unusedParam,unusedParam);
{Insert selected features into new layer}
(****** THIS NEXT STATEMENT TAKES _FOREVER_ *******)
For i:=1 to ftrs.count do Newlayer.AddFeature(ftrs.item[i]);
End { DoLocalSQLselect };
========================================================================
Ian Johnson [[EMAIL PROTECTED]]
Director, Archaeological Computing Laboratory
Senior Research Fellow, School of Archaeology,
A14 University of Sydney NSW 2006, Australia
http://www.archaeology.usyd.edu.au/
+61 2 9351 3142 tel
+61 2 9351 6392 fax
----------------------------------------------------------------------
To unsubscribe from this list, send e-mail to [EMAIL PROTECTED] and put
"unsubscribe MAPINFO-L" in the message body, or contact [EMAIL PROTECTED]