Skip to content
This repository has been archived by the owner on Sep 16, 2020. It is now read-only.

geoloep/openls-geocode-parser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OpenLS Geocode request parser

This utility parses OpenLS geocode request xml files into JavaScript Objects.

Usage

Include the openLSParser in your script and pass a Geocoderesponse to it.

var openLSParser = require("openls-geocode-parser");

openLSparser(
    '<xls:GeocodeResponse xmlns:xls="http://www.opengis.net/xls" xmlns:gml="http://www.opengis.net/gml"> ... </xls:GeocodeResponse>',
    function onSuccess(geocodeResponse) {
        console.log(geocodeResponse);
    },
    function onFail() {
        console.log('Something went wrong!');
    }
);

The GeocodeResponse is categorized into different 'depths':

  • Country
  • CountrySubdivision
  • Municipality
  • MunicipalitySubdivision
  • Street
  • Building

A fully featured GeocodedAddress has the following structure:

geocodeResponse = {
    Building?: [
            {
            Country: string,
            Depth: string (= Building)
            Place: {
                CountrySubdivision?: string,
                Municipality?: string,
                MunicipalitySubdivision?: string
            },
            Point: {
                srsName: string,
                pos: [number, number]
            },
            PostalCode?: string,
            StreetAddress? {
                Building?: {
                    number: number,
                    subdivision?: string
                },
                Street: string
            }
        },
        {
        ...
        },
        ...
    ],
    Street? [
        ...
    ],
    ...
}

About

Utility for parsing OpenLS Geocode responses

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published