Hi all, how to load postgis data store and load it on JMapFrame using SQL query.

this is my code but i'm not know where I put the request like "SELECT
* from table WHERE st_isvalid(the_geom)":
Map<String,Serializable> outputParams = new HashMap<String,Serializable>();
        outputParams.put(PostgisNGDataStoreFactory.DBTYPE.key, "postgis");
        outputParams.put(PostgisNGDataStoreFactory.HOST.key, "localhost");
        outputParams.put(PostgisNGDataStoreFactory.PORT.key, "5432");
        outputParams.put(PostgisNGDataStoreFactory.SCHEMA.key, "public");
        outputParams.put(PostgisNGDataStoreFactory.DATABASE.key, "bdwebpapp");
        outputParams.put(PostgisNGDataStoreFactory.USER.key, "postgres");
        outputParams.put(PostgisNGDataStoreFactory.PASSWD.key, "admin");
        //JDBCDataStore outputConn = (JDBCDataStore)
DataStoreFinder.getDataStore(outputParams);
       //FileDataStore store = FileDataStoreFinder.getDataStore(file);
       DataStore store = DataStoreFinder.getDataStore(outputParams);
        if(store == null){


       System.out.println("Verify connexion");
       System.exit(1);
       }
        SimpleFeatureSource featureSource =
store.getFeatureSource(store.getTypeNames()[0]);
        // Create a map content and add our shapefile to it
       MapContent map = new MapContent();
        map.setTitle("Quickstart");
        Style style = SLD.createSimpleStyle(featureSource.getSchema(),
color[next]);

        Layer layer = new FeatureLayer(featureSource, style);
        mapContext.addLayer(layer);
        return true;
  }
Thanks in advance.

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most 
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
GeoTools-GT2-Users mailing list
GeoTools-GT2-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to