Skip to content

Commit 061d366

Browse files
Ike HechtIke Hecht
Ike Hecht
authored and
Ike Hecht
committed
Add pages
1 parent f00b609 commit 061d366

11 files changed

+246
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
OpenStreetMap|https://www.openstreetmap.org/?mlat=$3&mlon=$4#map=16/$3/$4<noinclude>[[Category:Mediawiki-pages-Geolocation]]</noinclude>

Project/Geolocation.mediawiki

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
;Address only
2+
{{Geolocation
3+
|Full address=Something
4+
}}
5+
;Wrong geocoding
6+
{{Geolocation
7+
|Full address=Something
8+
|Geolocation link=coordinates
9+
}} ''&ndash; We want to suppress it''
10+
;Hidden link
11+
{{Geolocation
12+
|Full address=Something
13+
|Geolocation link=suppress
14+
}}
15+
;Display [[Mediawiki:Geolocation-message|system message]]
16+
{{Geolocation
17+
|Full address=A Guarda, 26780, Spain
18+
|Geolocation link=message
19+
}}
20+
;Display coordinates
21+
{{Geolocation
22+
|Full address=A Guarda, 26780, Spain
23+
|Geolocation link=coordinates
24+
}}
25+
;Display coordinates (geocoding failed)
26+
{{Geolocation
27+
|Full address=Something strange
28+
|Geolocation link=coordinates
29+
}} ''&ndash; Choose "suppress" to hide the error message''
30+
[[Category:Mediawiki-pages-Geolocation]]

Property/Coordinates.mediawiki

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
This is a property of type [[Has type::Geographic coordinates]]. It provides the [[Provides service::online maps]] service.
2+
3+
[[Category:Mediawiki-pages-Geolocation]]

Property/Full address.mediawiki

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
This is a property of type [[Has type::Text]].
2+
3+
4+
[[Category:Mediawiki-pages-Geolocation]]

Property/Geolocation link.mediawiki

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
This is a property of type [[Has type::Text]].
2+
3+
The allowed values for this property are:
4+
* [[Allows value::coordinates]]
5+
* [[Allows value::message]]
6+
* [[Allows value::suppress]]
7+
8+
[[Category:Mediawiki-pages-Geolocation]]

Property/Latitude.mediawiki

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
This is a property of type [[Has type::Text]].
2+
3+
[[Category:Mediawiki-pages-Geolocation]]

Property/Longitude.mediawiki

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
This is a property of type [[Has type::Text]].
2+
3+
[[Category:Mediawiki-pages-Geolocation]]

README.md

