Java Doc for ShapefileWriter.java in  » GIS » openjump » com » vividsolutions » jump » io » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » GIS » openjump » com.vividsolutions.jump.io 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   com.vividsolutions.jump.io.ShapefileWriter

ShapefileWriter
public class ShapefileWriter implements JUMPWriter(Code)
ShapefileWriter is a JUMPWriter specialized to write Shapefiles.

DataProperties for the ShapefileWriter write(DataProperties) interface:

Parameter Meaning
OutputFile or DefaultValue File name for the output .shp file
ShapeType Dimentionality of the Shapefile - 'xy', 'xym' or 'xyz'. 'xymz' and 'xyzm' are the same as 'xyz'

NOTE: The input .dbf and .shx is assumed to be 'beside' (in the same directory) as the .shp file.

The shapefile writer consists of two parts: writing attributes (.dbf) and writing geometries (.shp).

JUMP columns are converted to DBF columns by:

JUMP Column DBF column
STRING Type 'C' – length is size of longest string in the FeatureCollection
DOUBLE Type 'N' – length is 33, with 16 digits right of the decimal
INTEGER Type 'N' – length is 16, with 0 digits right of the decimal

For more information on the DBF file format, see the DBF Specification FAQ

Since shape files may contain only one type of geometry (POINT, MULTPOINT, POLYLINE, POLYGON, POINTM, MULTPOINTM, POLYLINEM, POLYGONM, POINTZ, MULTPOINTZ, POLYLINEZ, or POLYGONZ), the FeatureCollection must be first be normalized to one type:

First non-NULL non-Point geometry in FeatureCollection Coordinate Dimensionality Shape Type
MULTIPOINT xy xym xyzm MULTIPOINT MULTIPOINTM MULTIPOINTZ
LINESTRING/MULTILINESTRING xy xym xyzm POLYLINE POLYLINEM POLYLINEZ
POLYGON/MULTIPOLYGON xy xym xyzm POLYGON POLYGONM POLYGONZ
All geometries in FeatureCollection are Coordinate Dimensionality Shape Type
POINT xy xym xyzm POINT POINTM POINTZ

During this normalization process any non-consistent geometry will be replaced by a NULL geometry.

For example, if the shapetype is determined to be 'POLYLINE' any POINT, MULTIPOINT, or POLYGON geometries in the FeatureCollection will be replaced with a NULL geometry.

The coordinate dimensionality can be explicitly set with a DataProperties tag of 'ShapeType': 'xy', 'xym', or 'xyz' ('xymz' and 'xyzm' are pseudonyms for 'xyz'). If this DataProperties is unspecified, it will be auto set to 'xy' or 'xyz' based on the first non-NULL geometry having a Z coordinate.

Since JUMP and JTS do not currently support a M (measure) coordinate, it will always be set to –10E40 in the shape file (type 'xym' or 'xyzm'). This value represents the Measure "no data" value (page 2, ESRI Shapefile Technical Description). Since the 'NaN' DOUBLE values for Z coordinates is invalid in a shapefile, it is converted to '0.0'.

For more information on the shapefile format, see the ESRI Shapefile Spec



Field Summary
final public static  StringDEFAULT_VALUE_PROPERTY_KEY
    
final public static  StringFILE_PROPERTY_KEY
    
final public static  StringSHAPE_TYPE_PROPERTY_KEY
    
protected static  CGAlgorithmscga
    

Constructor Summary
public  ShapefileWriter()
    

Method Summary
 intfindBestGeometryType(FeatureCollection fc)
     Find the generic geometry type of the feature collection.
 intfindMaxStringLength(FeatureCollection fc, int attributeNumber)
    
public  intguessCoorinateDims(Geometry g)
    
 MultiPolygonmakeGoodSHAPEMultiPolygon(MultiPolygon mp)
    
 PolygonmakeGoodSHAPEPolygon(Polygon p)
    
public  GeometryCollectionmakeSHAPEGeometryCollection(FeatureCollection fc)
     return a single geometry collection
result.GeometryN(i) = the i-th feature in the FeatureCollection
All the geometry types will be the same type (ie.
 LinearRingreverseRing(LinearRing lr)
    
public  voidwrite(FeatureCollection featureCollection, DriverProperties dp)
     Main method - write the featurecollection to a shapefile (2d, 3d or 4d).
 voidwriteDbf(FeatureCollection featureCollection, String fname)
     Write a dbf file with the information from the featureCollection.

Field Detail
DEFAULT_VALUE_PROPERTY_KEY
final public static String DEFAULT_VALUE_PROPERTY_KEY(Code)



FILE_PROPERTY_KEY
final public static String FILE_PROPERTY_KEY(Code)



SHAPE_TYPE_PROPERTY_KEY
final public static String SHAPE_TYPE_PROPERTY_KEY(Code)



cga
protected static CGAlgorithms cga(Code)




Constructor Detail
ShapefileWriter
public ShapefileWriter()(Code)
Creates new ShapefileWriter




Method Detail
findBestGeometryType
int findBestGeometryType(FeatureCollection fc)(Code)
Find the generic geometry type of the feature collection. Simple method - find the 1st non null geometry and its type is the generic type. returns 0 - all empty/invalid
1 - point
2 - line
3 - polygon

Parameters:
  fc - feature collection containing tet geometries.



findMaxStringLength
int findMaxStringLength(FeatureCollection fc, int attributeNumber)(Code)
look at all the data in the column of the featurecollection, and find the largest string!
Parameters:
  fc - features to look at
Parameters:
  attributeNumber - which of the column to test.



guessCoorinateDims
public int guessCoorinateDims(Geometry g)(Code)
Returns:
2 for 2d (default)
4 for 3d - one of the oordinates has a non-NaN z value
(3 is for x,y,m but thats not supported yet)

Parameters:
  g - geometry to test - looks at 1st coordinate



makeGoodSHAPEMultiPolygon
MultiPolygon makeGoodSHAPEMultiPolygon(MultiPolygon mp)(Code)
make sure outer ring is CCW and holes are CW for all the polygons in the Geometry
Parameters:
  mp - set of polygons to check



makeGoodSHAPEPolygon
Polygon makeGoodSHAPEPolygon(Polygon p)(Code)
make sure outer ring is CCW and holes are CW
Parameters:
  p - polygon to check



makeSHAPEGeometryCollection
public GeometryCollection makeSHAPEGeometryCollection(FeatureCollection fc) throws Exception(Code)
return a single geometry collection
result.GeometryN(i) = the i-th feature in the FeatureCollection
All the geometry types will be the same type (ie. all polygons) - or they will be set to
NULL geometries

GeometryN(i) = {Multipoint,Multilinestring, or Multipolygon)

Parameters:
  fc - feature collection to make homogeneous



reverseRing
LinearRing reverseRing(LinearRing lr)(Code)
reverses the order of points in lr (is CW -> CCW or CCW->CW)



write
public void write(FeatureCollection featureCollection, DriverProperties dp) throws IllegalParametersException, Exception(Code)
Main method - write the featurecollection to a shapefile (2d, 3d or 4d).
Parameters:
  featureCollection - collection to write
Parameters:
  dp - 'OutputFile' or 'DefaultValue' to specify where to write, and 'ShapeType' to specify dimentionality.



writeDbf
void writeDbf(FeatureCollection featureCollection, String fname) throws Exception(Code)
Write a dbf file with the information from the featureCollection.
Parameters:
  featureCollection - column data from collection
Parameters:
  fname - name of the dbf file to write to



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.