Help:Distance query

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 allows you to filter results in a Semantic MediaWiki query not only on a single point, but also in an area. At the moment, you can only define an area as a point, and a distance from this point, which will be used to create a bounding box. This however should suffice for most usecases.

This functionality used to be part of SMW itself, but has been removed in SMW 1.5. It has been re-introduced in Semantic Maps 0.6. The syntax for the query has changed between these versions! The ~ is no longer supported for geographical coordinates - used the syntax described on this page instead.

Contents

Syntax

This is the syntax for the filter you can put in semantic queries; it needs to be placed in a query and won't work on it's own.

[[Semantic Property::coordinate set (number unit)]]

Supported units

See the distances help page for a list of supported units.

Examples

Just the filter

All items with the property Has coordinates and a value for it that is within a hundred miles of London.

[[Has coordinates::51° 30' 5" N, 1° 51' 2" W (100 miles)]]

All items with the property Has coordinates and a value for it that is within 42 kilometres of New York City.

[[Has coordinates::40.7142691 N, 74.0059729 W (42 km)]]

Identical to the one above.

[[Has coordinates::40.7142691 N, 74.0059729 W (42000)]]

Complete query

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.

Query for all cities within a 420 km radius of Brussels:
Note: This query originally using the Distance Popup template, but a bug has been identified in MW1.17 which causes issues with queries using the template= parameter.

{{#ask: [[Category:Locations]] [[Has location type::City]] [[Has coordinates::50° 50' 48" N, 4° 21' 10" E  (420 km)]]
| ?Has coordinates
| ?Located in
| format=map
| template=Distance Popup
}}
Loading map...

See also

Personal tools
Namespaces
Variants
Actions
Navigation
Manuals
Useful lists
More awesomeness
Toolbox