Just do this...
GeometryFactory gf = new GeometryFactory();
Michael
2008/10/13 fx5900 <[EMAIL PROTECTED]>:
>
> Hi,
>
> I am following the how to create a geomatry example but everytime i add
> the code
> GeometryFactory GeometryFactory = JTSFactoryFinder.getGeometryFactory( null
> ) i get error messages saying that each of the classes cannot be found.
> However in my in my import statement i have
>
>
> import org.opengis.geometry.Geometry;
> import org.geotools.factory.Factory;
> import org.geotools.referencing;
>
> another issue i get is that it cannot find my referencing package even
> though i have already have it on
> C:\Documents and Settings\Luong\.m2\org\geotools\gt2-referencing\2.4.5
>
> I have had a look at the GeometryFactory class from
> http://geoapi.sourceforge.net/2.0/javadoc/org/opengis/spatialschema/geometry/geometry/GeometryFactory.html
> and can't seem to find the function getGeometryFactory( null ) .
>
> full code:
>
> package com.mycompany.mavenproject6;
> import org.opengis.geometry.Geometry;
> import org.geotools.factory.Factory;
> import org.geotools.referencing;
>
>
>
>
>
>
> /**
> * Hello world!
> *
> */
> public class App
> {
> public static void main( String[] args )
> {
> System.out.println( "Hello World!" );
> GeometryFactory GeometryFactory =
> JTSFactoryFinder.getGeometryFactory( null );
>
>
> }
> }
>
> POM
>
> <project xmlns="http://maven.apache.org/POM/4.0.0"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
> http://maven.apache.org/maven-v4_0_0.xsd">
> <modelVersion>4.0.0</modelVersion>
> <groupId>com.mycompany</groupId>
> <artifactId>mavenproject6</artifactId>
> <packaging>jar</packaging>
> <version>1.0-SNAPSHOT</version>
> <name>mavenproject6</name>
> <url>http://maven.apache.org</url>
> <dependencies>
> <dependency>
> <groupId>junit</groupId>
> <artifactId>junit</artifactId>
> <version>3.8.1</version>
> <scope>test</scope>
> </dependency>
>
> <dependency>
> <groupId>org.geotools</groupId>
> <artifactId>gt2-main</artifactId>
> <version>2.4.5</version>
> </dependency>
>
>
>
> </dependencies>
>
> <!-- =========================================================== -->
> <!-- Repositories (ibiblio, refractions...). -->
> <!-- This is where Maven looks for dependencies. -->
> <!-- =========================================================== -->
> <repositories>
> <repository>
> <snapshots>
> <enabled>false</enabled>
> </snapshots>
> <id>ibiblio</id>
> <name>Ibiblio - the public's library and digital archive</name>
> <url>http://www.ibiblio.org/maven2</url>
> </repository>
>
> <repository>
> <id>refractions</id>
> <name>Refractions Research Maven 2 Repository</name>
> <url>http://lists.refractions.net/m2</url>
> </repository>
>
> <repository>
> <snapshots>
> <enabled>false</enabled>
> </snapshots>
> <id>geotools</id>
> <name>Geotools repository</name>
> <url>http://maven.geotools.fr/repository</url>
> </repository>
>
> <repository>
> <snapshots>
> <enabled>false</enabled>
> </snapshots>
> <id>central</id>
> <name>Maven Repository Switchboard</name>
> <url>http://repo1.maven.org/maven2</url>
> </repository>
> </repositories>
> </project>
>
> Also when i try to build i still keep getting those silly red errors saying
> that
> org.apache.maven.project.ProjectBuildingException: POM 's:gt2-main' not
> found in repository: Unable to download the artifact from any repository
>
>
>
> s:gt2-main:pom:2.4.5
>
>
>
> for project s:gt2-main
>
> at
> org.apache.maven.project.DefaultMavenProjectBuilder.findModelFromRepository(DefaultMavenProjectBuilder.java:590)
>
> at
> org.apache.maven.project.DefaultMavenProjectBuilder.buildFromRepository(DefaultMavenProjectBuilder.java:233)
>
> at
> org.codehaus.mevenide.indexer.api.RepositoryUtil.readMavenProject(RepositoryUtil.java:126)
>
> at
> org.codehaus.mevenide.indexer.NexusRepositoryIndexserImpl$NbIndexCreator.updateDocument(NexusRepositoryIndexserImpl.java:883)
>
> at
> org.sonatype.nexus.index.creator.DefaultIndexerEngine.createDocument(DefaultIndexerEngine.java:107)
>
> at
> org.sonatype.nexus.index.creator.DefaultIndexerEngine.update(DefaultIndexerEngine.java:70)
>
> at
> org.sonatype.nexus.index.DefaultNexusIndexer.addArtifactToIndex(DefaultNexusIndexer.java:301)
>
> at
> org.codehaus.mevenide.indexer.NexusRepositoryIndexserImpl$3.run(NexusRepositoryIndexserImpl.java:312)
>
> at org.openide.util.Mutex.writeAccess(Mutex.java:433)
>
> at
> org.codehaus.mevenide.indexer.NexusRepositoryIndexserImpl.updateIndexWithArtifacts(NexusRepositoryIndexserImpl.java:282)
>
> at
> org.codehaus.mevenide.indexer.api.RepositoryIndexer.updateIndexWithArtifacts(RepositoryIndexer.java:49)
>
> at
> org.codehaus.mevenide.netbeans.ActionProviderImpl$1.taskFinished(ActionProviderImpl.java:179)
>
> at org.openide.util.Task.notifyFinished(Task.java:227)
>
> at
> org.netbeans.core.execution.ExecutorTaskImpl.finished(ExecutorTaskImpl.java:86)
>
> at
> org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:173)
>
> Caused by: org.apache.maven.artifact.resolver.ArtifactNotFoundException:
> Unable to download the artifact from any repository
>
>
>
> s:gt2-main:pom:2.4.5
>
>
>
>
>
> at
> org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:179)
>
> at
> org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:82)
>
> at
> org.apache.maven.project.DefaultMavenProjectBuilder.findModelFromRepository(DefaultMavenProjectBuilder.java:552)
>
> ... 14 more
>
> Caused by: org.apache.maven.wagon.ResourceDoesNotExistException: Unable to
> download the artifact from any repository
>
> at
> org.apache.maven.artifact.manager.DefaultWagonManager.getArtifact(DefaultWagonManager.java:363)
>
> at
> org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:167)
>
> ... 16 more
>
> which i don't understand why because i'm connected to the net and i'm not
> downloading. What am i doing wrong?
> Cheers
>
> --
> View this message in context:
> http://www.nabble.com/Geomatry-example-tp19943308p19943308.html
> Sent from the geotools-gt2-users mailing list archive at Nabble.com.
>
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> Geotools-gt2-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
>
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users