Package org.pepstock.charba.client.geo
Class GeoUtil
- java.lang.Object
-
- org.pepstock.charba.client.geo.GeoUtil
-
public final class GeoUtil 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 TopoJsoncreateTopoJson(String topojson)Creates theTopoJsonobject definition from a topoJson text definition.static TopoJsoncreateTopoJson(AbstractInjectableResource topojson)Creates theTopoJsonobject definition from a topoJson text definition.static Featurefeature(String topojson, String featureProperty, FeatureFindCallback findCallback)Reads the topoJson definition and find a specific feature to enable outline.static Featurefeature(String topojson, Key featureProperty, FeatureFindCallback findCallback)Reads the topoJson definition and find a specific feature to enable outline.static Featurefeature(TopoJson topojson, String featureProperty, FeatureFindCallback findCallback)Reads the topoJson definition and find a specific feature to enable outline.static Featurefeature(TopoJson topojson, Key featureProperty, FeatureFindCallback findCallback)Reads the topoJson definition and find a specific feature to enable outline.static Featurefeature(AbstractInjectableResource topojson, String featureProperty, FeatureFindCallback findCallback)Reads the topoJson definition and find a specific feature to enable outline.static Featurefeature(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 LabelsloadLabels(List<Feature> features, String property)Creates and loads aLabelsobject with the label of feature object by the property.static LabelsloadLabels(List<Feature> features, Key property)Creates and loads aLabelsobject with the label of feature object by the property.static LabelsloadLabels(List<Feature> features, FeatureLabelCallback labelCallback)Creates and loads aLabelsobject with the label of feature object by the callback.
-
-
-
Method Detail
-
createTopoJson
public static TopoJson createTopoJson(AbstractInjectableResource topojson)
Creates theTopoJsonobject definition from a topoJson text definition.- Parameters:
topojson- topoJson definition.- Returns:
- the
TopoJsonobject definition
-
createTopoJson
public static TopoJson createTopoJson(String topojson)
Creates theTopoJsonobject definition from a topoJson text definition.- Parameters:
topojson- topoJson definition.- Returns:
- the
TopoJsonobject 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 theobjectsnode 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 theobjectsnode 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 theobjectsnode 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 theobjectsnode 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 theobjectsnode 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 theobjectsnode 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 theobjectsnode 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 theobjectsnode 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 theobjectsnode 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 theobjectsnode 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 theobjectsnode 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 theobjectsnode 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 theobjectsnode 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 theobjectsnode 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 theobjectsnode 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 theobjectsnode 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 theobjectsnode 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 theobjectsnode 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 aLabelsobject with the label of feature object by the property.
-
loadLabels
public static Labels loadLabels(List<Feature> features, String property)
Creates and loads aLabelsobject with the label of feature object by the property.
-
loadLabels
public static Labels loadLabels(List<Feature> features, FeatureLabelCallback labelCallback)
Creates and loads aLabelsobject 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
Labelsloaded with all features labels
-
-