Niklas, You need a valid Map object to start with. Either use the map object on a form (preferable as default properties are viewable/editable at design time) or create one. Then the attach should work. Phil.
----- Original Message ----- From: "Karlsson,Niklas" <[EMAIL PROTECTED]> To: "Philip Waight" <[EMAIL PROTECTED]> Sent: Friday, September 20, 2002 6:49 PM Subject: RE: MI-L MapX performance - Layer.AddFeature (#2) Hi Philip, Sorry for asking some really trivial stuff but I haven't actually used MapX before.. But how do I create a new standalone feature which can be added to a collection ? I've tried this: var f: CMapXFeature; ftrs : CMapXFeatures; rect: CMapXRectangle; begin rect := CoRectangle.Create; rect.Set_(MapX1, MapY1, MapX2, MapY2); f := Map1.FeatureFactory.CreateRegion(rect, Map1.DefaultStyle); ftrs.Add(f); But when i'm going to add the object to the "features" object, i get the error "Operation not allowed on a standalone feature object". If I try to attach the object to my map prior to adding it I get the error "Unable to attach the object to the map. Make sure Map object is valid." instead... What do I do wrong? BR // Niklas -----Original Message----- From: Philip Waight [mailto:[EMAIL PROTECTED]] Sent: den 19 september 2002 23:04 To: Karlsson,Niklas Cc: [EMAIL PROTECTED] Subject: Re: MI-L MapX performance - Layer.AddFeature (#2) Hi. I believe the quickest way to add features to a layer in MapX is to use layerinfo and a features collection, although I havent tested against the adding a feature at a time approach. So rather than doing an ADDFEATURE for each object, append the objects to a features collection and then add this to a new layer using the layerinfo object and LAYERS.ADD method. Following (in Progress) was the basis of a MapX pack table, but is roughly what's required: CREATE "mapx.layerinfo.4" linfPacked. linfPacked:Type = {&miLayerInfoTypeNewTable}. linfPacked:AddParameter ("Fields", newfields). linfPacked:AddParameter ("Features", allFtrs). linfPacked:AddParameter ("Filespec", Newpath). linfPacked:AddParameter ("OverwriteFile", "1"). linfPacked:AddParameter ("Name", "temp_pack"). Map1:Layers:ADD (linfPacked) NO-ERROR. /* create table */ If you create a a table type of ...TYPETEMPTABLE, you can use the memtable option which may be faster. If you have stand-alone feature objects, you may need to do an f:attach before adding to the features collection. Phil. ----- Original Message ----- From: "Karlsson,Niklas" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, September 19, 2002 8:56 PM Subject: MI-L MapX performance - Layer.AddFeature (#2) (sorry, previous mail was sent prematurely) Hi, I have a large amount of data (approx. 100000 points and 5000 rectangles) which I want to display using Delphi and MapX. As of now I've assumed that I could simply create a feature using featurefactory and add it to a temporary layer. This seems however to be very slow. Some profiling reveals that adding 1000 small rectangles to a layer takes ~27 seconds. 98% of the time is spent on the function call "Map1.Layers.Item['Temp Layer'].AddFeature(f, EmptyParam);". Creating the feature as such seem to be quite fast. I'm running it on a P3/1GHz. Is there a smarter (=faster) way to this? I assume there is since I've seen other mapinfo applications which seem pretty fast. Either a quicker to add a feature to a given layer or a better/faster way to add objects (point & rectangles) to mapinfo. Thanks in advance! Best regards // Niklas --------------------------------------------------------------------- List hosting provided by Directions Magazine | www.directionsmag.com | To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Message number: 3177
