Class GeoJsonCountryLoader

java.lang.Object
edu.cnu.mdi.mapping.loader.GeoJsonCountryLoader
All Implemented Interfaces:
ICountryLoader

public final class GeoJsonCountryLoader extends Object implements ICountryLoader
Utility for loading country boundary polygons from a GeoJSON FeatureCollection.

Designed primarily for Natural Earth 10m cultural vectors, but tolerates minor schema variations. Features with missing required properties or unsupported geometry types are silently skipped rather than causing a parse failure.

Expected GeoJSON schema

 {
   "type": "FeatureCollection",
   "features": [
     {
       "type": "Feature",
       "properties": {
         "ADMIN":  "United States of America",
         "ISO_A3": "USA"
       },
       "geometry": {
         "type": "Polygon" | "MultiPolygon",
         "coordinates": [...]   // degrees, longitude first
       }
     }, ...
   ]
 }
 

Coordinate handling

Input coordinates are in degrees (longitude, latitude order as required by GeoJSON RFC 7946). They are converted to radians and the longitude is wrapped to (-π, π] before being stored in the returned GeoJsonCountryLoader.CountryFeature.

Thread safety

This class has no mutable state. The internal ObjectMapper is thread-safe for reading and may be shared freely. The returned lists are unmodifiable.

This class is not instantiable.

  • Constructor Details

    • GeoJsonCountryLoader

      public GeoJsonCountryLoader()
      No-arg constructor required for use as an ICountryLoader instance.
  • Method Details