Skip to content

AtmosphericX/placefile-parser

🗺️ AtmosphericX - Placefile Parser 🌎

A Placefile is a structured text file used to provide geospatial data for mapping applications, often for weather alerts, storm reports, or points of interest. A Placefile contains instructions for displaying locations on a map, including coordinates, labels, colors, icons, and refresh intervals. This module is primarily intended for use with the https://github.com/k3yomi/AtmosphericX project.

Documentation written by @k3yomi

GitHub Repo stars GitHub forks GitHub issues GitHub pull requests

Installation (NPM)

npm install @atmosx/placefile-parser

Example Usage

const { PlacefileManager } = require('@atmosx/placefile-parser'); // CJS
import { PlacefileManager } from '@atmosx/placefile-parser'; // ESM


const sample = fs.readFileSync("test", "utf-8"); // For testing...

// Parsing a basic placefile
PlacefileManager.parsePlacefile(sample).then((objects) => {
    console.log("Parsed Objects:", objects);
})

// Parsing a table
PlacefileManager.parseTable(sample).then((table) => {
    console.log("Parsed Table:", table);
})


// Parsing GeoJSON
PlacefileManager.parseGeoJSON(sample).then((geojson) => {
    console.log("Parsed GeoJSON:", geojson);
})

// Creating a placefile 
PlacefileManager.createPlacefile({
    refresh: 60,
    threshold: 50,
    title: "Sample Placefile",
    settings: "ShowLabels, ShowIcons",
    type: "Point",
    objects: [
        {
            coordinates: [34.0522, -118.2437],
            label: "Los Angeles",
            color: "255 0 0",
        },
        {
            coordinates: [40.7128, -74.0060],
            label: "New York",
            color: "0 0 255",
        }
    ]
}).then((placefile) => {
    console.log("Generated Placefile:\n", placefile);
});

References

Documentation | Discord Server | Project Board |
Code of Conduct | Contributing | License | Security | Changelogs |

Acknowledgements

  • k3yomi
    • Lead developer @ AtmosphericX and maintainer of this module.
  • StarflightWx
    • For testing and providing feedback (Co-Developer and Spotter @ AtmosphericX)

About

A Placefile is a structured text file used to provide geospatial data for mapping applications, often for weather alerts, storm reports, or points of interest. A Placefile contains instructions for displaying locations on a map, including coordinates, labels, colors, icons, and refresh intervals.

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Contributors