hi,

this is the same problem that ian johnson already reported to this list
(11/25/99). unfortunately I didn't find a satisfying solution to it in
the mail archive. so:

We need to show points in a map. We cannot add it 
with "AddServerLayer" but want to add each point 
individually.
For our purposes the solution below is too slow.
The performance seems to be slowed only by calling:
 Map1.Layers(1).AddFeature f

Are there other possibilities - f.e. creating a 
FeatureCollection containing all points and adding 
it to the layer in one piece with one command?


Private Sub showPointsInMap()
Dim lyr     As MapXLib.Layer
Dim f       As New Feature
Dim i       As Integer
Dim n       As Integer
Dim realX   As Double
Dim realY   As Double
On Error GoTo ExitOnErr

'// prepare layer
n = Map1.Layers.Count
For i = 1 To n
   If Map1.Layers(i).Name = "tmpLayer" Then
      Exit For
   End If
Next ' i
If i > n Then
   ' Create temporary layer
   Set lyr = Map1.Layers.CreateLayer("tmpLayer", , 1)
End If

'// prepare database
datP.DatabaseName = "X:\myAccessDB.mdb"
datP.RecordSource = "SELECT tabMain.r, tabMain.h FROM tabMain"
datP.Refresh

'// prepare feature object / it exists already "Dim f As New Feature"
' attach feature (what for?)
f.Attach Map1
' set attributes
f.Type = miFeatureTypeSymbol
f.Style = Map1.DefaultStyle

'// add features to layer
Do Until datP.Recordset.EOF
   ' Get coords
   realX = datP.Recordset.Fields("r")
   realY = datP.Recordset.Fields("h")
   ' set coords
   f.Point.Set realX, realY
   ' add to map
   Map1.Layers(1).AddFeature f
   ' move to next dataset
   datP.Recordset.MoveNext
Loop

ExitOnErr:

Exit Sub

End Sub

--
/   Jens Fitzke        GIS-EXperimental-SErver EXSE \
\  phone ++49 (0)228/73-2098  fax -9658             /
/ e-mail mailto:[EMAIL PROTECTED]             \
\    www http://www.giub.uni-bonn.de/exse           /
----------------------------------------------------------------------
To unsubscribe from this list, send e-mail to [EMAIL PROTECTED] and put
"unsubscribe MAPINFO-L" in the message body, or contact [EMAIL PROTECTED]

Reply via email to