Hi Justin, I got the GML3 parser to compile, but am still struggling to parse my gml. The situation is such that I am getting a gml geometry within a larger XMLBeans object. I can extract the geometry, convert it to a string, replace <xml-fragment bits that are left over from the xml beans and even substitute namespace declarations etc.
But I end up with the following error: java.net.URISyntaxException: Illegal character in scheme name at index 0: <gml:Polygon srsName="urn:ogc:def:crs:EPSG:6.6:3035" xmlns:gml="http://www.opengis.net/gml"> <gml:exterior xmlns:gml="http://www.opengis.net/gml"> <gml:LinearRing> <gml:posList>4100527.55 2546443.706 4101669.813 2551297.031 4102440.967 2551063.104 4103305.401 2550601.054 4104063.084 2549979.24 4104684.898 2549221.557 4105146.948 2548357.123 4105380.875 2547585.969 4100527.55 2546443.706</gml:posList> </gml:LinearRing> </gml:exterior> </gml:Polygon> I even tried to add xml headers (see below, but it does not change anything). java.net.URISyntaxException: Illegal character in path at index 0: <?xml version="1.0" encoding="UTF-8"?><gml:Polygon srsName="urn:ogc:def:crs:EPSG:6.6:3035" xmlns:gml="http://www.opengis.net/gml"> <gml:exterior xmlns:gml="http://www.opengis.net/gml"> <gml:LinearRing> <gml:posList>4100527.55 2546443.706 4101669.813 2551297.031 4102440.967 2551063.104 4103305.401 2550601.054 4104063.084 2549979.24 4104684.898 2549221.557 4105146.948 2548357.123 4105380.875 2547585.969 4100527.55 2546443.706</gml:posList> </gml:LinearRing> </gml:exterior> </gml:Polygon> This is my code. Note that I used the older - deprecated method for the parser, taking the string as the argument, as the new methods don't seem to support strings, just inputstreams. : GMLConfiguration gml = new GMLConfiguration(); Parser p; p = new Parser(gml,newtmpgeom); viewport = (Polygon) p.parse(); I also tried to use the inputsource constructed from a string: p = new Parser(gml); InputSource src = new InputSource(newtmpgeom); viewport = (Polygon) p.parse(src); Resulting in the error: java.net.MalformedURLException: no protocol: <gml:Polygon srsName="urn:ogc:def:crs:EPSG:6.6:3035" xmlns:gml="http://www.opengis.net/gml"> <gml:exterior xmlns:gml="http://www.opengis.net/gml"> <gml:LinearRing> <gml:posList>4100527.55 2546443.706 4101669.813 2551297.031 4102440.967 2551063.104 4103305.401 2550601.054 4104063.084 2549979.24 4104684.898 2549221.557 4105146.948 2548357.123 4105380.875 2547585.969 4100527.55 2546443.706</gml:posList> </gml:LinearRing> </gml:exterior> </gml:Polygon> It seems to me that either the srsName or xmlns declarations are not accepted. Is that right? Thanks Martin Justin Deoliveira wrote: > Ok. So yeah, you should be able to just run maven and have it pick up > all dependencies. > > The reason for the org.geotools.xsd group id rather than just > org.geotools is just a geotools convention we use when modules are > grouped into a common "parent" module. > > I should also note that at the moment we are experiencing problems > with our maven repository. I am trying to fix the issues but for a > time you might not be able to find artifacts online. I am working on > this as we speak. > > Also, if you want to attach your pom.xml, i will verify that there are > no other problems. > > -Justin > > Martin Tomko wrote: >> Justin, >> maybe I did not understand your question properly: >> I am using maven directly, but my understandign is that it uses a >> binary release (I am not compiling geotools). >> This is how I get all my other modules (at the end of email): Note >> tyhat they all have groupID org.geotools, not org.geotools.xsd, as in >> the dependency I found for gt-xsd-gml3. Why is it different? >> >> Cheers >> Martin >> >> <dependency> >> <groupId>org.geotools</groupId> >> <artifactId>gt-main</artifactId> >> <version>${geotools.version}</version> >> </dependency> >> <dependency> >> <groupId>org.geotools</groupId> >> <artifactId>gt-shapefile</artifactId> >> <version>${geotools.version}</version> >> </dependency> >> <dependency> >> <groupId>org.geotools</groupId> >> <artifactId>gt-image</artifactId> >> <version>${geotools.version}</version> >> </dependency> >> <dependency> >> <groupId>org.geotools</groupId> >> <artifactId>gt-geotiff</artifactId> >> <version>${geotools.version}</version> >> </dependency> >> <dependency> >> <groupId>org.geotools</groupId> >> <artifactId>gt-referencing</artifactId> >> <version>${geotools.version}</version> >> </dependency> >> <dependency> >> <groupId>org.geotools</groupId> >> <artifactId>gt-imagemosaic</artifactId> >> <version>${geotools.version}</version> >> </dependency> >> <dependency> >> <groupId>org.geotools</groupId> >> <artifactId>gt-imagepyramid</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-widgets-swing</artifactId> >> <version>${geotools.version}</version> >> </dependency> >> <dependency> >> <groupId>org.geotools</groupId> >> <artifactId>gt-render</artifactId> >> <version>${geotools.version}</version> >> </dependency> >> <dependency> >> <groupId>org.geotools</groupId> >> <artifactId>gt-api</artifactId> >> <version>${geotools.version}</version> >> </dependency> >> <dependency> >> <groupId>org.opengis</groupId> >> <artifactId>geoapi</artifactId> >> <version>2.2-SNAPSHOT</version> >> </dependency> >> <dependency> >> <groupId>org.geotools</groupId> >> <artifactId>gt-coverage</artifactId> >> <version>${geotools.version}</version> >> </dependency> >> >> >> >> Justin Deoliveira wrote: >>> Hi Martin, >>> >>> How are you running your project? Are you using maven directly? Or >>> are you running from a binary release? >>> >>> If you are you using maven directly can just add the xsd-gml3 module >>> to your pom and then all necessary dependencies will be >>> automatically handled. >>> >>> However if you are running from the binary release, you will need >>> all the regular geotools jars, plus the xsd-gml3,xsd-gml2, and >>> xsd-core jars. Here is an exhaustive list of all he java libraries >>> you will need. You can replace 2.5-SNAPSHOT with whatever version >>> you are using. >>> >>> common-2.2.1.jar >>> commons-beanutils-1.7.0.jar >>> commons-collections-3.1.jar >>> commons-jxpath-1.2.jar >>> commons-logging-1.1.1.jar >>> commons-pool-1.3.jar >>> ecore-2.2.2.jar >>> geoapi-2.2.0.jar >>> gt-api-2.5-SNAPSHOT.jar >>> gt-coverage-2.5-SNAPSHOT.jar >>> gt-epsg-hsql-2.5-SNAPSHOT.jar >>> gt-graph-2.5-SNAPSHOT.jar >>> gt-main-2.5-SNAPSHOT.jar >>> gt-metadata-2.5-SNAPSHOT.jar >>> gt-referencing-2.5-SNAPSHOT.jar >>> gt-xsd-core-2.5-SNAPSHOT.jar >>> gt-xsd-gml2-2.5-SNAPSHOT.jar >>> gt-xsd-gml3-2.5-SNAPSHOT.jar >>> hsqldb-1.8.0.7.jar >>> jai_core-1.1.3.jar >>> jdom-1.0.jar >>> jsr-275-1.0-beta-2.jar >>> jts-1.9.jar >>> picocontainer-1.2.jar >>> vecmath-1.3.1.jar >>> xercesImpl-2.7.1.jar >>> xml-apis-1.0.b2.jar >>> xml-apis-xerces-2.7.1.jar >>> xsd-2.2.2.jar >>> >>> Hope that helps, let me know if you have any problems. >>> >>> -Justin >>> >>> >>> Martin Tomko wrote: >>>> Dear Justin, all, >>>> I am playing with the parsing of GML geometries from GML3. What are >>>> the correct maven dependencies for GML3 and the associate XML parser? >>>> I have troubles to do the imports suggested by Justin: >>>> >>>> import org.geotools.gml3.GMLConfiguration; >>>> import org.geotools.xml.Parser; >>>> >>>> using geotools 2.5. snapshot. >>>> >>>> for the following code: >>>> GMLConfiguration gml = new GMLConfiguration(); >>>> Parser p = new Parser(gml); >>>> >>>> Polygon p = (Polygon) p.parse( ... ); >>>> >>>> Thanks >>>> Martin >>> >>> >> >> > > -- Martin Tomko Postdoctoral Research Assistant Geographic Information Systems Division Department of Geography University of Zurich - Irchel Winterthurerstr. 190 CH-8057 Zurich, Switzerland email: [email protected] site: http://www.geo.uzh.ch/~mtomko mob: +41-788 629 558 tel: +41-44-6355256 fax: +41-44-6356848 ------------------------------------------------------------------------------ The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your production scanning environment may not be a perfect world - but thanks to Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700 Series Scanner you'll get full speed at 300 dpi even with all image processing features enabled. http://p.sf.net/sfu/kodak-com _______________________________________________ Geotools-gt2-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
