On Thursday 17 September 2009 04:34:34 pm Ezequiel Coronel wrote:
> Hi,
>     I have a problem when I realize the querys with CQL. The result point
> is a little bit out of the street.
>
> I put the code that do it the job, the rest of the method are not so
> important. I' am doing something like this:
>
>          Point point = null;
>         StringBuffer query = new StringBuffer();
>         query.append("ST_NAME = 'Av. Santa Fe'");
>         query.append("and L_REFADDR <=");
>         query.append(address.getDoor());
>         query.append(" and L_NREFADDR >=");
>         query.append(address.getDoor());
>
>         log.info("query "+ query);
>         Filter filter = CQL.toFilter(query.toString());
>
>         //get the shape from a folder on the disk
>         FeatureSource featureSource =
> (FeatureSource)featuresSources.get("cap_fed_ejes"); //cap_fed_ejes.shp
>         FeatureCollection feactures = featureSource.getFeatures(filter);
>
>         CoordinateReferenceSystem targetCRS1 = null;
>
>         try {
>             targetCRS1 = CRS.decode("EPSG:4326");//CRS.parseWKT(WGS84);
>
>         } catch (FactoryException e1) {
>             e1.printStackTrace();
>         }
>
>         MathTransform trans1 = null;
>
>         try {
>             CoordinateReferenceSystem sourceCRS = targetCRS1;
Are you sure that source and target CRSs are equal?

>             log.info("Sistema de coordenadas ordiginal:
> "+sourceCRS.toString());
>
>             trans1 = CRS.findMathTransform(sourceCRS, targetCRS1);
>
>         } catch (NoSuchAuthorityCodeException e) {
>             e.printStackTrace();
>         } catch (FactoryException e) {
>             e.printStackTrace();
>         }
If the CRSs are not equal, you should reproject the points. Have a look at 
GeometryCoordinateSequenceTransformer that is responsible of transforming the 
geom.

cheers
-- 
Mauricio Pazos
www.axios.es

------------------------------------------------------------------------------
Come build with us! The BlackBerry&reg; 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&#45;12, 2009. Register now&#33;
http://p.sf.net/sfu/devconf
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to