actually I just looked at the ogrinfo -al output of the shape file,
it seems that because when I generated the file, I called
SimpleFeatureTypeBuilder builder = new SimpleFeatureTypeBuilder();
builder.setCRS(DefaultGeographicCRS.WGS84); // <- Coordinate
reference system
the shape file is marked as in the WGS84 coordinate system:
ogrinfo -al /tmp/ttt.shp
INFO: Open of `/tmp/ttt.shp'
using driver `ESRI Shapefile' successful.
Layer name: ttt
Geometry: Point
Feature Count: 2
Extent: (0.000000, 0.000000) - (100.000000, 0.000000)
Layer SRS WKT:
GEOGCS["WGS84(DD)",
DATUM["WGS84",
SPHEROID["WGS84",6378137.0,298.257223563]],
PRIMEM["Greenwich",0.0],
UNIT["degree",0.017453292519943295],
AXIS["Geodetic longitude",EAST],
AXIS["Geodetic latitude",NORTH]]
gml_id: String (254.0)
OGRFeature(ttt):0
gml_id (String) = 12345
POINT (0 0)
OGRFeature(ttt):1
gml_id (String) = 2222
POINT (100 0)
so the WGS84 is marking is simply ignored when dwithin() is run, and it
simply assumes a flat coordinate system?
Thanks
Yang
On Sat, Jan 28, 2012 at 3:56 AM, Andrea Aime
<[email protected]>wrote:
> On Fri, Jan 27, 2012 at 11:57 PM, Yang <[email protected]> wrote:
>
>> currently we use FilterFactory2.dwithin(geo1, point, distance, units) to
>> lookup the features within a radius of "distance" from "point"
>>
>> but the features in the collection are represented using lat-long,
>> so if FilterFactory2 treats them just as a flat 2-D coordinate system,
>> the distance computed at higher latitude is going to be higher than
>> real distance. so the above lookup actually looks up not a circle, but an
>> ellipse.
>>
>>
>> it seems that to do a real circle lookup, we need dwithin to accept a
>> function as parameter, instead of distance. right? but given the current
>> geotools code, is there a way to achieve circle lookup?
>>
>
> Interface wise, it would just have to respect the unit of measure and
> internally do the proper distance calculations.
> However doing a proper calculation internally is definitely not easy, and
> the point is not the only geometry we
> care about, dwithin must work for any type of reference geometry.
>
> There are some ideas on how to handle the issue here:
> http://jira.codehaus.org/browse/GEOT-1170
> http://jira.codehaus.org/browse/GEOS-937
>
> The solution is not immediate to implement, so far no funding or
> contribution
> showed up to address the problem
>
> Cheers
> Andrea
>
> --
> -------------------------------------------------------
> Ing. Andrea Aime
> GeoSolutions S.A.S.
> Tech lead
>
> Via Poggio alle Viti 1187
> 55054 Massarosa (LU)
> Italy
>
> phone: +39 0584 962313
> fax: +39 0584 962313
> mob: +39 339 8844549
>
> http://www.geo-solutions.it
> http://geo-solutions.blogspot.com/
> http://www.youtube.com/user/GeoSolutionsIT
> http://www.linkedin.com/in/andreaaime
> http://twitter.com/geowolf
>
> -------------------------------------------------------
>
------------------------------------------------------------------------------
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here
http://p.sf.net/sfu/sfd2d-msazure
_______________________________________________
GeoTools-GT2-Users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users