Select to view content in your preferred language

Let's do a travelling Buffer that picks stuff up!

819
3
09-07-2011 06:29 AM
LastingerBrooks
Deactivated User
Hey All,

I'm working on a sneaky-ninja way of rating sign retroreflectivity in my jurisdiction. I would like to figure out a way to make ArcPad help me do this. But it may take some outside-the-box thinking so you smarter ArcPadders out there bust out your mad skills and see if we can do this.

I got the following:

A street Centerline layer.
A point layer that contains Signposts. These posts are close to, and on either side of, the centerline layer. There are also a ton of them.
A one-to-many related table of individual SIGNS that belong to each of the signposts. Each of these signs have vector information on them that lets me know which direction they are facing with regard to North by having Azimuth values between 0-359. Signs can be facing Toward or Away From Traffic, as well as Toward or Away from the Street. So, for example, a Green Street Name sign would have four signs on its posts, with one facing each direction, separated by 90 degrees.

The eventual goal of this project is to create a polygon object of some sort based on my current GPS position that follows me around and cares about which direction I'm facing. We can determine this by running a simple bearing calculation that I already have written.

When a signpost enters my "buffer zone," I want a way to query all the related signs on the post and find the ones whose facing direction is 180 degrees from my own, +/- a few degrees. These signs' information would get loaded into forms with big, fat, simple buttons to rate them with and contain large pictures, and would get blasted up on my screen for a few seconds for my field inspector to record the ratings.

Ideally, When the signpost leaves my buffer zone, I would like the uncompleted forms to disappear, leaving room for other forms to jump up on the screen instead.

So here's where I am at the moment:

I have a  feeling that ArcPad can only select one object at once. So if I was to use a method like FindNearestXY, I could, for example, select the nearest signpost that was in my buffer zone. But after that was selected, I would also want to know about other signposts that happened to be in my buffer zone.

So, I'm thinking about creating a For/Next loop that finds the NearestXY(Signpost), and adds it to a temporary list, then runs the FindNearestXY again, but ignores any results that have already been added to the list. The For/Next loop would continue to run until it returned no more results.

In a way I would hope this would be kind of like "Find Nearest," "Find 2nd Nearest," "Find 3rd Nearest," etc.

The trick here is getting the FindNearestXY to ignore already found results.

Any ideas on how we might be able to do this?
Tags (3)
0 Kudos
3 Replies
GarethWalters
Deactivated User
Hi Brooks,

As you mentioned you are trying to find things within a buffer zone and the findnearestXY only finds a single record.

I would suggest that you turn the thinking around a little, and use the geometry object. If you create a circle/buffer of your location, you can then iterate through a list of features using the IsPointIn method.

Everytime it is true you can open the editform.

Hope this a good start for you.

Cheers,

Gareth
0 Kudos
LastingerBrooks
Deactivated User
Hey Gareth!

Thanks for your suggestion! I really appreciate the help! :cool:

I'm a little confused about how to use the Geometry "object," though. When I go to Help and type in "Geometry," it returns the term as a sub-element of Feature, which is then subordinate to Features, which is then subordinate to FeatureSet, which is then subordinate to the Root element of ArcPad.

The instructions tell me this function is used to define geometry in an ArcPad Graphics File (.apg)

I'm rooting around in the sample files, trying to find the right way to incorporate .apg files.

From what I can tell, I guess I could create a .apg file from inserting a Featureset object under ArcPad, and go down and create subobjects until I hit Geometry, but then, are you telling me that I could incorporate this geometry as an object that I could then call with the IsPointIn method?

Also, would this method be limited to a small point set? If I were to use a For/Next loop to IsPointIn every point in a dataset, I'm guessing my dataset would have to be limited to like 20 points in order to make sure the routine ran fast. Do you think I would have to establish limits, e.g. if I checked like 1000 points in a wide area, say, every second, would ArcPad eventually crash?
0 Kudos
GarethWalters
Deactivated User
Hi Brooks,

Here is a quick sample to have a look at what I mean. This sample will create a buffer at the GPS location, find the features within that buffer and for each one open the editform.

The ellipse can be created as a feature or a graphic, you just have to pass it to the desired layer.

Dim gpsX, gpsY, pBuffer, pPoint, polySymbol
gpsX = gps.X
gpsY = gps.Y
set pBuffer = Application.CreateAppObject("Ellipse")
set pPoint =  Application.CreateAppObject("Point")

set polySymbol = Application.CreateAppObject("Symbol")
polySymbol.LineWidth = 3 

pPoint.X = gpsX
pPoint.Y = gpsY

set pBuffer = pPoint.Buffer(10)

Call Map.AddFeature(pBuffer,false)
'Call Map.Drawshape(pBuffer, polySymbol)

dim pointRS, ptCount, pBookmark

set pointRs = Map.Editlayer(1).Records 'Your sign layer

pointRS.MoveFirst
ptCount = 0
While not pointRS.EOF
 if pBuffer.IsPointIn(pointRS.Fields.Shape) = true then
  Map.EditLayer(1).edit(pointRS.Bookmark)
  ptCount = ptCount +1
 End if
 pointRS.MoveNext
Wend


Yes you may need to manage the amount you search through as the less is going to be faster. There are several ways you could look into. Maybe your workflow could be that you do just take less data out there. Or you could try the find method. Perhaps a new thread for this conversation 🙂

Let me know how you go.

Cheers,

Gareth
0 Kudos