Difference between revisions of "Help:Queries"

From Mapping on MediaWiki
Jump to: navigation, search
(Created page with '{{User TOC}} Semantic Maps provides the ability to aggregate coordinate data stored semantically via the [http://semantic-mediawiki.org/wiki/Help:Introduction_to_Semantic_MediaW…')
 
Line 11: Line 11:
 
* [[Extension:Semantic Compound Queries|Semantic Compound Queries]]: Defines a parser function, #compound_query, that can make multiple Semantic MediaWiki queries at the same time.
 
* [[Extension:Semantic Compound Queries|Semantic Compound Queries]]: Defines a parser function, #compound_query, that can make multiple Semantic MediaWiki queries at the same time.
 
* [[Extension:Semantic_Drilldown|Semantic Drilldown]]: Provides a page for drilling down into the category-based and semantic data of a site, using easily-created filters.
 
* [[Extension:Semantic_Drilldown|Semantic Drilldown]]: Provides a page for drilling down into the category-based and semantic data of a site, using easily-created filters.
 +
 +
== Querying non-coordinate data ==
 +
[[File:Sm-qp-ge-marker-popup-properties.gif|thumb|400px|right|Semantic Maps displaying a Google Maps map with Google Earth map type and a marker with pop-up representing queried data.]]
 +
 +
Semantic Maps supports the display of queried non-coordinate data. All queried properties that are not coordinates will be displayed in a pop-up balloon that will appear when clicking the marker representing the location of their corresponding coordinates. If there is a page associated with one of the non-coordinate values, the value will be linked to it.
 +
 +
=== Templates ===
 +
 +
== Properties ==
 +
 +
This table contains all common map properties you can place in #ask queries.
 +
 +
{| class="wikitable sortable" style="margin: 1em auto 1em auto"
 +
! width=90px | Property || Usage || width=80px | Aliases || Default || width=90px | 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. || align="center" | - || align="center" | [[Extension:Maps#Default_mapping_service|configurable]] || align="center" | -
 +
|-
 +
| geoservice || Allows to set the geocoding service used to turn addresses into coordinates. || align="center" | - || align="center" | [[#Default_geocoding_service|configurable]] || align="center" | Added in 0.4.1 
 +
|-
 +
| width || Allows to set the width of the map, in pixels. || align="center" | - || align="center" | [[Extension:Maps#Default_map_width|configurable]] || align="center" | -
 +
|-
 +
| height ||Allows to set the height of the map, in pixels. || align="center" | - || align="center" | [[Extension:Maps#Default_map_height|configurable]] || align="center" | -
 +
|-
 +
| 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. || align="center" | - || align="center" | [[Extension:Maps#Default_map_zoom|configurable]] or auto-detect || align="center" | 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. || align="center" | center || align="center" | auto-detect || align="center" | Changed in 0.2
 +
|-
 +
| forceshow || Enables you to force a map to be shown even when there are no query results. || align="center" | force show || align="center" | off || align="center" | Added in 0.5.1
 +
|-
 +
| showtitle || Enables you to hide the title in the marker pop-ups. || align="center" | show title || align="center" | on || align="center" | Added in 0.5.2
 +
|-
 +
| template || Allows you to define the content and it's layout of marker pop-ups. The template will receive the queried property values as nameless parameters ({{{1}}}, {{{2}}}, ect), and 3 named parameters: {{{title}}}, {{{latitude}}} and {{{longitude}}}. || align="center" | - || align="center" | none || align="center" | Added in 0.5.2
 +
|-
 +
| icon || Allows you to set the icon used for all markers. || align="center" | - || align="center" | Default mapping service marker || align="center" | Added in 0.5.2
 +
|}
 +
 +
[[File:sm0.5.2-google-maps-template-popup.gif|thumb|400px|right|Semantic Maps showing queried data using a template for formatting.]]
 +
 +
This example demonstrates the use of properties and custom formatting using the template and showtitle parameters. ([http://wiki.bn2vs.com/Semantic_Maps#Basic_examples view demo's]):
 +
 +
<pre>{{#ask: [[Category:City]]
 +
| ?coordinates
 +
| ?population
 +
| ?area#km²
 +
| format=map
 +
| width=800
 +
| zoom=10
 +
| template=City Popup
 +
| showtitle=off
 +
| icon=Blue_marker.png
 +
}}
 +
</pre>

Revision as of 07:59, March 31, 2010

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.

Querying non-coordinate data

Semantic Maps displaying a Google Maps map with Google Earth map type and a marker with pop-up representing queried data.

Semantic Maps supports the display of queried non-coordinate data. All queried properties that are not coordinates will be displayed in a pop-up balloon that will appear when clicking the marker representing the location of their corresponding coordinates. If there is a page associated with one of the non-coordinate values, the value will be linked to it.

Templates

Properties

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 it's layout of marker pop-ups. The template will receive the queried property values as nameless parameters ({{{1}}}, {{{2}}}, ect), 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
Semantic Maps showing queried data using a template for formatting.

This example demonstrates the use of properties and custom formatting using the template and showtitle parameters. (view demo's):

{{#ask: [[Category:City]]
| ?coordinates
| ?population 
| ?area#km²
| format=map
| width=800
| zoom=10
| template=City Popup
| showtitle=off
| icon=Blue_marker.png
}}