Thanks a lot, Philip, for your answer
 
It gives me an advantage at about 15%. I'm surprized. :)
Is there anything more here to correct?
Could anyone tell me about the second question - it bothers me mostly. Waiting 
impatiently



Philip Waight <[EMAIL PROTECTED]> wrote:I'm fairly sure this will help ...

In the lines ...

For iCount = 1 To CurLayer.AllFeatures.Count
Set ftr1 = CurLayer.AllFeatures.Item(iCount)

especially the second line, Mapx will extract all features from the layer on
each call.
So i think a previous line of:

set allftrs = Curlyr.Allfeatures
For iCount = 1 To allftrs.Count
Set ftr1 = allftrs.Item(iCount)
...

Regards.

----- Original Message -----
From: "Katrin" 
To: 
Sent: Tuesday, November 18, 2003 11:32 PM
Subject: MI-L Defining cross-roads MapX


> Hello All
> Could you help me with my problem. I'm using MapX 4.5, work with road
network. My aim is to define point of crossings, where roads intersect in
such a way that for at least one road intersection point is not the end or
start point of this line. I'll try to show this as an example:
>
> \ / or =======
> X |
> / \ |
>
>
> 1. Define such intersection points
> 2. Divide each line into two at this intersection point
>
> 1. problem I've already solved but it's quite slow - 20 minutes for 4000
objects. May be I do something wrong. Below is my code. Have you some ideas
for optimizing it?
>
> Map1.DisplayCoordSys = CurLayer.CoordSys
> Map1.NumericCoordSys = CurLayer.CoordSys
>
> CurLayer.BeginAccess miAccessRead
> Clayer.BeginAccess miAccessReadWrite
>
> For iCount = 1 To CurLayer.AllFeatures.Count
> Set ftr1 = CurLayer.AllFeatures.Item(iCount)
>
> StartPtX = ftr1.Parts.Item(1).Item(1).X
> STartPtY = ftr1.Parts.Item(1).Item(1).Y
> EndPtX =
ftr1.Parts.Item(ftr1.Parts.Count).Item(ftr1.Parts.Item(ftr1.Parts.Count).Cou
nt).X
> EndPtY =
ftr1.Parts.Item(ftr1.Parts.Count).Item(ftr1.Parts.Item(ftr1.Parts.Count).Cou
nt).Y
>
> Set ftrs = CurLayer.SearchWithinFeature(ftr1, miSearchTypePartiallyWithin)
> For i = 1 To ftrs.Count
> Set ftr2 = ftrs.Item(i)
> If ftr2.FeatureKey <> ftr1.FeatureKey Then
>
> Set pts = Map1.FeatureFactory.IntersectionPoints(ftr1, ftr2,
miIntersectAll)
> For j = 1 To pts.Count
> If Not (pts.Item(j).X = StartPtX And pts.Item(j).Y = STartPtY) And Not
(pts.Item(j).X = EndPtX And pts.Item(j).Y = EndPtY) Then
> Set AddFtr = Map1.FeatureFactory.CreateSymbol(pts.Item(j))
> AddFtr.Attach Map1
> Clayer.AddFeature AddFtr, RVals2
> End If
> Next
> End If
> Next
> Next
> CurLayer.EndAccess miAccessEnd
> Clayer.EndAccess miAccessEnd
>
> 2. I can't imagine how to do this more effective than define (while loop
through the whole polyline segment) where the intersection point lies and
create two polylines. I doubt it won't take much time. May be there's
another, more simple way to make two polylines from one dividing them at
definite point.
>
> I'll be very gratefull for any answers
>
>
> Best Regards,
> Katerinka
>
> ---------------------------------
> Do you Yahoo!?
> Protect your identity with Yahoo! Mail AddressGuard



Best Regards,
Katerinka

---------------------------------
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard

Reply via email to