Hello André-John, > I have looked at the GeoTools examples in the wiki, but I am unable to find > anything as simple as a HelloWorld that would show me how to query a MySQL > database, using JDBC and then make sense of the OpenGIS values with Geotools.
Please have a look at the QueryLab example app which I've just updated: http://svn.osgeo.org/geotools/trunk/demo/example/src/main/java/org/geotools/demo/QueryLab.java The associated web page (http://geotools.org/examples/querylab.html) has also been updated but the changes won't be online until tomorrow. Although this example connects to a PostGIS database you can modify it for MySQL as follows: At line 36 change... import org.geotools.data.postgis.PostgisNGDataStoreFactory; to... import org.geotools.data.mysql.MySQLDataStoreFactory; At line 111 change the file menu action from this... fileMenu.add(new SafeAction("Connect to PostGIS database...") { public void action(ActionEvent e) throws Throwable { connect(new PostgisNGDataStoreFactory()); } }); to this... fileMenu.add(new SafeAction("Connect to MySQL database...") { public void action(ActionEvent e) throws Throwable { connect(new MySQLDataStoreFactory()); } }); If you are using Maven as your build tool, specify these GeoTools modules in your pom.xml file: <properties> <geotools.version>2.6.2</geotools.version> </properties> <dependencies> <dependency> <groupId>org.geotools</groupId> <artifactId>gt-shapefile</artifactId> <version>${geotools.version}</version> </dependency> <dependency> <groupId>org.geotools</groupId> <artifactId>gt-jdbc-postgis</artifactId> <version>${geotools.version}</version> </dependency> <dependency> <groupId>org.geotools</groupId> <artifactId>gt-epsg-hsql</artifactId> <version>${geotools.version}</version> </dependency> <dependency> <groupId>org.geotools</groupId> <artifactId>gt-swing</artifactId> <version>${geotools.version}</version> </dependency> </dependencies> If you are adding jars manually this is the minimal set that you need for the example (from maven's dependency tree report): +- org.geotools:gt-shapefile:jar:2.6.2:compile | +- org.geotools:gt-main:jar:2.6.2:compile | | +- org.geotools:gt-api:jar:2.6.2:compile | | +- com.vividsolutions:jts:jar:1.10:compile | | | \- xerces:xercesImpl:jar:2.4.0:compile | | \- commons-beanutils:commons-beanutils:jar:1.7.0:compile | | \- commons-logging:commons-logging:jar:1.0.3:compile | +- org.geotools:gt-referencing:jar:2.6.2:compile | | +- java3d:vecmath:jar:1.3.2:compile | | +- commons-pool:commons-pool:jar:1.5.3:compile | | \- org.geotools:gt-metadata:jar:2.6.2:compile | | +- org.opengis:geoapi:jar:2.3-M1:compile | | +- org.opengis:geoapi-pending:jar:2.3-M1:compile | | \- net.java.dev.jsr-275:jsr-275:jar:1.0-beta-2:compile | \- jdom:jdom:jar:1.0:compile +- org.geotools.jdbc:gt-jdbc-mysql:jar:2.6.2:compile | +- mysql:mysql-connector-java:jar:5.1.5:compile | \- org.geotools:gt-jdbc:jar:2.6.2:compile | +- org.geotools:gt-data:jar:2.6.2:compile | +- commons-dbcp:commons-dbcp:jar:1.2.2:compile | \- commons-collections:commons-collections:jar:3.1:compile +- org.geotools:gt-epsg-hsql:jar:2.6.2:compile | \- hsqldb:hsqldb:jar:1.8.0.7:compile +- org.geotools:gt-swing:jar:2.6.2:compile | +- org.geotools:gt-render:jar:2.6.2:compile | | +- org.geotools:gt-coverage:jar:2.6.2:compile | | \- org.geotools:gt-cql:jar:2.6.2:compile | +- org.geotools:gt-wms:jar:2.6.2:compile | | +- org.geotools:gt-xml:jar:2.6.2:compile | | \- commons-lang:commons-lang:jar:2.3:compile | \- com.miglayout:miglayout:jar:swing:3.7:compile \- junit:junit:jar:4.5:test For your other questions I'll defer to Justin, Andrea and others here who are experienced with hibernate etc. Hope this helps. Michael ------------------------------------------------------------------------------ Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev _______________________________________________ Geotools-gt2-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
