http://www.vividsolutions.com/jts/javadoc/com/vividsolutions/jts/operation/distance/DistanceOp.html#closestPoints%28com.vividsolutions.jts.geom.Geometry,%20com.vividsolutions.jts.geom.Geometry%29
Will return the closest points in two geometries.
On Thu, Aug 28, 2014 at 10:44 AM, Serega Sheypak <serega.shey...@gmail.com>
wrote:
> It doesn't work for polygons
> 28.08.2014 9:11 пользователь "sunish" <sunish.ku...@gmail.com> написал:
>
> Have you tried the GeodeticCalculator?
>>
>>
>> http://docs.geotools.org/latest/userguide/library/referencing/calculator.html
>>
>>
>> On Thu, Aug 28, 2014 at 12:32 AM, Serega Sheypak <
>> serega.shey...@gmail.com> wrote:
>>
>>> I know it :)
>>> All Geometry objects have coordinates in degrees (longitude, latitude),
>>> since it's a WSG_84 shape file. You can't use distance method because it
>>> works only for "planar" objects, correctly projected on 2D sufrace.
>>>
>>>
>>> 2014-08-27 20:26 GMT+04:00 sunish <sunish.ku...@gmail.com>:
>>>
>>> SimpleFeatureIterator it = features.features();
>>>>
>>>> while (it.hasNext()) {
>>>> SimpleFeature f = it.next();
>>>> Geometry geom = f.getDefaultGeometry();
>>>> }
>>>> it.close();
>>>>
>>>> Geometry has function distance(Geometry geom2);
>>>>
>>>>
>>>> http://www.vividsolutions.com/jts/javadoc/com/vividsolutions/jts/geom/Geometry.html
>>>>
>>>>
>>>> http://www.vividsolutions.com/jts/javadoc/com/vividsolutions/jts/geom/Geometry.html#distance%28com.vividsolutions.jts.geom.Geometry%29
>>>>
>>>>
>>>>
>>>> On Wed, Aug 27, 2014 at 3:45 PM, Serega Sheypak <
>>>> serega.shey...@gmail.com> wrote:
>>>>
>>>>> Hi, I have a several multiplogons loaded from shp file
>>>>> I'm usng import org.geotools.data.DataStore to load multipolygons and
>>>>> SimpleFeatureCollection features = featureSource.features to iterate
>>>>> over loaded geometries.
>>>>> My geometries have longitude, latitude coordinates.
>>>>>
>>>>> I want to calculate distance between my multipolygons and get result
>>>>> in meters. If multipolygons intersects, distance should be 0.0 meters.
>>>>>
>>>>> I have a mess in my head, I've tried to use
>>>>> http://docs.geotools.org/latest/tutorials/geometry/geometrycrs.html
>>>>>
>>>>> but it uses deprecated classes.. Can you give me some link to read how
>>>>> to do it in Java?
>>>>>
>>>>>
>>>>>
>>>>> ------------------------------------------------------------------------------
>>>>> Slashdot TV.
>>>>> Video for Nerds. Stuff that matters.
>>>>> http://tv.slashdot.org/
>>>>> _______________________________________________
>>>>> GeoTools-GT2-Users mailing list
>>>>> GeoTools-GT2-Users@lists.sourceforge.net
>>>>> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
>>>>>
>>>>>
>>>>
>>>>
>>>> ------------------------------------------------------------------------------
>>>> Slashdot TV.
>>>> Video for Nerds. Stuff that matters.
>>>> http://tv.slashdot.org/
>>>> _______________________________________________
>>>> GeoTools-GT2-Users mailing list
>>>> GeoTools-GT2-Users@lists.sourceforge.net
>>>> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
>>>>
>>>>
>>>
>>
------------------------------------------------------------------------------
Slashdot TV.
Video for Nerds. Stuff that matters.
http://tv.slashdot.org/
_______________________________________________
GeoTools-GT2-Users mailing list
GeoTools-GT2-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users