Shapefile Layer Factory
Builds a RenderableLayer from an ESRI shapefile. Two entry points:
createLayer (URL form) fetches
foo.shpplus thefoo.dbfandfoo.prjsidecars over HTTP, matching WebWorldWind's URL+callback pattern.createLayer (raw-bytes form) parses already-loaded buffers. Use this for bundled assets or any case where the caller is doing its own IO.
The optional shapeConfiguration callback runs once per record (after attribute join) and lets the caller swap in custom ShapeAttributes / PlacemarkAttributes, label the shape, extrude polygons, etc. Returning null drops the record.
Renderables produced (matching WebWorldWind):
Functions
Load a shapefile from a URL pointing at the .shp file. The factory will derive the .dbf and .prj sidecar URLs by replacing the extension and fetch all three concurrently-ish (sequentially, matching the reference). Sidecars that 404 or fail to download are tolerated and the layer is built without them.
Build a layer from already-loaded buffers. The DBF, PRJ, and CPG buffers are all optional; if absent, attributes default to empty maps, the shapefile is assumed to be geographic, and DBF text decoding falls back to Latin-1.
Loads a shapefile distributed as a ZIP archive (the canonical packaging on most data portals). The first .shp, .dbf, .prj, and .cpg entries found are routed through ShapefileLayerFactory.createLayer. Entries deeper in subdirectories are accepted too, but only the first match of each extension is used — ZIP archives occasionally bundle multiple shapefiles together, and picking one deterministically is better than guessing.
Iterate shapefile records, run shapeConfiguration per record, and pass each resulting Renderable back through consumer alongside the originating record. The base createLayer entry points use this internally; bulk feature sources (e.g. earth.worldwind.formats.shapefile.ShapefileBulkFeatureSource) call it directly to intercept each renderable + its DBF attributes for cache encoding without rebuilding the shape-construction logic.