Code Monkey home page Code Monkey logo

mapapps-query-builder's Introduction

Query Builder

The Query Builder Bundle allows you to create your own Query Tools that perform custom complex queries on a store. For example, choosing all cities with more than 1 million inhabitants. The results of your queries are shown in the resultcenter. As an admin, it is possible to create complex queries using an interactive graphical user interface, or manually in a text format. If you enable the editing of a tool, the users will be able to change selected parts of the query. They can create their own queries if you add a special tool to your app.

Screenshot App

The Query Builder 3 for Linie 3 can be found in the 3.x branch: https://github.com/conterra/mapapps-query-builder/tree/3.x

Build Status

devnet-bundle-snapshot

Sample App

https://demos.conterra.de/mapapps/resources/apps/downloads_query_builder/index.html

Installation Guide

⚠️Requirement: map.apps 4.13.0

⚠️Attention the new Query Builder version 5 has a different configuration than the previous version 4

dn_querybuilder Documentation

dn_queryplaceholder Documentation

Development Guide

Define the mapapps remote base

Before you can run the project you have to define the mapapps.remote.base property in the pom.xml-file: <mapapps.remote.base>http://%YOURSERVER%/ct-mapapps-webapp-%VERSION%</mapapps.remote.base>

Other methods to to define the mapapps.remote.base property.

  1. Goal parameters mvn install -Dmapapps.remote.base=http://%YOURSERVER%/ct-mapapps-webapp-%VERSION%

  2. Build properties Change the mapapps.remote.base in the build.properties file and run: mvn install -Denv=dev -Dlocal.configfile=%ABSOLUTEPATHTOPROJECTROOT%/build.properties

mapapps-query-builder's People

Contributors

andrfra avatar barrymasterson avatar chrissw-r1 avatar danielhiscock avatar dpayk avatar gtschorn avatar henriasche avatar jessebluemr avatar lradigkconterra avatar matthiasstein avatar sarahlechler avatar scmgeocom avatar senait8991 avatar sholtkamp avatar slim01 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mapapps-query-builder's Issues

ignoreFields of ExportResultsCommand in resultcenter is ignored

Reproduction

  • Create a query builder query
  • Configure resultcenter to ignore some fields for CSV export
  • Query features

Expected

  • CSV does not contain ignored fields

Actual

  • CSV still contains all fields of the service

Note

  • We used a configuration that worked for a "normal" selection

No textual input hint in case of error

ACTUAL:
In the query builder no hint is given in case of an error but the error location is only highlighted in red.

SHOULD:
Error locations are highlighted by highlighting and by textual notes.

Originally reported in JIRA as MAPAPPS-6388

Bundles does not work together: "dn_printingenhanced" and "dn_querybuilder" in the same Line 4 App

If I put both bundles (latest versions) in the same app, i got the follwing console error for dn_printingenhanced-bundle:

TypeError: "ComponentReferenceController._injectService: Exception during injection of reference 'mapWidgetModel' with service:'undefined' cause of TypeError: this[c] is undefined" Dojo 29 layer.js:1221:285 Dojo 27 Component.activate: Component 'PrintingPreviewController' of bundle 'Bundle[25]-dn_printingenhanced-v1.1.5:ACTIVE' error during activation of component 'PrintingPreviewController'! ACTIVATION_ERROR: "Component._createComponentContext: Component 'PrintingPreviewController' of bundle 'Bundle[25]-dn_printingenhanced-v1.1.5:ACTIVE' component context can't be created, impl: 'PrintingPreviewController'! cause of TypeError: ComponentReferenceController._injectService: Exception during injection of reference 'mapWidgetModel' with service:'undefined' cause of TypeError: this[c] is undefined" Dojo 29 layer.js:1173:375 Dojo 10

Every bundle on its own in an app works.
I ask for support.

With kind regards
Jörg Arnold

QueryBuilder Widget-Konfiguration

Ich würde gerne das Fenster (Widget) welches bei einem konfigurierten Querytool erscheint unplatzierten. Leider ist diese Information nicht im manifest.json drin. Es sieht so aus als würde da generisch ein Widget aus dem FilterQuery.js erstellt (siehe unten). Wenn ich hier die Margin Box und den Titel anpasse funktioniert es, es gilt aber dann ja für alle Abfragen. Gibt es eine Möglichkeit das in der app.json zu konfigurieren?

