Class GeojsonTableBuilder
java.lang.Object
uk.ac.starlink.ttools.example.GeojsonTableBuilder
- All Implemented Interfaces:
uk.ac.starlink.table.TableBuilder
Experimental GeoJSON table input handler.
It was written with reference to RFC7946 and a countries.geojson file
I found, but it's pretty scrappy. It looks for a type="FeatureCollection"
entry in the top-level object, and then pulls Features out of that,
currently taking account of only Polygon and MultiPolygon types.
Winding directions and exclusions are currently ignored.
Polygons are turned into STC-S POLYGON or UNION of POLYGON entries,
and the other metadata items are stored in their own columns.
The whole GeoJSON input file is slurped into memory, even in streaming mode.
- Since:
- 3 Jun 2020
- Author:
- Mark Taylor
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleancanImport(DataFlavor flavor) Returns the name of the feature shape column.booleanlooksLikeFile(String location) uk.ac.starlink.table.StarTablemakeStarTable(uk.ac.starlink.util.DataSource datsrc, boolean wantRandom, uk.ac.starlink.table.StoragePolicy storage) voidsetShapeColName(String shapeColName) Sets the name for the feature shape column.voidstreamStarTable(InputStream in, uk.ac.starlink.table.TableSink sink, String pos)
-
Constructor Details
-
GeojsonTableBuilder
public GeojsonTableBuilder()Default constructor.
-
-
Method Details
-
canImport
- Specified by:
canImportin interfaceuk.ac.starlink.table.TableBuilder
-
getFormatName
- Specified by:
getFormatNamein interfaceuk.ac.starlink.table.TableBuilder
-
looksLikeFile
- Specified by:
looksLikeFilein interfaceuk.ac.starlink.table.TableBuilder
-
makeStarTable
public uk.ac.starlink.table.StarTable makeStarTable(uk.ac.starlink.util.DataSource datsrc, boolean wantRandom, uk.ac.starlink.table.StoragePolicy storage) throws IOException - Specified by:
makeStarTablein interfaceuk.ac.starlink.table.TableBuilder- Throws:
IOException
-
streamStarTable
public void streamStarTable(InputStream in, uk.ac.starlink.table.TableSink sink, String pos) throws IOException - Specified by:
streamStarTablein interfaceuk.ac.starlink.table.TableBuilder- Throws:
IOException
-
setShapeColName
Sets the name for the feature shape column.- Parameters:
shapeColName- name for STC-S feature shape column
-
getShapeColName
Returns the name of the feature shape column.- Returns:
- name for STC-S feature shape column
-