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.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
canImport(java.awt.datatransfer.DataFlavor flavor)
java.lang.String
getFormatName()
java.lang.String
getShapeColName()
Returns the name of the feature shape column.boolean
looksLikeFile(java.lang.String location)
uk.ac.starlink.table.StarTable
makeStarTable(uk.ac.starlink.util.DataSource datsrc, boolean wantRandom, uk.ac.starlink.table.StoragePolicy storage)
void
setShapeColName(java.lang.String shapeColName)
Sets the name for the feature shape column.void
streamStarTable(java.io.InputStream in, uk.ac.starlink.table.TableSink sink, java.lang.String pos)
-
-
-
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
-
looksLikeFile
public boolean looksLikeFile(java.lang.String location)
- Specified by:
looksLikeFile
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
-
setShapeColName
public void setShapeColName(java.lang.String shapeColName)
Sets the name for the feature shape column.- Parameters:
shapeColName
- name for STC-S feature shape column
-
getShapeColName
public java.lang.String getShapeColName()
Returns the name of the feature shape column.- Returns:
- name for STC-S feature shape column
-
-