Skip to content

Commit

Permalink
Add theming, custom WFS searches and API usage. Closes #1996 (#1985)
Browse files Browse the repository at this point in the history
  • Loading branch information
Gnafu authored and mbarto committed Jul 27, 2017
1 parent 008969b commit 6a5154e
Show file tree
Hide file tree
Showing 5 changed files with 73 additions and 1 deletion.
14 changes: 14 additions & 0 deletions docs/developer-guide/API-usage.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# MapStore2 API usage
You can include MapStore2 in your application and interact with it via its JavaScript API

## How to use

1. Create a map using the standard installation
1. Go to Share -> Embed
1. Copy the API html code and paste it in your application page

The map will now load inside your application

NOTE: If the map is using a Google Maps background you will have to provide your own API key.
Add `&key=YOUR_API_KEY` in the <script> src value

29 changes: 29 additions & 0 deletions docs/developer-guide/custom-search-service.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Custom search service
MapStore2 Searchbox uses [OpenStreetMap Nominatim](https://wiki.openstreetmap.org/wiki/Nominatim) service but you can set it up to use your own WFS service.
The results will be fetched from every service you set, plus OSM Nominatim, and displayed in the order you specified.

## How to use

We assume you already have a WFS service set up.
For example it can be on the same server you are using to display your data, so you can make the data easily searchable.

1. Open the Burger Menu (top right corner) and select "Settings"
1. In the Settings popup you should see a big button "Configure Search Settings", click it
1. You will see a list of services, click "Add"
1. Here you have to input the info on how the search will be performed
1. Input a name for the new service, it will not be displayed as it is for your own reference
1. Input the url to your WFS service. For example, if you are using GeoServer on the same host you can just omit the hostname: `/geoserver/wfs`
1. Input the layername where to search
1. Input a comma-separated list of attribute names where to search
1. Hit Next
1. Here you have to define how the results will be displayed
1. Input the title template, to show a feature property (must be a string) the syntax is `${properties.nameoftheproperty}`.
For example you can create complex templates like: `Woo, I found a ${properties.buildingname} with ${properties.animaltypes} in it!`, but you probably want to just have a simple string like `${properties.title}`
1. Input the description template, it will displayed underneath the title in a different font, the syntax is the same as the title
1. Input the priority of this service, the results from all the services will be ordered by the service priority. Higher priority results will be displayed on top of the list (Priority 5 is higher than priority 1)
1. In the next page there are some optional settings
- Order By: Input the feature attribute to order the results of this specific service
- Max Features: Input the maximum number of features to fetch when searching on this service
1. Save

Once saved, the service will be queried by the search box.
27 changes: 27 additions & 0 deletions docs/developer-guide/customize-theme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# How to Customize the Theme

The look and feel is completely customizable either using one of the included themes, or building your own. Themes are built using [less](http://lesscss.org/).
You can find the default theme here: https://github.com/geosolutions-it/MapStore2/tree/master/web/client/themes/default

In the [themes folder](https://github.com/geosolutions-it/MapStore2/tree/master/web/client/themes) you can also find other ones that you can study.

To add a new theme:
1. create a new folder in the themes folder with the name of your theme
1. create less files in the folder (at least `theme.less`, the main file, and `variables.less`, to customize standard variables)
1. add the new theme to the [index file](https://github.com/geosolutions-it/MapStore2/blob/master/web/client/themes/index.js), with the id corresponding to the theme folder name

You can then switch your application to use the theme adding a new section in the `appConfig.js` file:

```
initialState: {
defaultState: {
...
theme: {
selectedTheme: {
id: <your theme id>
}
},
...
}
}
```
2 changes: 2 additions & 0 deletions docs/developer-guide/developing-with-mapstore-2-intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ This section is about developing your own application using the MapStore2 framew

* [Introduction](developing-with-mapstore-2)
* [How to use a CDN](how-to-use-a-cdn)
* [How to add a custom search service](custom-search-service.md)
* [How to customize the Theme](customize-theme.md)

## Developing using plugins

Expand Down
2 changes: 1 addition & 1 deletion docs/developer-guide/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Deploy the generated mapstore.war file (in web/target) to your favourite J2EE co
# Developers documentation
* [Infrastructure](infrastructure-and-general-architecture)
* [Building and deploying](building-and-developing)
* [Developing with MapStore 2](developing-with-mapstore-2-intro)
* [Developing with MapStore2](developing-with-mapstore-2-intro)
* [Configuration](configuration-files)
* [Migration](mapstore-migration-guide)
* [How to Release](release-checklist)

0 comments on commit 6a5154e

Please sign in to comment.