MapDisplayLab

2 messages Options
Embed this post
Permalink
Jody Garnett-2

MapDisplayLab

Reply Threaded More More options
Print post
Permalink
Some javascript/style in this post has been disabled (why?)
Hi Michael;

Going over one of the example you provided (http://geotools.org/examples/displaylab.html)
... and I have a question :-)

You used the filter produced when they click ... and process the features into a Set<FeatureId>
Set<FeatureId> IDs = new HashSet<FeatureId>();
            try {
                while (iter.hasNext()) {
                    SimpleFeature feature = iter.next();
                    IDs.add(feature.getIdentifier());

                    System.out.println("   " + feature.getIdentifier());
                }

            } finally {
                iter.close();
            }
And then to display the features you create a Rule with ...
selectedRule.setFilter(ff.id(IDs));
Can I ask why you do not use the original filter? 

It could be:
- speed - avoiding a spatial test during every render - and using a feature id test would be fast
- teaching - it could be an excuse to process a feature collection

I am finding the page clear and well written; so I am loath to change anything :-)

I also usually produce a different filter when checking where someone clicks; I produce a 3x3 pixel bounding box; and then:
1) transform it to mappane crs (ie world coordinates)
2) transofrm it to the data crs (ie data coordinates)

On the grounds that a BoundingBox query is often the fastest spatial query you can do, faster then dwithin with less hard math.

Jody

------------------------------------------------------------------------------
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
_______________________________________________
Geotools-gt2-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
mbedward

Re: MapDisplayLab

Reply Threaded More More options
Print post
Permalink
Hi Jody,

> You used the filter produced when they click ... and process the features
> into a Set<FeatureId>
>
> Set<FeatureId> IDs = new HashSet<FeatureId>();

<snip>

> And then to display the features you create a Rule with ...
>
> selectedRule.setFilter(ff.id(IDs));
>
> Can I ask why you do not use the original filter?

I thought it might make each step a little more obvious, but now that
you point it out I'm not sure that it doesn't just make it seem more
complex :-)

You choose (and if any other list members have an opinion please speak
up - we'd love the feedback).

> It could be:
> - speed - avoiding a spatial test during every render - and using a feature
> id test would be fast
> - teaching - it could be an excuse to process a feature collection
> I am finding the page clear and well written; so I am loath to change
> anything :-)
> I also usually produce a different filter when checking where someone
> clicks; I produce a 3x3 pixel bounding box; and then:
> 1) transform it to mappane crs (ie world coordinates)
> 2) transofrm it to the data crs (ie data coordinates)
> On the grounds that a BoundingBox query is often the fastest spatial query
> you can do, faster then dwithin with less hard math.

Yes - that would be much better practice (and I'm noting it down for
my own future reference !). But do you think it would make the example
look even more complicated ?  On the other hand, perhaps when someone
has reached the point of braving this one we shouldn't be treating
them as a beginner and therefore your suggestion here would be better.

I was also planning to put a line or two of text on the page to
accompany each code box - you know, old-fogey style :)

Michael

------------------------------------------------------------------------------
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
_______________________________________________
Geotools-gt2-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users