Giter Club home page Giter Club logo

bcgov / smk Goto Github PK

View Code? Open in Web Editor NEW
16.0 16.0 8.0 18.57 MB

Simple Map Kit is an open source software package that supports the rapid development of maps using leafletJS and various data sources and services. For the companion SMK Editor, please see the repository https://github.com/bcgov/smk-cli.

Home Page: https://bcgov.github.io/smk/

License: Apache License 2.0

JavaScript 71.94% HTML 16.93% CSS 10.79% Shell 0.26% Scheme 0.08%
smk mapping mapping-tools citz databc smk-cli map-kit nodejs opensource

smk's Introduction

Simple Map Kit

img

A versatile and lightweight toolkit for building a simple web map.

SMK is designed to make it easy to integrate a map into a web application.

The application needs to include one <script> tag to load the library, define a single <div> tag to contain the map, and call one method to initialize the map. There is no other code for the application to write, the map functionality is defined completely by a JSON configuration structure.

Here is an example of a complete HTML page that uses SMK to show a map:

<!DOCTYPE html>
<html>
    <head>
        <title>SMK Demo</title>
        <script src="smk.js"></script>
        <style>
            #smk-map-frame {
                position: absolute;
                top: 0; left: 0; right: 0; bottom: 0; margin: 0; padding: 0;
            }
        </style>
    </head>
    <body>
        <div id="smk-map-frame"></div>
        <script>
            SMK.INIT( { containerSel: '#smk-map-frame' } )
        </script>
    </body>
</html>

Creating the configuration by hand is possible, but an easier way to create a simple SMK application is to use the command-line development tool SMK CLI. This tool lets you initialize a new SMK map application project by answering a few questions. It also gives you an interactive web-based UI to do more detailed configuration of your map.

To see some samples of SMK in action, you can look at the debug folder.

License

Copyright 2024 Province of British Columbia

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.

smk's People

Contributors

bk01 avatar darv72 avatar dependabot[bot] avatar dgboss avatar michaelpnelson avatar nicoledegreef avatar qqnluaq avatar repo-mountie[bot] avatar rustyjux avatar

Stargazers

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

Watchers

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

smk's Issues

upgrade calls to the geocoder web service

The BC Physical Address Geocoder Web Service has evolved since it was first implemented in SMK. Please upgrade to the latest API calls in order to take advantage of enhanced functionality.

WMS and WFS should be completely different input types..

When you click on a WMS to (point or polygon) identify, why do WFS GetFeature? .. and not WMS Getfeatureinfo? I can understand WFS if it is for a ‘selected set' but this should be explicitly different than using a WMS service..

