Help:Queries

From Mapping on MediaWiki
Jump to: navigation, search

User manual

Introduction

Coordinates

Geocoding

Displaying maps

Displaying markers

Customizing markers

Mapping services

Semantic mapping

Coordinates data-type

Querying coordinate data

Distance query

Maps in forms

Admin manual

Semantic Maps provides the ability to aggregate coordinate data stored semantically via the Semantic MediaWiki extension by adding 'result formats' to it. This means that you are able to specify the mapping service you want to use with a parameter in an #ask query. If you do not know how #ask queries work, please read the manual. If you have any problems with your #ask queries in Semantic Maps, please try using the 'table' format instead of a mapping service to see which results are actually returned by your query.

One of the properties queried and displayed must be of type 'Geographic coordinate' for this query to work; this property is what will determine the location of each point on the map. Clicking on each point will display a label holding the name of the page, along with any other queried information; clicking on the page name will bring the user to that page.

You can find a list of all map properties you can set in #ask queries in the ask queries sub in the map properties section. You can find a list of all mapping services you can use with queries in the map services section.

The result formats provided by Semantic Maps can also be used in some extensions that extend Semantic MediaWiki's querying capabilities. The following list includes a few of them, but not all.

  • Semantic Compound Queries: Defines a parser function, #compound_query, that can make multiple Semantic MediaWiki queries at the same time.
  • Semantic Drilldown: Provides a page for drilling down into the category-based and semantic data of a site, using easily-created filters.

You're the one with the bairns here. I'm watching for your posts.

Properties

You can add seven additional parameters to the definition of #ask queries and form inputs, to change the appearance and usage of the resulting map.

To make it really easy for you, Semantic Maps uses the same names as Maps (see Map's map properties) where possible. There are however some differences. The sections below list all properties you can use for the feature discussed in them.

This table contains all common map properties you can place in #ask queries.

Property Usage Aliases Default Version
format Allows to set the mapping service that will be used to generate the map. Do not use a 'service=' parameter for this, like in Maps. - configurable -
geoservice Allows to set the geocoding service used to turn addresses into coordinates. - configurable Added in 0.4.1
width Allows to set the width of the map, in pixels. - configurable -
height Allows to set the height of the map, in pixels. - configurable -
zoom Allows to set the zoom level of the map. When not provided and multiple markers are present on the map, the best fitting zoom will be taken, not the configurable default. - configurable or auto-detect Changed in 0.2
centre Allows to set the coordinates of the map's centre. When this parameter is not provided, the map will centre itself on the provided markers. center auto-detect Changed in 0.2
forceshow Enables you to force a map to be shown even when there are no query results. force show off Added in 0.5.1
showtitle Enables you to hide the title in the marker pop-ups. show title on Added in 0.5.2
template Allows you to define the content and its layout of marker pop-ups. The template will receive the queried property values as nameless parameters ({{{1}}}, {{{2}}}, etc.), and 3 named parameters: {{{title}}}, {{{latitude}}} and {{{longitude}}}. - none Added in 0.5.2
icon Allows you to set the icon used for all markers. - Default mapping service marker Added in 0.5.2

Mapping services

The following mapping services can be used as format in queries:


Examples

For the sake of performance and readability, only one basic example has been included here. On the Semantic Maps examples page, you can find dozens of queries demonstrating different aspects of the extension.

Custom formatting of the queried properties using the template and showtitle parameters. See used template.

{{#ask: [[Category:Locations]]
| ?Has coordinates
| ?Has location type 
| ?Located in
| format=map
| template=Location Popup
| showtitle=off
| icon=Blue_marker.png
}}

See also