Chris,

To convert a GML file to a Shapefile, you need first to know which objects (and 
their attributes and types) are described in the GML and thus which objects 
(and 
their attributes and type) you will put in the Shapefile.  It's your choice to 
get some attributes or other (depending on what you need), and also to build 
one 
or more Shapefile of points or of lines or polygons: the only attribute not to 
forget is thus the one concerning the geometry type, in order to build points, 
lines or polygones.

In a Java world, I would do this :
- To read/write a GML File, I use an XML Parser (such as SAXParser, I let you 
find some explanations on the Web) 

- From the reading of a GML File, I build (java) objects.
- I put my (Java) objects in a Shapefile, according to this example  ( 
http://docs.geotools.org/stable/userguide/examples/csv2shp.html ) : I do not 
use 
a csv file as an input, but my stored java objects and attributes.


I hope it will help you to write an algorithm and to implement it.
Sidonie





________________________________
De : chris <[email protected]>
À : [email protected]
Envoyé le : Mer 18 août 2010, 12h 15min 49s
Objet : Re: [Geotools-gt2-users] Help needed - Import GML to SHP


I've just been chatting with a colleague and he reckons we need a few bits of
information before we can start writing the shapefiles. The points he
mentioned are:

1. How do we find the type of the gml file, and based on this, find the
shapefiletype.

2. How do we find the column properties (name, type) etc

3. He tells me a shapefile can only be one type - either point, polygon, or
line..... the gml file seems to contain all of these. How can i convert it
to shapefile?

4. Which of the gml properties need to be included in the shapefile, and
what can be ignored.

Cheers

Chris
-- 
View this message in context: 
http://osgeo-org.1803224.n2.nabble.com/Help-needed-Import-GML-to-SHP-tp5431467p5435741.html

Sent from the geotools-gt2-users mailing list archive at Nabble.com.

------------------------------------------------------------------------------
This SF.net email is sponsored by 

Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev 
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users



      
------------------------------------------------------------------------------
This SF.net email is sponsored by 

Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev 
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to