+53-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,53 @@
1-
# mediawiki-pages-Geolocation
1+
# Geolocation package
2+
3+
Provides a collection of wiki pages for easy inclusion of Geolocation fields and semantics in Mediawiki projects.
4+
5+
# Requirements
6+
* SemanticMediaWiki
7+
* PageForms
8+
* Maps
9+
* ParserFunctions (with `$wgPFEnableStringFunctions = true;`)
10+
* PageExchange or PagePort
11+
12+
# Setup
13+
14+
## via PagePort
15+
16+
* download the repository
17+
* run `php extensions/PagePort/maintenance/importPages.php --source ~/mediawiki-pages-Geolocation`
18+
19+
## via PageExchange
20+
21+
* add the following to the bottom of your `LocalSettings.php`: `$wgPageExchangePackageFiles[] = 'https://raw.githubusercontent.com/NationalGalleryOfArt/mediawiki-pages-Geolocation/main/page-exchange.json';`
22+
* navigate to `Special:Packages` and install the package
23+
* (optional) from the wiki root, run `php maintenance/runJobs.php`
24+
25+
# Usage
26+
27+
## Transclude into the form
28+
29+
Transclude the [Geolocation fields set](https://github.com/NationalGalleryOfArt/mediawiki-pages-Geolocation/blob/main/Template/Geolocation%20field%20set.mediawiki) into your form once:
30+
```
31+
{{Geolocation fields set}}
32+
```
33+
Note, the field set is intended to be included as rows into an existing table with the other form field annotations. If you do not use a table layout in your form, wrap the template call:
34+
```
35+
{| class="formtable"
36+
{{Geolocation fields set}}
37+
|}
38+
```
39+
To use `feeds to map` feature, add the host template name as a parameter. For example if the template we call the geolocation field set from is called `Person`, put:
40+
```
41+
{{Geolocation fields set|Person}}
42+
```
43+
44+
## Features
45+
46+
* Full address string
47+
* Coordinates calculation based on the full address
48+
* Map input for setting coordinates manually
49+
* Printout settings (coordinates|message|suppress)
50+
51+
See examples at [Project:Geolocation](https://github.com/NationalGalleryOfArt/mediawiki-pages-Geolocation/blob/main/Project/Geolocation.mediawiki)
52+
53+
+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<includeonly>{{#ifeq: {{{Full address|}}}|hide||
2+
<tr>
3+
<td> '''Full address:''' </td>
4+
<td> {{{field{{!}}Full address{{!}}input type=text{{!}}feeds to map={{{1|}}}[Coordinates]}}} </td>
5+
</tr>
6+
}}
7+
<tr id="geolocation-coordinates">
8+
<td></td>
9+
<td>{{{field{{!}}Coordinates{{!}}input type=leaflet}}}</td>
10+
</tr>
11+
<tr style="vertical-align:top">
12+
<td> '''Display coordinates:''' </td>
13+
<td> {{{field{{!}}Geolocation link{{!}}property=Geolocation link{{!}}input type=dropdown{{!}}default=message{{!}}show on select=coordinates=>geolocation-coordinates;coordinates=>geolocation-coordinates-info;message=>geolocation-coordinates;message=>geolocation-message;suppress=>geolocation-suppress{{!}}mandatory}}}
14+
<div id="geolocation-suppress" style="display:inline">''Do not use coordinates.''</div>
15+
<div id="geolocation-message" style="display:inline">''"View map" link will be shown.''</div>
16+
<div id="geolocation-coordinates-info" style="display:inline">''A link with coordinates will be shown.''</div></td>
17+
</tr></includeonly><noinclude>[[Category:Mediawiki-pages-Geolocation]]
18+
;Usage
19+
Designed to be used inside the other template section of PageForms form.
20+
<pre>
21+
{{Geolocation field set
22+
|Person # (optional) Name of the template hosting the Coordinates field
23+
|Full address = hide # (optional) 'hide' will suppress the Full address field in the form
24+
}}
25+
</pre>
26+
</noinclude>

Template/Geolocation.mediawiki

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<includeonly>{{#if:{{{Full address|}}}|{{#switch:{{{1|}}}|inline=&#32;&middot;&#32;|#default=}}{{{Full address|}}}{{#set: Full address={{{Full address|}}} }}}}<!--
2+
3+
-->{{#switch: {{{Geolocation link|}}}|
4+
|suppress = <!-- Nothing to do -->
5+
|#default = <!-- New line if address is set, unless the "inline" or "plain" switches are on
6+
-->{{#switch:{{{1|}}}|inline=&#32;&middot;&#32;|plain=|#default=<br>}}<!-- Geo data and link rendering
7+
-->{{#if: {{{Coordinates|}}}
8+
|<!-- Coordinates have priority
9+
-->{{#set:
10+
|Latitude={{#explode:{{{Coordinates|}}}|,|0}}
11+
|Longitude={{#explode:{{{Coordinates|}}}|,|1}}
12+
|Coordinates={{{Coordinates|}}}
13+
}}<!--
14+
-->[https://www.openstreetmap.org/?mlat={{#explode:{{{Coordinates|}}}|,|0}}&mlon={{#explode:{{{Coordinates|}}}| |1}}#map=16/{{#explode:{{{Coordinates}}}|,|0}}/{{#explode:{{{Coordinates|}}}| |1}} <!--
15+
-->{{#switch: {{{Geolocation link|}}}
16+
|message=<span class="geolocation-link">View map</span>
17+
|coordinates=<span class="geolocation-link">{{#coordinates:{{{Coordinates|}}}|format=dms|directional=yes}}</span>
18+
}}]
19+
|<!-- Trying geocoding
20+
-->{{#ifeq: {{#sub:{{#geocode:{{{Full address|}}}}}|0|3}}
21+
|Geo
22+
|<!-- Geocoding failure --><span class="geolocation-link geolocation-link-failed">Geocoding failed</span>
23+
|<!-- Geocoding success
24+
-->{{#set:
25+
|Latitude={{#explode:{{#geocode:{{{Full address|}}}}}|,|0}}
26+
|Longitude={{#explode:{{#geocode:{{{Full address|}}}}}|,|1}}
27+
|Coordinates={{#geocode:{{{Full address|}}} }}
28+
}}<!--
29+
-->[https://www.openstreetmap.org/?mlat={{#explode:{{#geocode:location={{{Full address|}}}|format=float|directional=no}}|,|0}}&mlon={{#explode:{{#geocode:location={{{Full address|}}}|format=float|directional=no}}| |1}}#map=16/{{#explode:{{#geocode:location={{{Full address|}}}|format=float|directional=no}}|,|0}}/{{#explode:{{#geocode:location={{{Full address|}}}|format=float|directional=no}}| |1}} <!-- -->{{#switch: {{{Geolocation link|}}}
30+
|message=<span class="geolocation-link">View map</span>
31+
|coordinates=<span class="geolocation-link">{{#geocode:{{{Full address|}}} }}</span>
32+
}}]
33+
}}
34+
}}
35+
}}</includeonly><noinclude>[[Category:Mediawiki-pages-Geolocation]]
36+
;Usage
37+
<pre>
38+
{{Geolocation
39+
|Full address = #
40+
|Coordinates = #
41+
|Geolocation link = # message | coordinates | suppress *
42+
|inline # inline | plain | <empty> **
43+
}}
44+
45+
----
46+
* message will show View map, coordinates fill show coordinates, suppress will fully disable geolocation (coordinates and the output)
47+
** if empty, will put the map link on the new line; plain does nothing; inline puts a middot before the link
48+
</pre>
49+
</noinclude>

page-exchange.json

+66
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
{
2+
"publisher": "Ike Hecht",
3+
"author": "Ike Hecht",
4+
"language": "en",
5+
"url": "https://github.com/NationalGalleryOfArt/mediawiki-pages-Geolocation",
6+
"packages": {
7+
"Geolocation": {
8+
"globalID": "Geolocation",
9+
"description": "A collection of wiki pages for easy inclusion of the Geolocation semantics in Mediawiki projects.",
10+
"version": "0.1",
11+
"pages": [
12+
{
13+
"name": "Smw service online maps",
14+
"namespace": "NS_MEDIAWIKI",
15+
"url": "https:\/\/raw.githubusercontent.com\/NationalGalleryOfArt\/mediawiki-pages-Geolocation\/main\/MediaWiki%2FSmw%20service%20online%20maps.mediawiki"
16+
},
17+
{
18+
"name": "Geolocation",
19+
"namespace": "NS_PROJECT",
20+
"url": "https:\/\/raw.githubusercontent.com\/NationalGalleryOfArt\/mediawiki-pages-Geolocation\/main\/Project%2FGeolocation.mediawiki"
21+
},
22+
{
23+
"name": "Coordinates",
24+
"namespace": "SMW_NS_PROPERTY",
25+
"url": "https:\/\/raw.githubusercontent.com\/NationalGalleryOfArt\/mediawiki-pages-Geolocation\/main\/Property%2FCoordinates.mediawiki"
26+
},
27+
{
28+
"name": "Full address",
29+
"namespace": "SMW_NS_PROPERTY",
30+
"url": "https:\/\/raw.githubusercontent.com\/NationalGalleryOfArt\/mediawiki-pages-Geolocation\/main\/Property%2FFull%20address.mediawiki"
31+
},
32+
{
33+
"name": "Geolocation link",
34+
"namespace": "SMW_NS_PROPERTY",
35+
"url": "https:\/\/raw.githubusercontent.com\/NationalGalleryOfArt\/mediawiki-pages-Geolocation\/main\/Property%2FGeolocation%20link.mediawiki"
36+
},
37+
{
38+
"name": "Latitude",
39+
"namespace": "SMW_NS_PROPERTY",
40+
"url": "https:\/\/raw.githubusercontent.com\/NationalGalleryOfArt\/mediawiki-pages-Geolocation\/main\/Property%2FLatitude.mediawiki"
41+
},
42+
{
43+
"name": "Longitude",
44+
"namespace": "SMW_NS_PROPERTY",
45+
"url": "https:\/\/raw.githubusercontent.com\/NationalGalleryOfArt\/mediawiki-pages-Geolocation\/main\/Property%2FLongitude.mediawiki"
46+
},
47+
{
48+
"name": "Geolocation",
49+
"namespace": "NS_TEMPLATE",
50+
"url": "https:\/\/raw.githubusercontent.com\/NationalGalleryOfArt\/mediawiki-pages-Geolocation\/main\/Template%2FGeolocation.mediawiki"
51+
},
52+
{
53+
"name": "Geolocation field set",
54+
"namespace": "NS_TEMPLATE",
55+
"url": "https:\/\/raw.githubusercontent.com\/NationalGalleryOfArt\/mediawiki-pages-Geolocation\/main\/Template%2FGeolocation%20field%20set.mediawiki"
56+
}
57+
],
58+
"requiredExtensions": [
59+
"PageForms",
60+
"ParserFunctions",
61+
"SemanticMediaWiki",
62+
"Maps"
63+
]
64+
}
65+
}
66+
}

0 commit comments

Comments
 (0)