Re: [JPP-Devel] Possible Bug in FeatureCollectionTools.getEnvelopeForFeatures method.

2009-06-24 Thread Michaël Michaud
Hi > If all we need to do is replace > calls to getCoordinate with getCentroid, I can prepare a patch for > this as well. > I don't know who (which plugin) use it, but I think that with the current implementation, the centerOfMass of a set of polygons made of a single regular polygon will retu

Re: [JPP-Devel] Possible Bug in FeatureCollectionTools.getEnvelopeForFeatures method.

2009-06-24 Thread Sunburned Surveyor
Michael, When I fist started looking hard at the method, I realized that "center of mass" could mean different things to different people. I don't have time now to explore the differernt ways this center of mass could be defined and the different ways this method could be implemented, but it sound

Re: [JPP-Devel] Possible Bug in FeatureCollectionTools.getEnvelopeForFeatures method.

2009-06-24 Thread Michaël Michaud
Hi, I think you're right again. For a better result with non puntal geometries, one should use getCentroid instead of getCoordinate in getCenterOfMass method One could also compute something closer to a center of mass by using the area or the length of the feature as the "mass" of each feature O

Re: [JPP-Devel] Possible Bug in FeatureCollectionTools.getEnvelopeForFeatures method.

2009-06-24 Thread Sunburned Surveyor
Roger that Michael. I will remove the portions of my method that deal with empty geomtries. Thanks for the suggestion. SS 2009/6/24 Michaël Michaud : > Hi, > > I agree getCoordinate must be replaced by getEnvelopeInternal, but your > method is way too complex. > If you study Envelope class, you'

Re: [JPP-Devel] Possible Bug in FeatureCollectionTools.getEnvelopeForFeatures method.

2009-06-24 Thread Michaël Michaud
Hi, I agree getCoordinate must be replaced by getEnvelopeInternal, but your method is way too complex. If you study Envelope class, you'll notice that EmptyGeometry envelopes are already managed by this class, so that the following few lines should do what you want : public Envelope getEnvelop

Re: [JPP-Devel] Possible Bug in FeatureCollectionTools.getEnvelopeForFeatures method.

2009-06-24 Thread Sunburned Surveyor
I'll get a patch ready for OJ when I have unit tested the method. Thanks for the review Michael and Larry. While we are on the topic, could you guys look at the getCenterOfMass method in the same class. Its supposed to act like the Geometry.getCentroid method, but for a group of Feature objects.

Re: [JPP-Devel] Possible Bug in FeatureCollectionTools.getEnvelopeForFeatures method.

2009-06-24 Thread Larry Becker
Yes, you are right. The getCoordinate() only works when looping through a single feature's points. Larry On Wed, Jun 24, 2009 at 12:12 PM, Sunburned Surveyor < sunburned.surve...@gmail.com> wrote: > Thanks for the responses Larry and Michael. I have attached a text > file with my modified metho

Re: [JPP-Devel] Possible Bug in FeatureCollectionTools.getEnvelopeForFeatures method.

2009-06-24 Thread Sunburned Surveyor
Thanks for the responses Larry and Michael. I have attached a text file with my modified method. (Note: There are other changes to my method that I would not include in the patch.) I believe that the use of getCoordinate method should be replaced with the getEnvelopeInternal method. But I could be

Re: [JPP-Devel] Possible Bug in FeatureCollectionTools.getEnvelopeForFeatures method.

2009-06-24 Thread Larry Becker
Hi SS, If you are talking about this code, it looks like it works to me: public static Envelope getEnvelopeForFeatures(Feature[] features){ Envelope env = null; Feature feat; for (int i=0; i > Hi, > > I believe there may be a bug in the getEnvelopeForFeatures method

Re: [JPP-Devel] Possible Bug in FeatureCollectionTools.getEnvelopeForFeatures method.

2009-06-23 Thread Michaël Michaud
Hi, > I believe there may be a bug in the getEnvelopeForFeatures method of > the FeatureCollectionTools class. It uses the Geometry.getCoordinate > method when it should use the Geometry.getEnvelopeInternal method. > This may result in the calculation of an envolope that does not > include the enve

[JPP-Devel] Possible Bug in FeatureCollectionTools.getEnvelopeForFeatures method.

2009-06-23 Thread Sunburned Surveyor
I believe there may be a bug in the getEnvelopeForFeatures method of the FeatureCollectionTools class. It uses the Geometry.getCoordinate method when it should use the Geometry.getEnvelopeInternal method. This may result in the calculation of an envolope that does not include the envelope of all fe