(not all WMS have equivalent WFS, and this will eliminate basic query access of a WMS service (that doesn't offer WFS at the same URL). WFS and WMS should be completely different input types in SMK.

Responsive Design - Breakpoints Configuration

Looking for an author to be able to specify break points of resolution to support responsive design on tablets / phones. Would need to determine what elements of an existing UI would hide and/or morph.

Priority pending completion of MVP.

Add JSON stream as an input for applications

Extra black legend icon for points

Uploaded a KML file that had 2 styles. It was uploaded and parsed correctly, and added to an app. If you view the legend, you see a proceeding black box before the icon is displayed.

It's the classic BC Parks KML file used elsewhere in testing.

query tool on mobile

The query tool has usability issues in the mobile version. These also exist in the desktop version, but not as pronounced.

With only 2 or 3 parameters, the panel is too long to be able to show the results below the parameters.
See bcgov/smk-legacy-ui#45

vivid-w100z vividsolutions com_8443_example_mobile__config config_fish-points json show-tool all device desktop config config_victoria json config config_fish-points-query json iphone 6_7_8

SMK Config Utility (CLI) enhancement

Research item: is there an alternative way to deploy a couchDB in Openshift or are there alternatives to using couchDB (other persistent databases ) in OpenShift or pushing site configs to Git repos (one git repo per SMK site)?

Add method to explicitly create a new SMK instance

SMK has only one method for instatiating a new instance, which is including smk.js in a <script> element.
It has become apparent that this isn't ideal when trying to embed SMK in applications that use a framework like Angular.
For this reason another way to initialize an SMK instance is needed.
This is proposed method:

<html>
<body>
<div id="map"></div>
</body
<script src="smk.js">
<script>
  SMK.INIT( {
     // parameters the same as passed to <script> element as attrs
     'smk-container-sel': "#map",
     'smk-config': [ // actual list
       "./map-config.json", 
       "./layer-config.json", 
       "./layer-display-config.json" 
     ] 
  } ).then( function ( smk ) {
     // promise resolves when map is created, and all visible layers are finished loading
  } )
</script>
</html>

enable legend symbols on by default

Currently when you view a layer list in an SMK map there is a toggle for showing the symbology. Francophone Affairs would like their symbols turned on by default so we should enable this.

Reticulating splines...

Remove reference to "Reticulating Splines..." at start up. This is a programming insider's joke but not relevant to the map using public to which SMK is currently targeted.

@cpspicer - Suggestions for replacement:

"Map Starting..."
"Loading..."
"Please Wait..."

SMK/Geoserver query result difference from IMF2/MPCM

Something I’ve noticed during testing while looking at a query for schools that offer early French immersion.

bcFrancophonieMap gets 251 results
https://francophone-qa.apps.gov.bc.ca/bcFrancophonieMap/?query=schools-k-12,and,EARLY_FRENCH_IMMERSION_OFFERED=%22YES%22

Schools layer is sourced from: https://openmaps.gov.bc.ca/geo/pub/WHSE_IMAGERY_AND_BASE_MAPS.GSR_SCHOOLS_K_TO_12_SVW/ows?service=WMS&request=GetMap&version=1.1.1&layers=pub%3AWHSE_IMAGERY_AND_BASE_MAPS.GSR_SCHOOLS_K_TO_12_SVW&styles=7970&format=application/json;type=geojson&transparent=true&cql_filter=include&srs=EPSG%3A4326&width=645&height=728&bbox=-131.8579103,46.6645175,-117.6855469,56.547372

Whereas iMapBC gets 259 results
https://maps.gov.bc.ca/ess/hm/imap4m/?catalogLayers=7970&attributeSearch=7970,EARLY_FRENCH_IMMERSION_OFFERED,YES

Schools layer is sourced from: http://apps.gov.bc.ca/pub/mpcm/services/catalog/PROD/7970

Looking at BCGWPRD:

select count(*)
from WHSE_IMAGERY_AND_BASE_MAPS.GSR_SCHOOLS_K_TO_12_SVW
where
EARLY_FRENCH_IMMERSION_OFFERED = 'YES'
Count=259

select distinct early_french_immersion_offered
from
WHSE_IMAGERY_AND_BASE_MAPS.GSR_SCHOOLS_K_TO_12_SVW

YES
NO

There are no case differences in the database. I cannot explain this difference. Needs investigation.

cascading queries specification

Request from business area.

Currently, a query defined on a layer is not cascading. It would be nice to have the option to confiure a cascading query.

Example: a dataset contains the following attributes: HEALTH_AUTHORITY, CITY, BUSINESS NAME

In a cascading (top-down) search, a user chooses Vancouver Coastal as the Health Authority then under City users should only see distinct CITY values where HEALTH_AUTHORITY = 'Vancouver Coastal'. Victoria, for example, would not be among the CITY choices in such a case.

image.png

"vector" data doco enhancement

beta5/v1.0

Can we note somewhere that "vector" data sourced from Geoserver will be limited to 500 features if referencing via WFS? When attempting to reference BCGov Geoserver based data with >500 features, the WMS to application/json workaround can be used. We encountered this will schools data in the francophone app.

"identify" tool properties not documented

beta5

example config from a site:

    {
        "order": 5,
        "position": "list-menu",
        "icon": "perm_device_info",
        "title": "Find Nearby Services",
        "command": {
            "select": false,
            "radius": false,
            "radiusUnit": false,
            "nearBy": true,
            _"attributeMode": false_
        },
        "radius": "1",
        "radiusUnit": "km",
        "type": "identify",
        "enabled": true,
        "showPanel": true,
        "showWidget": true,
        _style": {
            "strokeWidth": 1,
            "strokeStyle": "1, 1",
            "strokeColor": "#000000",
            "strokeOpacity": 0.8,
            "fillColor": "#000000",
            "fillOpacity": 0.5,
            "markerSize": [
                20,
                20
            ],
            "markerOffset": [
                10,
                0
            ]
        },_
        "showTitle": true
    },

Doc link: https://bcgov.github.io/smk/docs/configuration/tools/identify

-->no reference to "style" property and sub-properties found.
-->should "attributeView" in the docs be "attributeMode"?

Add missing topics

TL;DR

Topics greatly improve the discoverability of repos; please add the short code from the table below to the topics of your repo so that ministries can use GitHub's search to find out what repos belong to them and other visitors can find useful content (and reuse it!).

Why Topic

In short order we'll add our 800th repo. This large number clearly demonstrates the success of using GitHub and our Open Source initiative. This huge success means its critical that we work to make our content as discoverable as possible; Through discoverability, we promote code reuse across a large decentralized organization like the Government of British Columbia as well as allow ministries to find the repos they own.

What to do

Below is a table of abbreviation a.k.a short codes for each ministry; they're the ones used in all @gov.bc.ca email addresses. Please add the short codes of the ministry or organization that "owns" this repo as a topic.

add a topic

That's in, you're done!!!

How to use

Once topics are added, you can use them in GitHub's search. For example, enter something like org:bcgov topic:citz to find all the repos that belong to Citizens' Services. You can refine this search by adding key words specific to a subject you're interested in. To learn more about searching through repos check out GitHub's doc on searching.

Pro Tip 🤓

  • If your org is not in the list below, or the table contains errors, please create an issue here.

  • While you're doing this, add additional topics that would help someone searching for "something". These can be the language used javascript or R; something like opendata or data for data only repos; or any other key words that are useful.

  • Add a meaningful description to your repo. This is hugely valuable to people looking through our repositories.

  • If your application is live, add the production URL.

Ministry Short Codes

Short Code Organization Name
AEST Advanced Education, Skills & Training
AGRI Agriculture
ALC Agriculture Land Commission
AG Attorney General
MCF Children & Family Development
CITZ Citizens' Services
DBC Destination BC
EMBC Emergency Management BC
EAO Environmental Assessment Office
EDUC Education
EMPR Energy, Mines & Petroleum Resources
ENV Environment & Climate Change Strategy
FIN Finance
FLNR Forests, Lands, Natural Resource Operations & Rural Development
HLTH Health
FLNR Indigenous Relations & Reconciliation
JEDC Jobs, Economic Development & Competitiveness
LBR Labour Policy & Legislation
LDB BC Liquor Distribution Branch
MMHA Mental Health & Addictions
MAH Municipal Affairs & Housing
BCPC Pension Corporation
PSA Public Safety & Solicitor General & Emergency B.C.
SDPR Social Development & Poverty Reduction
TCA Tourism, Arts & Culture
TRAN Transportation & Infrastructure

NOTE See an error or omission? Please create an issue here to get it remedied.

Route planner API uses an application token

The directions tool uses the BC route planner service API. This API requires users have an application key. SMK is using an API key provided by Micheal Ross. This key should not be distributed with exported projects. It is only for testing purposes for projects run from the admin UI.

The key is hardcoded in SMK right now. It should be parameterized, and made into a config property for the directions tool.

SMK in IE 11 and lower

Looks like an IE issue, how much QA has SMK had for IE?

SCRIPT5009: 'Promise' is undefined
smk.js (1997,5)

I don’t know what Promise is.. but IE doesn’t like it (in smk.js):

  if ( Promise.prototype.finally )
        util.promiseFinally = function ( promise, onFinally ) {
            return promise.finally( onFinally )

From: de Greef, Nicole JTT:EX
Sent: Tuesday, August 28, 2018 12:41 PM
To: Lou, Leo JTT:EX [email protected]
Cc: Douville, Michelle R JTT:EX [email protected]
Subject: business area unable to review http://moh-qa.apps.gov.bc.ca/alrc?theme=alpha

Help - They said they are getting a blank page? I can see it from my computer and from my phone. Any ideas?

Find Nearby widget

Allow users to specify a point on the map and a radius in order to find nearby features.

query URL parameters should run query instead of prompting for "Search"

When a complete & valid query is supplied via URL the query should be run right off the bat, not prompt the user to click Search. This is how IMF2 and DMF handled similar requests.

e.g. see difference between SMK implementation and IMF2 implementation:
https://francophone-qa.apps.gov.bc.ca/bcFrancophonieMap/?query=schools-k-12,and,EARLY_FRENCH_IMMERSION_OFFERED=%22YES%22

https://maps.gov.bc.ca/ess/hm/imap4m/?catalogLayers=7970&attributeSearch=7970,EARLY_FRENCH_IMMERSION_OFFERED,YES

When a request is made, auto-run the search and display the results in the list, as such:

image

Not intermediate step as currently required (illustrated below):
image

Larger Icons are being truncated on true mobile devices

How to reproduce

  • SMK version I'm using: 0.8.0

  • Browser (with version) I'm using: Safari

  • OS/Platform (with version) I'm using: iOS 12

  • On a mobile device (I use an iPhone 7) visit: http://moh.apps.gov.bc.ca/alrc/?

What behaviour I'm expecting and which behaviour I'm seeing

I'm expecting to see the full icons but I see the full size of icon as a box with only a portion of the icons I expect to see.

Expected look of icons:
image.png

Actual look of icons:
image.png

Might be ALRC specific; alrc is built on 0.8.0 and the size of the icons is controlled via the alpha.css theme.

.smk-theme-alpha .material-icons {
color: #234075;
font-size: 42px;
}

The issue is not apparent when previewing at various sizes in Google Chrome's Developer Tools, on a kindle fire (android), or on a samsung tablet so it seems to be limited to iOS 12/Safari.

Directions doco issue

beta5

https://bcgov.github.io/smk/docs/configuration/tools/directions

"This is default configuration for the Layers tool (click on a property name for more information):"

should be:

"This is default configuration for the Directions tool (click on a property name for more information):"

It would also be good to state that in order for routes to be supplied, the developer needs to obtain an API key from DataBC and include that in the configuration for "directions" tool.

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.