Art Doler wrote:
> Hello, list.
>
> I'm attempting to make a fairly generic bridge between a pre-existing
> framework and GeoTools' WFS code, in the interests of making something I
> can hook up to arbitrary WFS servers and do stuff with the information.
>
Sweet.
> The documentation's gotten me far enough that I can create DataStores
> and from there work my way down to Geometry objects, which sounds
> excellent except that I have no idea what SRS the Coordinate objects are
> in, nor how to change them when I do know. I've been up and down the
> docs (both Java and wiki) and can't seem to find much on this issue.
>
So you missed something, the standards :-) We like standards, they let
us write less docs. Of course geotools is working towards a vanishing
point on this front ...
Ah that is because "spatial reference system" (ie SRS) is not a "real"
construct, it is a understanding between client and server.
Usually this understanding boils down to:
- a AUTHORITY:CODE - aka a magic string
- a magic URI - always works, the OGC define this somewhere
- raw "Well Known Text" (WKT) as used by Oracle, PostGIS, and the
geotools parser
We do argue over things with those nasty servers providing data (usually
over what comes first x or y), and sometimes the set of names they use
in their "well known" text.
- for x&y you can throw a switch
- for WKT names, you can provide "alias names"
> So my first question is: How do I find out what the SRS of a given
> FeatureStore is? I've perused all the attributes and they don't seem to
> be anything recognizable in that realm.
>
You will not find the "SRS" you will find a "real"
CoordinateReferenceSystem object ...
CoordinateReferenceSystem dataCRS = featureSource.getSchema( "fred"
).getDefaultGeometry().getCoordinateReferenceSystem()
> Once I know the SRS: Is there an easy way to batch convert Coordinate or
> Geometry objects? I've done some single point conversions in other
> places, so I'm familiar with the concepts needed there.
>
Yep :-)
CoordinateReferenceSystem targetCRS = CRS.decode("EPSG:3005"); // ie
authority is EPSG, code is 3005
MathTransform punt = CRS.transform( dataCRS, targetCRS );
Geometry geom = feature.getDefaultGeometry();
return JTS.transform( geom, punt );
Cheers,
Jody
> Thanks in advance,
> Art
>
>
>
>
>
>
>
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share your
> opinions on IT & business topics through brief surveys -- and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> _______________________________________________
> Geotools-gt2-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
>
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users