Writing multiple polygons to 1 .shp and creating attributes in .dbf

3 messages Options
Embed this post
Permalink
yuanyee

Writing multiple polygons to 1 .shp and creating attributes in .dbf

Reply Threaded More More options
Print post
Permalink
Some javascript/style in this post has been disabled (why?)
Hi,
We need to do the following for a project:
- Write multiple polygons to 1 shapefile
- Also export a .dbf file along with the .shp file, and the .dbf should contain attributes associated with the polygon

I'm totally new to geotools. Would someone please tell me if this can be easily done using the geotools API?

I'm thinking of writing a Java program that would extract the polygons and attributes from an Oracle database, and then call the geotools API to construct the .shp and .dbf file. The polygons are currently stored as a list of lat-long in the database.

Thanks,
Elaine


New! Hotmail sign-in on the MSN homepage.
------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Geotools-gt2-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
Larry Reeder

Re: Writing multiple polygons to 1 .shp and creating attributes in .dbf

Reply Threaded More More options
Print post
Permalink
Hey Elaine,

The class ShapefileDataStore should do what you want:

http://javadoc.geotools.fr/2.6/org/geotools/data/shapefile/ShapefileDataStore.html

You may also want to check out the user guide for creating a datastore:

http://docs.codehaus.org/display/GEOTDOC/04+How+to+Create+a+DataStore+or+DataAccess

and using a featurestore:

http://docs.codehaus.org/display/GEOTDOC/07+FeatureStore


 -Larry

On Wed, Oct 21, 2009 at 11:25 AM, Elaine Ting <[hidden email]> wrote:
Hi,
We need to do the following for a project:
- Write multiple polygons to 1 shapefile
- Also export a .dbf file along with the .shp file, and the .dbf should contain attributes associated with the polygon

I'm totally new to geotools. Would someone please tell me if this can be easily done using the geotools API?

I'm thinking of writing a Java program that would extract the polygons and attributes from an Oracle database, and then call the geotools API to construct the .shp and .dbf file. The polygons are currently stored as a list of lat-long in the database.

Thanks,
Elaine


New! Hotmail sign-in on the MSN homepage.

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Geotools-gt2-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users



------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Geotools-gt2-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
mbedward

Re: Writing multiple polygons to 1 .shp and creating attributes in .dbf

Reply Threaded More More options
Print post
Permalink
In reply to this post by yuanyee
Hi Elaine,

As well as the javadocs that Larry mentioned please see the CVS 2 Shp
example here...

http://geotools.org/examples/csv2shp.html

This example is writing points to a shapefile rather than polygons but
the process is just the same otherwise.

Michael

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Geotools-gt2-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users