Data types & Utilities

Werken met coordinaten

polka/examples/datatypes/coordinates.js
export const coordinates = (application) => {

    /**
     * Coordinate{Array.<number>}
     * An array of numbers representing an xy coordinate. Example: [16, 48].
     */

    /** 
     * coordinaten in Eindhoven
     * [ x, y ]
     */
    const Eindhoven = [162833.06448813833, 386140.48611484875];

    /**
     * template string with `{x}` and `{y}` placeholders
     * that will be replaced by first and second coordinate values.
     */
    const string = application.utils.coordinate.format(Eindhoven, "Eindhoven: {x} {y}");
    console.log(string);

};

Werken met projecties

polka/examples/datatypes/transform.js
export const transform = (application) => {

    /**
     * "GPS" Coordinaten (EPSG:4326) van Eindhoven [lat, lon]
     * @see https://epsg.io/4326
     */
    const Eindhoven = [5.499921405840683,51.46427760915219];

    /** als Point */
    const point = application.utils.Point(Eindhoven);

    /**
     * transformeer naar RD coordinaten (EPSG:28992)
     * @see https://epsg.io/28992
     */
    const coord = point.transform('EPSG:4326', 'EPSG:28992').getCoordinates();
    console.log(`lat/lon ${Eindhoven} naar RD ${coord}`);

};