Package uk.ac.starlink.ttools.example
Class GeojsonTableBuilder
- java.lang.Object
-
- uk.ac.starlink.ttools.example.GeojsonTableBuilder
-
- All Implemented Interfaces:
uk.ac.starlink.table.TableBuilder
public class GeojsonTableBuilder extends java.lang.Object implements 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 Constructor Description GeojsonTableBuilder()
Default constructor.GeojsonTableBuilder(java.lang.String shapeColName)
Constructs an instance with a given name for the feature shape column.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
canImport(java.awt.datatransfer.DataFlavor flavor)
java.lang.String
getFormatName()
uk.ac.starlink.table.StarTable
makeStarTable(uk.ac.starlink.util.DataSource datsrc, boolean wantRandom, uk.ac.starlink.table.StoragePolicy storage)
void
streamStarTable(java.io.InputStream in, uk.ac.starlink.table.TableSink sink, java.lang.String pos)
-
-
-
Constructor Detail
-
GeojsonTableBuilder
public GeojsonTableBuilder()
Default constructor.
-
GeojsonTableBuilder
public GeojsonTableBuilder(java.lang.String shapeColName)
Constructs an instance with a given name for the feature shape column.- Parameters:
shapeColName
- name for STC-S feature shape column
-
-
Method Detail
-
canImport
public boolean canImport(java.awt.datatransfer.DataFlavor flavor)
- Specified by:
canImport
in interfaceuk.ac.starlink.table.TableBuilder
-
getFormatName
public java.lang.String getFormatName()
- Specified by:
getFormatName
in 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 java.io.IOException
- Specified by:
makeStarTable
in interfaceuk.ac.starlink.table.TableBuilder
- Throws:
java.io.IOException
-
streamStarTable
public void streamStarTable(java.io.InputStream in, uk.ac.starlink.table.TableSink sink, java.lang.String pos) throws java.io.IOException
- Specified by:
streamStarTable
in interfaceuk.ac.starlink.table.TableBuilder
- Throws:
java.io.IOException
-
-