if (event.options.editable === true) {
                var props = event._properties;
                var i18n = event._i18n.get();
                var tool = event.tool;
                var mapState = this._mapState;
                var dataModel = this._dataModel;
                var replacer = this._replacer;
                var logService = this._logService;
                var widget = this.widget = new EditableQueryBuilderWidget({
                    properties: props,
                    i18n: i18n.wizard,
                    tool: tool,
                    store: store,
                    mapState: mapState,
                    dataModel: dataModel,
                    replacer: replacer,
                    logService: logService
                });
                var window = this._windowManager.createWindow({
                    title: i18n.wizard.editWindowTitle,
                    marginBox: {
                       w: 550,
                        h: 274,
                        t: 100,
                        r: 100
                    },
                    content: widget,
                    closable: true,
                    resizable: true
                });
                window.show();

Add stores after startup

Allow users to add more search stores after app startup (e.g. by using the sdi_loadservice bundle).

Feature Wish: allow queries on tables (without geometry)

Allow queries based on tables.
Currently, the QueryController.js gives an error when trying to transform non existing geometries in the function:

ct_when(this._coordinateTransformer.transform(geometries, wkid), function (transformedGeometries) { ...}

Linie 4 - manual input is broken

If a value is entered manually to a v-combobox, it is not possible to search with this value directly. It must first be clicked outside the input field for the value to be accepted correctly.

UserQueryBuilderWidgetFactory throws unexpected error

Hi,

in map.apps V 4.7.2 we using Line 3 Apps together with SDi-Extension V 4.0.3.
When we use the sdi_srschanger-tool the map-context from the app will be "reinitialized" as designed, but in this case the console logs the following error:

Component._releaseComponentContext: Component 'UserQueryBuilderWidgetFactory' of bundle 'Bundle[29]-dn_querybuilder-v3.4.5:ACTIVE' method 'deactivate' in class 'UserQueryBuilderWidgetFactory' throws unexpected error! {canceled: false, type: "UNKNOWN", cause: TypeError: this.disconnect is not a function
at Object.deactivate (https://edn-geoservices.stad…, message: "this.disconnect is not a function", msg: "this.disconnect is not a function", …}canceled: falsecause: TypeError: this.disconnect is not a function
at Object.deactivate
(...more lines follow...)

Is it a fault of the dn_querybuilder-bundle or is it a fault of the sdi_srschanger-bundle..?
Can you help in this case please?

Best regards,
Jörg Arnold

Entries in Live Configuration are missing

Reproduction

  • Use querybuilder 3.2.2 with map.apps 3.7.0
  • Open Live Configuration

Expected

  • Entries "Grundeinstellungen", "UserQueryBuilderWidget", "QueryTools" appear

Actual

  • Only "Grundeinstellungen" appears

Authentication placeholder timing issue with AGOL authentication

The username placeholder is not fulfilled when using AGOL authentication. There is a timing issue here where the AuthenticationPlaceholderProvider is called before the AuthenticationService. current workaround in a project is to set the start level in the manifest higher:
"dn_querybuilder": { "MANIFEST": { "Bundle-StartLevel": 100 },...

Sample Queries not working properly in map.apps 4.12.0

The sample queries provided do not work properly as of now:

  • Using the query "Show reported street damages that are not yet fixed in Münster" twice in succession returns the warning "Keine Ergebnisse für Ihre Abfrage gefunden"
  • Using either of the queries targeting the layer "wahlkreise_strukturdaten" returns the error "compareFields: requires at least one field"

These issues also persist in the map.apps 4.13.0-SNAPSHOT version

Queries with time awareness

Hi @matthiasstein . Bzgl. der Query Tools (geometrisch und attributiv) habe ich ein Anliegen. Aus meiner Sicht sollten die Queries auch zeitliche Einschränkungen unterstützen, wenn die Layer Zeit unterstützen. Mit dem TimeSlider hattet ihr ja schon eingebaut, dass man bei Start der App einen TimeExtent definieren kann. Dieser und jeweils der, der mit dem Slider gesetzt wird, sollte dann auch bei den Queries aus den bekannten Tools berücksichtigt werden.

Grüsse
Martin

Disable distinct value query for SHAPE fields

Although enableDistinctValues=true is a good choice for most fields, there are some fields where a list of values to choose from is not possible.

This issue addresses a bug with ArcGIS system field SHAPE.AREA and SHAPE.LEN.

The query for distinctValues fails in AGS, hence it should not be performed for those ArcGIS System fields. A plain text field that can be used for the query is sufficient.

Wrong fields in "Build your own query" when only one store is declared

In our setup we only declare one single store with

"QueryBuilderWidgetModel": {
    "storeIds": ["teilflaechen"]
}

Although the UI displays the correct store, the selectable fields (marked yellow in the screenshot) are those of the first store in the list of all available stores (this.stores in QueryBuilderWidgetModel.js link )

image

contentviewer rules are not applied for features queried by query builder

Reproduction

  • Create an app that uses a custom template in the contentviewer
  • The contentviewer definition is defined for both MapModelNodeID and AGSStore, thus: "contentRules": [ { "matches": { "context": { "$or": [ { "storeId": "_AGS_STORE_1488378066332" }, { "mapModelNodeId": "service_48664_1488378033813/0" } ] } },
  • Execute a query builder-query
  • Klick on a resultcenter entry (1) or on the feature on the map (2)

Expected

  • The customtemplate of the contentviewer is applied

Actual

  • (1) The standard contentviewer GRID layout is applied
  • (2) The overlay does not allow a featureinfo on the feature
  • Thus, the contentviewer rules are not applied for features that were queried by the query builder

GEONIS forms cannot be opened from resultcenter

GEONIS forms do not open from resultcenter.

Suggested fix from our developert (tested with an earlier version 3.2.6 in a project):

QueryController.js, Line 105:

var memorySelectionStore = new MemorySelectionStore({
id: store.id || "querybuilderMemorySelectionStore",

Sample app not working in map.apps 4.12-SNAPSHOT

The provided sample application does not work with map.apps 4.12.

No queryable data is available.
Metadata for the Stores cannot be loaded as they do not contain queryable fields.
None of the predefined queries can be executed as the related stores are undefined.

Domains from types are not displayed

If a feature class has domains from types, the query builder currently only shows the codes, not the values.

The reason for this is that the domains are not stored in the field metadata, but in the type metadata at layer level.

I created a patch for MetadataAnalyzer.getFields:

return new Promise((resolve) => {
        try {
            const queryBuilderProperties = this._queryBuilderProperties;
            const metadata = store.getMetadata();
            apprt_when(metadata, (metadata) => {
                const types = metadata.types;
                const domainsFromTypes = {};
                types && types.forEach(type =>{
                    if(type.domains){
                        for (const [key, value] of Object.entries(type.domains)){
                            if(domainsFromTypes[key]){
                                domainsFromTypes[key].concat(value.codedValues);
                            }else{
                                domainsFromTypes[key] = value.codedValues;
                            }
                        }
                    }
                })

                const fields = metadata.fields;
                const storeData = [];
                fields.forEach((field) => {
                    let codedValues = (field.domain && field.domain.codedValues) || domainsFromTypes[field.name] || [];
                    let codedValueString = codedValues.length>0 ? "[CV]" : "";
                    if (field.type !== "geometry") {
                        let title = field.title;
                        if (!title || title === "") {
                            title = field.name;
                        }
                        let text = title;
                        if (queryBuilderProperties.showFieldType) {
                            text = title + " (" + field.type + ") " + codedValueString;
                        }
                        storeData.push({
                            id: field.name,
                            text: text,
                            type: field.type,
                            codedValues: codedValues,
                            distinctValues: [],
                            loading: false
                        });
                    }
                });
                resolve(storeData);
            }, this);
        } catch (e) {
            this._logService.error({
                id: 0,
                message: e
            });
        }
    });

complexQuery without wildcard character in front of request

The dn_querybuilder for map.apps 4 do not Support "Wildcard"definition/-automation for Requests against AGS-Services for isLike field-konfiguration

In dn_querybuilder line 4 the request against the AGS looks like:
…/MapServer/0/query?f=json&orderByFields=&outFields=*&where=LOWER(NAME) like 'during%'

dn_querybuilder Linie3
…/MapServer/0/query?f=json&where=(LOWER(NAME)%20like%20%27%25during%25%27)&returnGeometry=true&outFields=*&orderByFields=&callback=dojo.io.script.jsonp_dojoIoScript3._jsonpCallback

You can see that the requestin line 4 is without leading "%" or (%27). In line 4 the Wildcard ist only after the searchstring. So the resultcenter Shows only results with leading string "during" not as in line 3 results where "during" is containing in the searchfield at any Position.

There is also a con terra Support ticket for this case (#CRN20393),

Disable distinct value query for individual fields

Although enableDistinctValues=true is a good choice for most fields, there are some fields where a list of values to choose from is not necessary or wanted.

This issue addresses a possible enhancement, e.g. for numeric fields that contain a lot of values:

Think of a field like POPULATION, where a query will usually be POPULATION >= 500000. For this kind of numeric field I would like to disable the distinct-value capability without disabling it for every other field as well.

Deutsche Ausdrücke optimieren (weniger technisch)

Vorschlag für weniger technische Ausdrücke im deutschen Sprachfile:

\nls\de\bundle.js

/*

  • Copyright (C) 2021 con terra GmbH ([email protected])
  • Licensed under the Apache License, Version 2.0 (the "License");
  • you may not use this file except in compliance with the License.
  • You may obtain a copy of the License at
  •     http://www.apache.org/licenses/LICENSE-2.0
    
  • Unless required by applicable law or agreed to in writing, software
  • distributed under the License is distributed on an "AS IS" BASIS,
  • WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  • See the License for the specific language governing permissions and
  • limitations under the License.
    */
    module.exports = {
    bundleName: "QueryBuilder",
    bundleDescription: "Das Bundle erm\u00f6glicht es benutzerdefinierte Abfragen zu erstellen",
    windowTitle: "Abfragen erstellen",
    editableWindowTitle: "Bearbeitbare Abfrage",
    tool: {
    title: "Eigene Abfrage erstellen",
    tooltip: "Erstellen Sie Ihre eigene Abfrage"
    },
    ui: {
    selectStore: "Was suchen?",
    spatialRelation: "Wo suchen?",
    linkOperator: "Wie verknüpfen?",
    sorting: "Sortierung",
    sortOptions: "Wie sortieren?",
    everywhere: "\u00fcberall",
    currentExtent: "Aktueller Kartenausschnitt",
    delete: "Löschen",
    search: "Suche starten",
    cancelSearch: "Suche abbrechen",
    searchParameter: "Suchparameter",
    negated: "negiert",
    typeInValue: "Wert eingeben",
    yes: "ja",
    no: "nein",
    and: "und",
    or: "oder",
    enterValue: "Wert eingeben",
    multipleSpatialInputs: "Mehrere Geometrien ausw\u00e4hlen",
    resetSpatialInput: "Ausgew\u00e4hlte Geometrie entfernen",
    negateSpatialInput: "Außerhalb der ausgew\u00e4hlten Geometrie suchen",
    tempStoreTitle: "Ergebnisse der vorherigen Suche",
    relationalOperators: {
    is: "ist gleich",
    exists: "ist vorhanden",
    eqw: "ist gleich (wildcard)",
    suggest: "\u00e4hnelt",
    contains: "enth\u00e4lt",
    contains_not: "enth\u00e4lt nicht",
    starts_with: "beginnt mit",
    ends_with: "endet mit",
    is_greater_than: "ist gr\u00f6\u00dfer",
    is_greater_or_equal: "ist gr\u00f6\u00dfer / gleich",
    is_less_than: "ist kleiner",
    is_less_or_equal: "ist kleiner / gleich",
    before: "vor",
    after: "nach",
    in: "ist in"
    },
    rules: {
    required: "Wert wird ben\u00f6tigt",
    number: "Wert muss vom Typ Nummer sein",
    string: "Wert muss vom Typ Text sein"
    },
    errors: {
    noResultsError: "Keine Ergebnisse f\u00fcr Ihre Abfrage gefunden!"
    },
    aria: {
    "add": "Neuen Ausdruck hinzufügen",
    "remove": "Aktuellen Ausdruck entfernen",
    "negate": "Aktuellen Ausdruck negieren",
    "selectLayer": "Layer auswählen",
    "sortingField": "Sortierfeldname auswählen",
    "linkOperatorsEnabled": "Verknüpfungsoperatoren sind aktiv.",
    "linkOperatorsDisabled": "Verknüpfungsoperatoren sind nicht aktiv."
    }
    }
    };

Result store appears in selection tool

Problem:
After a search is executed I open the map.apps selection-ui. The list contains a duplicate of the layer that I searched on previously.

image

Fix:
Remove "selection" in useIn: ["selection"] in the QueryController:
image

Is posible to perform a subquery using the QueryBuilder-Bundle 3.X?

We would like to use the query builder to perform a query against a FeatureService using the values retrieved from an auxiliary Table, where some values are stored. The auxiliary Table has a n:m relatioship with the Feature Service.
it would be something like that in SQL:
SELECT * FROM locationsFLC where LOCATION_ID ( SELECT LOCATION_ID FROM auxTable where DIVISION = X)

Question:
Is there a possibility to make it only through configuration?
If yes: Do you have any samples?
Thanks in advance!

Date query on Oracle-based AGS services crashes

When specifying a query using a date-field (type 'Date' in Oracle) on an Oracle-based AGS map service (AGS 10.3.1) the map server query crashes with the following error in AGS log:

Geodatabase error: Underlying DBMS error [ORA-01861: Literal stimmt nicht mit Formatzeichenfolge überein]

Editable tools cannot be opened

If you configure a tool whose query you want the user to be able to edit, no window is opened after the tool has been executed.

Add Base Config Widget

Extend the Query Builder config to make base settings adjustable.

Settings:

  • enable / disable distinct values
  • change the default comparative operator

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.