Skip to content

search.py script should generate search item data for application in expected format #7

@ghost

Description

Issue: Currently the search.py script used to generate the config.search.json file used by the application. This script generates an array of search items which follow the format of [<id>,<name>,<lower-left-x>,<lower-left-y>,<upper-right-x>,<upper-right-y>], but this format is not used by the core library.

The lookahead service expects search items in the following format;

items: [
    {
        'id':'<id>',
        'name': '<name>',
        'label': '<label>',
        'extent': [[<ll-x>,<ll-y>],[<ur-x>,<ur-y>]]
    }, ...
]

Since the search.py script doesn't generate search items in the expected format, the app has a mapping function to update these items when the search control is added. See AddSearch() method in the lode-viewer application.js file, for an example. Instead of having the client generate the required format, the expected format could be generated by the search.py.

Solution: Instead of having the client format the data for the app before using it, it would be better to generate data in the expected format. This change will require the following;

  1. Update the search.py script to generate search items in the expected format
  2. Re-generate the config.search.py using the updated search.py
  3. Remove the map function in the AddSearch() method in the application.js file.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions