Package org.pepstock.charba.client.geo
Class GeoUtils
- java.lang.Object
-
- org.pepstock.charba.client.geo.GeoUtils
-
public final class GeoUtils extends Object
Utility to manage TopoJson definitions.
TopoJson is an extension of GeoJSON that encodes topology.
Rather than representing geometries discretely, geometries in TopoJson files are stitched together from shared line segments called arc.
PAY ATTENTION CHARBA doesn't include any TopoJSON files itself.
Some useful resources I found so far:
- US map: https://www.npmjs.com/package/us-atlas
- World map: https://www.npmjs.com/package/world-atlas
- TopoJson collection: https://github.com/deldersveld/topojson
- Author:
- Andrea "Stock" Stocchero
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static TopoJson
createTopoJson(String topojson)
Creates theTopoJson
object definition from a topoJson text definition.static TopoJson
createTopoJson(AbstractInjectableResource topojson)
Creates theTopoJson
object definition from a topoJson text definition.static Feature
feature(String topojson, String featureProperty, FeatureFindCallback findCallback)
Reads the topoJson definition and find a specific feature to enable outline.static Feature
feature(String topojson, Key featureProperty, FeatureFindCallback findCallback)
Reads the topoJson definition and find a specific feature to enable outline.static Feature
feature(TopoJson topojson, String featureProperty, FeatureFindCallback findCallback)
Reads the topoJson definition and find a specific feature to enable outline.static Feature
feature(TopoJson topojson, Key featureProperty, FeatureFindCallback findCallback)
Reads the topoJson definition and find a specific feature to enable outline.static Feature
feature(AbstractInjectableResource topojson, String featureProperty, FeatureFindCallback findCallback)
Reads the topoJson definition and find a specific feature to enable outline.static Feature
feature(AbstractInjectableResource topojson, Key featureProperty, FeatureFindCallback findCallback)
Reads the topoJson definition and find a specific feature to enable outline.static List<Feature>
features(String topojson, String featureProperty)
Reads the topoJson definition and creates a list of features to enable regions drawing.static List<Feature>
features(String topojson, String featureProperty, FeatureFilterCallback filterCallback)
Reads the topoJson definition and creates a list of features to enable regions drawing.static List<Feature>
features(String topojson, Key featureProperty)
Reads the topoJson definition and creates a list of features to enable regions drawing.static List<Feature>
features(String topojson, Key featureProperty, FeatureFilterCallback filterCallback)
Reads the topoJson definition and creates a list of features to enable regions drawing.static List<Feature>
features(TopoJson topojson, String featureProperty)
Reads the topoJson definition and creates a list of features to enable regions drawing.static List<Feature>
features(TopoJson topojson, String featureProperty, FeatureFilterCallback filterCallback)
Reads the topoJson definition and creates a list of features to enable regions drawing.static List<Feature>
features(TopoJson topojson, Key featureProperty)
Reads the topoJson definition and creates a list of features to enable regions drawing.static List<Feature>
features(TopoJson topojson, Key featureProperty, FeatureFilterCallback filterCallback)
Reads the topoJson definition and creates a list of features to enable regions drawing.static List<Feature>
features(AbstractInjectableResource topojson, String featureProperty)
Reads the topoJson definition and creates a list of features to enable regions drawing.static List<Feature>
features(AbstractInjectableResource topojson, String featureProperty, FeatureFilterCallback filterCallback)
Reads the topoJson definition and creates a list of features to enable regions drawing.static List<Feature>
features(AbstractInjectableResource topojson, Key featureProperty)
Reads the topoJson definition and creates a list of features to enable regions drawing.static List<Feature>
features(AbstractInjectableResource topojson, Key featureProperty, FeatureFilterCallback filterCallback)
Reads the topoJson definition and creates a list of features to enable regions drawing.static Labels
loadLabels(List<Feature> features, String property)
Creates and loads aLabels
object with the label of feature object by the property.static Labels
loadLabels(List<Feature> features, Key property)
Creates and loads aLabels
object with the label of feature object by the property.static Labels
loadLabels(List<Feature> features, FeatureLabelCallback labelCallback)
Creates and loads aLabels
object with the label of feature object by the callback.
-
-
-
Method Detail
-
createTopoJson
public static TopoJson createTopoJson(AbstractInjectableResource topojson)
Creates theTopoJson
object definition from a topoJson text definition.- Parameters:
topojson
- topoJson definition.- Returns:
- the
TopoJson
object definition
-
createTopoJson
public static TopoJson createTopoJson(String topojson)
Creates theTopoJson
object definition from a topoJson text definition.- Parameters:
topojson
- topoJson definition.- Returns:
- the
TopoJson
object definition
-
features
public static List<Feature> features(AbstractInjectableResource topojson, String featureProperty)
Reads the topoJson definition and creates a list of features to enable regions drawing.- Parameters:
topojson
- topoJson definition.featureProperty
- property in theobjects
node of topoJson definition where all regions are defined.- Returns:
- a list of features to enable regions drawing
-
features
public static List<Feature> features(AbstractInjectableResource topojson, Key featureProperty)
Reads the topoJson definition and creates a list of features to enable regions drawing.- Parameters:
topojson
- topoJson definition.featureProperty
- property in theobjects
node of topoJson definition where all regions are defined.- Returns:
- a list of features to enable regions drawing
-
features
public static List<Feature> features(AbstractInjectableResource topojson, String featureProperty, FeatureFilterCallback filterCallback)
Reads the topoJson definition and creates a list of features to enable regions drawing.- Parameters:
topojson
- topoJson definition.featureProperty
- property in theobjects
node of topoJson definition where all regions are definedfilterCallback
- callback instance to filter the features to draw- Returns:
- a list of features to enable regions drawing
-
features
public static List<Feature> features(AbstractInjectableResource topojson, Key featureProperty, FeatureFilterCallback filterCallback)
Reads the topoJson definition and creates a list of features to enable regions drawing.- Parameters:
topojson
- topoJson definition.featureProperty
- property in theobjects
node of topoJson definition where all regions are defined.filterCallback
- callback instance to filter the features to draw- Returns:
- a list of features to enable regions drawing
-
features
public static List<Feature> features(String topojson, Key featureProperty)
Reads the topoJson definition and creates a list of features to enable regions drawing.- Parameters:
topojson
- topoJson definition.featureProperty
- property in theobjects
node of topoJson definition where all regions are defined.- Returns:
- a list of features to enable regions drawing
-
features
public static List<Feature> features(String topojson, String featureProperty)
Reads the topoJson definition and creates a list of features to enable regions drawing.- Parameters:
topojson
- topoJson definition.featureProperty
- property in theobjects
node of topoJson definition where all regions are defined.- Returns:
- a list of features to enable regions drawing
-
features
public static List<Feature> features(String topojson, Key featureProperty, FeatureFilterCallback filterCallback)
Reads the topoJson definition and creates a list of features to enable regions drawing.- Parameters:
topojson
- topoJson definition.featureProperty
- property in theobjects
node of topoJson definition where all regions are defined.filterCallback
- callback instance to filter the features to draw- Returns:
- a list of features to enable regions drawing
-
features
public static List<Feature> features(String topojson, String featureProperty, FeatureFilterCallback filterCallback)
Reads the topoJson definition and creates a list of features to enable regions drawing.- Parameters:
topojson
- topoJson definition.featureProperty
- property in theobjects
node of topoJson definition where all regions are defined.filterCallback
- callback instance to filter the features to draw- Returns:
- a list of features to enable regions drawing
-
features
public static List<Feature> features(TopoJson topojson, Key featureProperty)
Reads the topoJson definition and creates a list of features to enable regions drawing.- Parameters:
topojson
- topoJson definition.featureProperty
- property in theobjects
node of topoJson definition where all regions are defined.- Returns:
- a list of features to enable regions drawing
-
features
public static List<Feature> features(TopoJson topojson, String featureProperty)
Reads the topoJson definition and creates a list of features to enable regions drawing.- Parameters:
topojson
- topoJson definition.featureProperty
- property in theobjects
node of topoJson definition where all regions are defined.- Returns:
- a list of features to enable regions drawing
-
features
public static List<Feature> features(TopoJson topojson, Key featureProperty, FeatureFilterCallback filterCallback)
Reads the topoJson definition and creates a list of features to enable regions drawing.- Parameters:
topojson
- topoJson definition.featureProperty
- property in theobjects
node of topoJson definition where all regions are defined.filterCallback
- callback instance to filter the features to draw- Returns:
- a list of features to enable regions drawing
-
features
public static List<Feature> features(TopoJson topojson, String featureProperty, FeatureFilterCallback filterCallback)
Reads the topoJson definition and creates a list of features to enable regions drawing.- Parameters:
topojson
- topoJson definition.featureProperty
- property in theobjects
node of topoJson definition where all regions are defined.filterCallback
- callback instance to filter the features to draw- Returns:
- a list of features to enable regions drawing
-
feature
public static Feature feature(AbstractInjectableResource topojson, String featureProperty, FeatureFindCallback findCallback)
Reads the topoJson definition and find a specific feature to enable outline.- Parameters:
topojson
- topoJson definition.featureProperty
- property in theobjects
node of topoJson definition where all regions are definedfindCallback
- callback instance to find the features to outline- Returns:
- a features instance to enable outline or
null
-
feature
public static Feature feature(AbstractInjectableResource topojson, Key featureProperty, FeatureFindCallback findCallback)
Reads the topoJson definition and find a specific feature to enable outline.- Parameters:
topojson
- topoJson definition.featureProperty
- property in theobjects
node of topoJson definition where all regions are definedfindCallback
- callback instance to find the features to outline- Returns:
- a features instance to enable outline or
null
-
feature
public static Feature feature(String topojson, Key featureProperty, FeatureFindCallback findCallback)
Reads the topoJson definition and find a specific feature to enable outline.- Parameters:
topojson
- topoJson definition.featureProperty
- property in theobjects
node of topoJson definition where all regions are definedfindCallback
- callback instance to find the features to outline- Returns:
- a features instance to enable outline or
null
-
feature
public static Feature feature(String topojson, String featureProperty, FeatureFindCallback findCallback)
Reads the topoJson definition and find a specific feature to enable outline.- Parameters:
topojson
- topoJson definition.featureProperty
- property in theobjects
node of topoJson definition where all regions are definedfindCallback
- callback instance to find the features to outline- Returns:
- a features instance to enable outline or
null
-
feature
public static Feature feature(TopoJson topojson, Key featureProperty, FeatureFindCallback findCallback)
Reads the topoJson definition and find a specific feature to enable outline.- Parameters:
topojson
- topoJson definition.featureProperty
- property in theobjects
node of topoJson definition where all regions are definedfindCallback
- callback instance to find the features to outline- Returns:
- a features instance to enable outline or
null
-
feature
public static Feature feature(TopoJson topojson, String featureProperty, FeatureFindCallback findCallback)
Reads the topoJson definition and find a specific feature to enable outline.- Parameters:
topojson
- topoJson definition.featureProperty
- property in theobjects
node of topoJson definition where all regions are definedfindCallback
- callback instance to find the features to outline- Returns:
- a features instance to enable outline or
null
-
loadLabels
public static Labels loadLabels(List<Feature> features, Key property)
Creates and loads aLabels
object with the label of feature object by the property.
-
loadLabels
public static Labels loadLabels(List<Feature> features, String property)
Creates and loads aLabels
object with the label of feature object by the property.
-
loadLabels
public static Labels loadLabels(List<Feature> features, FeatureLabelCallback labelCallback)
Creates and loads aLabels
object with the label of feature object by the callback.- Parameters:
features
- list of features to drawlabelCallback
- callback invoked in order to get the label of the feature- Returns:
- a
Labels
loaded with all features labels
-
-