Geographic Information Systems Asked by eLowe on March 30, 2021
Ok, I’ve searched and at a loss as to why I cannot find anything on how to save a shapefile to PostGIS with Java. Thought GeoTools might be helpful, but doesn’t seem to be there either.
So here’s the scenario and functionality that I’ve been looking for.
It’s step 3 that doesn’t seem to be out there and what I’d like to find a solution for. In my case the table will have all necessary fields and a couple of other fields to record who uploaded and when etc..
Basically, you need a ShapefileDatastore
to import your shapefile (remember to make sure you have at least 4 files and upto 13 at last count) then you create a PostGISDatastore
to write the features from the first store to.
You will need to include gt-shapefile
and gt-jdbc-postgis
in your pom.xml
. Then if you study this tutorial you will see how reading and writing features works.
If you are in a hurry, you can probably cut and paste from this answer.
Answered by Ian Turton on March 30, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP