Hi,

I have a (I'm quite sure) lame question for using geotools.

I'd like to create, programmatically via the geotools API what would be
eventually serialized as follows:

 <gml:Surface>
    <gml:patches>
        <gml:PolygonPatch>
            <gml:exterior>
                <gml:Ring>
                    <gml:curveMember>
                        <gml:Curve>
                            <gml:segments>
                                <gml:GeodesicString>
                                    <gml:posList>47.516389 18.974444
47.515278 19.021667 47.515 19.033056 47.514722 19.043611 47.510556
19.055833 47.506111 19.056944 47.494722 19.06 47.483056 19.029722
47.486111 19.013056 47.491944 18.979444 47.500556 18.97 47.516389
18.974444 </gml:posList>
                                </gml:GeodesicString>
                            </gml:segments>
                        </gml:Curve>
                    </gml:curveMember>
                </gml:Ring>
            </gml:exterior>
        </gml:PolygonPatch>
    </gml:patches>
 </gml:Surface>


I'm looking at the various factories, etc. but can't really figure this
out on my own. I see the com.vividsolutions.jts.geom.GeometryFactory
object that has some interesting createXXX() functions, I see the
org.geotools.gml3.Curve class, which expects a
com.vividsolutions.jts.geom.LineString class, I see the
org.opengis.geometry.coordinate.GeometryFactory with the
createGeodesicString() function, etc. I see the
org.opengis.geometry.primitive.Ring object

to start from the inside and work myself towards the outside, first
trying to serialize just the GeodeticString portion, the only place I
found a GeodesicString object was the org.opengis.geometry.coordinate
package. when I tried the following code:


GeometryBuilder builder = new GeometryBuilder(DefaultGeographicCRS.WGS84);

GeometryFactory gf = builder.getGeometryFactory();

List<Position> dps = new ArrayList<Position>();
dps.add(builder.createPoint( new double[] {47.516389, 18.974444}));
dps.add(builder.createPoint( new double[] {47.515278, 19.021667}));
dps.add(builder.createPoint( new double[] {47.516389, 18.974444}));

GeodesicString gs = gf.createGeodesicString(dps);


this fails at the last line with 'not implemented'


if I go with other constructs, like a LineString, it builds OK. but
then, the GML objects' encode() function requires a
SimpleFeatureCollection - I read the XML & Feature tutorials, but it is
unclear to me how I'd but put such a LineString into a
SimpleFeatureCollection.


it's all quite confusing, as these are objects all in separate packages,
etc.


what is the proper way to achieve this when using geotools?

any pointers are welcome.


Akos

------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
_______________________________________________
GeoTools-GT2-Users mailing list
GeoTools-GT2-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to