title: How to read a shape(.shp) file and display its values USING JAVA CODE
body: <p>I have a shape file like below. I converted it using an online converter. then I am getting values of this file as below</p>
  
  <p><a href="https://i.stack.imgur.com/4MOVr.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/4MOVr.png" alt="enter image description here"></a></p>
  
  <blockquote>
    <p>{"type":"Polygon","coordinates":[[[973154.7117999941,194614.3315999955],[973733.1576000005,194006.27879999578],[973685.9174000025,193958.0421999991],[973648.6635999978,193712.4756000042],[973648.052399993,193711.8941999972],[973525.3418000042,193713.4443999976],[973489.2430000007,193713.75579999387],[973434.6291999966,193713.75579999387],[973338.1589999944,193619.1521999985],[973282.610799998,193672.8328000009],[973265.806400001,193687.9265999943],[973246.2016000003,193707.22059999406],[973221.9282000065,193730.8708000034],[973190.808799997,193761.98980000615],[973150.0426000059,193801.5124000013],[973064.4640000015,193885.53419999778],[973003.7818000019,193945.2828000039],[973005.9601999968,193949.0175999999],[972911.9798000008,194040.50859999657],[972812.7090000063,194138.84540000558],[972728.6863999963,194053.8897999972],[972671.7383999974,193996.00779999793],[972693.9886000007,193973.4458000064],[972697.2559999973,193970.17900000513],[973180.8501999974,193471.33599999547],[973178.9834000021,193469.46819999814],[973156.2663999945,193449.7080000043],[973078.4679999948,193380.77760000527],[972940.6092000008,193251.3222000003],[972792.1697999984,193107.86200000346],[972726.1974000037,193043.75599999726],[972696.9449999928,193014.815200001],[972695.0771999955,193016.37060000002],[972499.9596000016,193216.46819999814],[972248.2037999928,193474.13639999926],[972136.7970000058,193588.03319999576],[972147.6886000037,193598.30220000446],[972141.7758000046,193603.90420000255],[972405.9792000055,193869.9740000069],[972333.1604000032,193941.5488000065],[972499.9596000016,194116.7502000034],[972676.0841999948,194301.77220000327],[972860.2456,194476.96639999747],[972904.5110000074,194434.79039999843],[972936.5644000024,194403.67139999568],[972963.7939999998,194430.27779999375],[973154.7117999941,194614.3315999955]]]}</p>
  </blockquote>
  
  <p>this is one row of data. like this I have 46823 data. I want to store this data to my postgresql table. my table is geometries and it has 2 columns 'name','geom'. My table syntax is given below.</p>
  
  <blockquote>
    <p>CREATE TABLE geometries (name varchar, geom geometry);</p>
  </blockquote>
  
  <p>I wrote java code to read .shp file.</p>
  
  <pre><code>import java.io.FileInputStream;
  import java.io.IOException;
  import org.nocrala.tools.gis.data.esri.shapefile.ShapeFileReader;
  import org.nocrala.tools.gis.data.esri.shapefile.ValidationPreferences;
  import org.nocrala.tools.gis.data.esri.shapefile.exception.InvalidShapeFileException;
  import org.nocrala.tools.gis.data.esri.shapefile.header.ShapeFileHeader;
  import org.nocrala.tools.gis.data.esri.shapefile.shape.AbstractShape;
  public class BigFileExample {
  
    public static void main(String[] args) throws IOException,
        InvalidShapeFileException {
  
      FileInputStream is = new FileInputStream(
          "D:\\Test\\Filename.shp");
       ValidationPreferences prefs = new ValidationPreferences();
      prefs.setMaxNumberOfPointsPerShape(16650);
      ShapeFileReader r = new ShapeFileReader(is, prefs);
  
      ShapeFileHeader h = r.getHeader();
      System.out.println("The shape type of this files is " + h.getShapeType());
  
      int total = 0;
      AbstractShape s;
      while ((s = r.next()) != null) {
          System.out.println(s.getShapeType());
  
        total++;
      }
      System.out.println("Total shapes read: " + total);
      is.close();
    }}
  </code></pre>
  
  <p>After executing this code i am getting only the shape as 'POLYGON'. In my shape file there is some multipolygon also. But my code did not give me such output.
  Also how do I get the coordinate values? what should I write to get the coordinates in the shape file? Please help me to get this</p>