[JPP-Devel] Spatial Query

2010-06-25 Thread siddharth raghuvanshi
Hi,

How is the spatial query related to distance is being carried on?? As far as
I have seen, jts topology suite resolves distance related queries only by
using the coordinates & has nothing to do with the srs of the layer. So, how
is OpenJump managing it??

If projection of the layer is in EPSG:4326, parameter of distance is in
lat/lon, if it is in some other projection, unit of measurement may be
meter, feet etc.

In SpatialQueryPlugIn.java , it seems that parameter of the distance query
is independent of the coordinate reference system of the layer. So, which
class file of OpenJUMP is responsible for such distance related spatial
query??

Regards
Siddharth
--
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first___
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel


Re: [JPP-Devel] Nested loop through the features of two layers

2010-06-25 Thread Michaël Michaud
Hi,

//STRtree (JTS package) and IndexedFeatureCollection (jump) are your 
friends,

//You can use the index like that :

IndexedFeatureCollection ifc = new IndexedFeatureCollection(fcB, new 
STRtree());

//Then your second loop just go  through the result of the following request

List candidates = ifc.query(featureA.getEnvelopeInternal());

// candidates contains features of fcB having their envelope 
intersecting envelope of feature A in a very fast way
for (Feature candidate : candidates) {
// your test
}

//Code may contains errors, hope that's enough for you to catch the idea

Michaël


Nils Kuhn a écrit :
> Hi all,
>
> I have the following problem:
> I have two polygon-layers with many thousands of features. In layer a 
> I want to flag in an integer-field for every feature, whether the area 
> of the intersection with the polygons of layer b amounts more than 1 
> percent of the area himself.
>
> The attached code works, but the calculation would last about two 
> weeks, I think...
>
> Can anybody see a better way than my nested loop through the features 
> of both layers? I searched for a function like* 
> *com.vividsolutions.jump.feature.FeatureCollectionWrapper.query(|com.vividsolutions.jts.geom.Envelope
>  envelope|), 
> but I would like to refer a geometry instead of an envelope.
>
> Thanks for any ideas in advance.
> Regards, Nils
>
>
> 
>
> --
> ThinkGeek and WIRED's GeekDad team up for the Ultimate 
> GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the 
> lucky parental unit.  See the prize list and enter to win: 
> http://p.sf.net/sfu/thinkgeek-promo
> 
>
> ___
> Jump-pilot-devel mailing list
> Jump-pilot-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel


--
ThinkGeek and WIRED's GeekDad team up for the Ultimate 
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the 
lucky parental unit.  See the prize list and enter to win: 
http://p.sf.net/sfu/thinkgeek-promo
___
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel


Re: [JPP-Devel] Nested loop through the features of two layers

2010-06-25 Thread Larry Becker
Hi Nils,

  You are on the right track with the envelope query.  Unless your polygons
are unusually overlapped (i.e. many overlap many), you should get good
performance using the results of the envelope query to feed the inner loop
of geometry intersection.

regards,
Larry




On Fri, Jun 25, 2010 at 10:53 AM, Nils Kuhn  wrote:

>  Hi all,
>
> I have the following problem:
> I have two polygon-layers with many thousands of features. In layer a I
> want to flag in an integer-field for every feature, whether the area of the
> intersection with the polygons of layer b amounts more than 1 percent of the
> area himself.
>
> The attached code works, but the calculation would last about two weeks, I
> think...
>
> Can anybody see a better way than my nested loop through the features of
> both layers? I searched for a function like* *
> com.vividsolutions.jump.feature.FeatureCollectionWrapper.query(
> com.vividsolutions.jts.geom.Envelope envelope), but I would like to refer
> a geometry instead of an envelope.
>
> Thanks for any ideas in advance.
> Regards, Nils
>
>
>
>double dblAreaIntersectionTemp;
>//layer a
>lyrA=context.getLayerManager().getLayer("LayerA");
>FeatureCollectionWrapper fcwA =
> lyrA.getFeatureCollectionWrapper();
>final Collection featuresA = fcwA.getFeatures();
>//layer b
>lyrB=context.getLayerManager().getLayer("LayerB");
>FeatureCollectionWrapper fcwB =
> lyrB.getFeatureCollectionWrapper();
>final Collection featuresB = fcwB.getFeatures();
>
>//iterate over the features of layer a
>for (Iterator iteratorA = featuresA.iterator();
> iteratorA.hasNext();) {
>Feature featureA = (Feature) iteratorA.next();
>//iterate over the features of layer b, summarize
> the intersection-areas
>dblAreaIntersectionTemp=0;
>for (Iterator iteratorB = featuresB.iterator();
> iteratorB.hasNext();) {
>Feature featureB = (Feature)
> iteratorB.next();
>
>  
> dblAreaIntersectionTemp+=featureB.getGeometry().intersection(featureA.getGeometry()).getArea();
>}
>//if the summarized intersection-area is larger than
> 1% of the area of the feature of layer a himself a flag is set to this
> feature
>if
> ((dblAreaIntersectionTemp/featureA.getGeometry().getArea())>=0.01) {
>featureA.setAttribute("flag", 1);
>}else{
>featureA.setAttribute("flag", 0);
>}
>}
>
> --
> ThinkGeek and WIRED's GeekDad team up for the Ultimate
> GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
> lucky parental unit.  See the prize list and enter to win:
> http://p.sf.net/sfu/thinkgeek-promo
> ___
> Jump-pilot-devel mailing list
> Jump-pilot-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
>
>
--
ThinkGeek and WIRED's GeekDad team up for the Ultimate 
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the 
lucky parental unit.  See the prize list and enter to win: 
http://p.sf.net/sfu/thinkgeek-promo___
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel


