[udig-devel] creating a temporary resource

andrea antonello andrea.antonello at gmail.com
Thu Jan 31 04:26:50 PST 2008


I'm trying to create a temporary resource from existing filtered
features, but I want to change the featuretype name:

        String geomType = "MultyPolygon";
        Object[][] ob = new Object[featureList.size()][2];
        for( int i = 0; i < featureList.size(); i++ ) {

            ob[i][0] = featureList.get(i).getGeometry();
            ob[i][1] = i;
        }

here I want to give my own name and attributes to the featuretype

        FeatureType featureType = null;
        try {
            featureType = DataUtilities.createType("Macrobacini",
"geom:" + geomType
                    + ",indice:java.lang.Integer");
        } catch (SchemaException e1) {
            e1.printStackTrace();
        }

and then I add

        IGeoResource resource = CatalogPlugin.getDefault().getLocalCatalog()
                .createTemporaryResource(featureType);
        FeatureCollection coll =here I create the Features from
featureType and ob;
        try {
            resource.resolve(FeatureStore.class, pm).addFeatures(coll);
        } catch (IOException e) {
            e.printStackTrace();
        }
        ApplicationGIS.addLayersToMap(ApplicationGIS.getActiveMap(), Collections
                .singletonList(resource), -1);


What happens is that it doesn't know the CRS. And I couldn't find a
place to set it.

Any hint?

Andrea


More information about the udig-devel mailing list