Package edu.cnu.mdi.mapping.loader
Class GeoJsonCityLoader.CityFeature
java.lang.Object
edu.cnu.mdi.mapping.loader.GeoJsonCityLoader.CityFeature
- Enclosing class:
GeoJsonCityLoader
Immutable representation of a single populated-place (city) feature.
Coordinate fields use radians throughout, matching the convention
used by all IMapProjection implementations. Use
Math.toDegrees(double) when displaying values to users.
-
Constructor Summary
ConstructorsConstructorDescriptionCityFeature(String name, String countryName, double longitude, double latitude, long population, int scalerank) Constructs a new city feature. -
Method Summary
Modifier and TypeMethodDescriptionReturns the name of the country in which this city is located, ornullif absent in the source data.doubleReturns the city's latitude in radians (north positive), in the range [-π/2, π/2].doubleReturns the city's longitude in radians (east positive), normalized to (-π, π].getName()Returns the city's display name, ornullif absent in the source data.longReturns the city's population estimate, or-1if the value was not present in the source data.intReturns the city's scalerank: a small integer where0indicates the most prominent cities (capitals, megacities) and larger values indicate progressively less prominent ones.toString()
-
Constructor Details
-
CityFeature
public CityFeature(String name, String countryName, double longitude, double latitude, long population, int scalerank) Constructs a new city feature.- Parameters:
name- display name of the city (may benullif absent from the source data)countryName- name of the country (may benull)longitude- longitude in radians (east positive); should be in (-π, π]latitude- latitude in radians (north positive); should be in [-π/2, π/2]population- population estimate, or-1if unknownscalerank- importance rank where 0 denotes the largest / most prominent cities and larger values denote progressively less prominent ones;-1if unknown
-
-
Method Details
-
getName
Returns the city's display name, ornullif absent in the source data.- Returns:
- city name
-
getCountryName
Returns the name of the country in which this city is located, ornullif absent in the source data.- Returns:
- country name
-
getLongitude
public double getLongitude()Returns the city's longitude in radians (east positive), normalized to (-π, π].- Returns:
- longitude in radians
-
getLatitude
public double getLatitude()Returns the city's latitude in radians (north positive), in the range [-π/2, π/2].- Returns:
- latitude in radians
-
getPopulation
public long getPopulation()Returns the city's population estimate, or-1if the value was not present in the source data.- Returns:
- population estimate or
-1
-
getScalerank
public int getScalerank()Returns the city's scalerank: a small integer where0indicates the most prominent cities (capitals, megacities) and larger values indicate progressively less prominent ones. Returns-1if the value was not present in the source data.Scalerank is used by
CityPointRendererto filter which cities and labels are rendered at a given zoom level.- Returns:
- scalerank or
-1
-
toString
-