[JPP-Devel] Nested loop through the features of two layers

2010-06-25 Thread Nils Kuhn




Hi all,

I have the following problem:
I have two polygon-layers with many thousands of features. In layer a I
want to flag in an integer-field for every feature, whether the area of
the intersection with the polygons of layer b amounts more than 1
percent of the area himself.

The attached code works, but the calculation would last about two
weeks, I think...

Can anybody see a better way than my nested loop through the features
of both layers? I searched for a function like com.vividsolutions.jump.feature.FeatureCollectionWrapper.query(com.vividsolutions.jts.geom.Envelope envelope),
but I would like to refer a geometry instead of an envelope.

Thanks for any ideas in advance.
Regards, Nils




double dblAreaIntersectionTemp;
//layer a 
lyrA=context.getLayerManager().getLayer("LayerA");
FeatureCollectionWrapper fcwA = 
lyrA.getFeatureCollectionWrapper();
final Collection featuresA = fcwA.getFeatures();
//layer b
lyrB=context.getLayerManager().getLayer("LayerB");
FeatureCollectionWrapper fcwB = 
lyrB.getFeatureCollectionWrapper();
final Collection featuresB = fcwB.getFeatures();

//iterate over the features of layer a
for (Iterator iteratorA = featuresA.iterator(); 
iteratorA.hasNext();) {
Feature featureA = (Feature) iteratorA.next();
//iterate over the features of layer b, summarize the 
intersection-areas
dblAreaIntersectionTemp=0;
for (Iterator iteratorB = featuresB.iterator(); 
iteratorB.hasNext();) {
Feature featureB = (Feature) iteratorB.next();

dblAreaIntersectionTemp+=featureB.getGeometry().intersection(featureA.getGeometry()).getArea();
}
//if the summarized intersection-area is larger than 1% 
of the area of the feature of layer a himself a flag is set to this feature
if 
((dblAreaIntersectionTemp/featureA.getGeometry().getArea())>=0.01) {
featureA.setAttribute("flag", 1);
}else{
featureA.setAttribute("flag", 0);
}
}--
ThinkGeek and WIRED's GeekDad team up for the Ultimate 
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the 
lucky parental unit.  See the prize list and enter to win: 
http://p.sf.net/sfu/thinkgeek-promo___
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel


Re: [JPP-Devel] OpenJump Documentation

2010-06-25 Thread Benjamin Gudehus
Hi!

I used the OpenJUMP javadocs and created the mind map with FreeMind.

http://sourceforge.net/projects/freemind/files/freemind-unstable/

--Benjamin

2010/6/24 Stefan Steiniger 

> Hei Benjamin
>
> thanks.. I uploaded it on the wiki
>
> stefan
>
> Benjamin Gudehus wrote:
> > Hello Herman,
> >
> > I created a useful cheat sheet.
> >
> > http://www.imagebanana.com/img/n6r6yt2g/PlugInContext.png
> >
> > --Benjamin
> >
> > 2010/6/24 Larry Becker  > >
> >
> > Hi Herman,
> >
> >   Try:
> > http://www.vividsolutions.com/jump/bin/JUMP%20Developer%20Guide.pdf
> >
> > Larry
> >
> > On Thu, Jun 24, 2010 at 6:59 AM, Hernan Arellano  > > wrote:
> >
> > Hi All!
> >Does anyone know if there is documentacion of OJ Core?
> > Documentation like class diagram or something where i can see
> > the main classe and their relations (Map, LayerManager, Layer,
> > etc).
> >
> > If there is not, maybe someone have a scheme of the most
> > important classes that can share.
> >
> > Thanks a lot!
> > Hernan
> >
> 
> >
> >
> --
> > ThinkGeek and WIRED's GeekDad team up for the Ultimate
> > GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
> > lucky parental unit.  See the prize list and enter to win:
> > http://p.sf.net/sfu/thinkgeek-promo
> > ___
> > Jump-pilot-devel mailing list
> > Jump-pilot-devel@lists.sourceforge.net
> > 
> > https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
> >
> >
> >
> >
> --
> > ThinkGeek and WIRED's GeekDad team up for the Ultimate
> > GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
> > lucky parental unit.  See the prize list and enter to win:
> > http://p.sf.net/sfu/thinkgeek-promo
> > ___
> > Jump-pilot-devel mailing list
> > Jump-pilot-devel@lists.sourceforge.net
> > 
> > https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
> >
> >
> >
> > 
> >
> >
> --
> > ThinkGeek and WIRED's GeekDad team up for the Ultimate
> > GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
> > lucky parental unit.  See the prize list and enter to win:
> > http://p.sf.net/sfu/thinkgeek-promo
> >
> >
> > 
> >
> > ___
> > Jump-pilot-devel mailing list
> > Jump-pilot-devel@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
>
>
> --
> ThinkGeek and WIRED's GeekDad team up for the Ultimate
> GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
> lucky parental unit.  See the prize list and enter to win:
> http://p.sf.net/sfu/thinkgeek-promo
> ___
> Jump-pilot-devel mailing list
> Jump-pilot-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
>
--
ThinkGeek and WIRED's GeekDad team up for the Ultimate 
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the 
lucky parental unit.  See the prize list and enter to win: 
http://p.sf.net/sfu/thinkgeek-promo___
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel