Extension:Semantic Maps

From MediaWiki.org

Jump to: navigation, search

           

Manual on MediaWiki Extensions
List of MediaWiki Extensions
Crystal Clear action run.png
Semantic Maps

Release status: beta

SemanticMaps.png
Description Allows users to edit and display semantic coordinate data using multiple mapping services.
Author(s)  Jeroen De Dauw, Yaron Koren, Robert Buzink and Matt Williamson
Last Version  0.4.2 (2009-11-15)
MediaWiki  1.9.* or greater
License GPL
Download SemanticMaps0.4.2.zip

check usage (experimental)

Contents

[edit] Description

Semantic Maps is an extension that adds semantic capabilities to the Maps extension, and therefore provides the ability to add, view and edit coordinate data stored through the Semantic MediaWiki extension.

Due to it's unique structure, it allows you to use multiple mapping services to display your coordinates. These include Google Maps, Yahoo! Maps, OpenLayers, and also allow you to display maps with Google Earth, OpenStreetMaps, Bing maps and others. Modifying the mapping service of a map is as easy as changing a single parameter! Examples of how to use Semantic Maps can be found here.

Both Semantic Maps and Maps are based on Semantic Google Maps and Semantic Layers, and are meant to replace these extensions.

Having Semantic MediaWiki and Maps installed is a prerequisite for the Semantic Maps extension; the code will not work without it.

[edit] Functionality overview

Semantic Maps displaying the result of a compound query with Google Maps.

Semantic Maps and Map provide a map interface to the Semantic MediaWiki Geographic coordinate property type, through the following features:

  1. Display of coordinates. See the usage of Maps for more info.
  2. Aggregation of coordinates. Each mapping service has it's own special output format, that can be used in Semantic MediaWiki queries, allowing a set of coordinate data stored on multiple pages to be displayed together on a single map.
  3. Insertion of coordinates. Semantic Maps provides custom Semantic Forms input types. These input types display a map with a geocoder in a form to make the insertion (and editing) of coordinates easy for users.

[edit] Download and installation

[edit] Download

You can find older versions in the legacy downloads section of the version history page.

Notice: Semantic Maps and Maps are always released together. This means you should always use the same version of Maps as the one of Semantic Maps you have. For example Maps 0.3.4 and Semantic Maps 0.3.4, but not Maps 0.2 and Semantic Maps 0.3.

You can also download the code directly via SVN from the MediaWiki source code repository, at http://svn.wikimedia.org/svnroot/mediawiki/tags/extensions/SemanticMaps/REL_0_4_2. From a command line, you can call the following:

svn checkout http://svn.wikimedia.org/svnroot/mediawiki/tags/extensions/SemanticMaps/REL_0_4_2

[edit] Package downloads

Maps and Semantic Maps

Semantic Bundle

[edit] Installation instructions

Make sure you have Semantic MediaWiki and Maps successfully installed before proceeding with the installation. Once you have downloaded the code, place the 'SemanticMaps' directory within your MediaWiki 'extensions' directory. Then add the following code to your LocalSettings.php file after the lines that install Maps:

require_once( "$IP/extensions/SemanticMaps/SemanticMaps.php" );

The inclusion of extensions should happen in this order: Semantic MediaWiki, Semantic Forms (if you use it), Semantic Maps. Note, again, that Maps should also precede Semantic Maps. See the installation instructions of Maps for info about the API keys.

Once you have successfully installed Semantic Maps, please add your wiki to the sites that use Semantic Maps section.

[edit] Upgrading from Semantic Google Maps

If you have Semantic Google Maps installed, and want to upgrade to Semantic Maps, these are the steps you need to follow:

  • Remove the SemanticGoogleMaps directory from your extension directory.
  • Remove (when you use it) Google Geocoder in a similar fashion.
  • Upload both Maps and Semantic Maps to your extension directory.
  • Make sure your API keys are in the right place (the variable $wgGoogleMapsKey will need to be renamed, or copied, to $egGoogleMapsKey).
  • Change all #semantic_google_map parser functions with #display_point.
  • Add parameter names to the value of the #display_point calls.

After doing all these steps, you should be done. Maps and Semantic Maps are designed to be backward compatible with SGM, so all SGM code should work on Semantic Maps. If you encounter some problem though, please let the extension developers know.

[edit] Version

Semantic Maps is currently at version 0.4.2. It is still considered beta, since some small issues might be present. However, it has been tested quite thoroughly, and should not cause any big problems.

[edit] Planned features

Curious about the upcoming features in the next release? The future work page contains on overview of the planned features, and the proposals that have been turned down.

[edit] Change log

This list only contains the versions and their release dates. For a list of all changes made, view the change log section of the version history page.

  • Version 0.2 (2009-07-29)
    • Version 0.2.1 (2009-07-30)
    • Version 0.2.2 (2009-08-01)

[edit] Languages supported

Semantic Maps has support for English, Afrikaans, Arabic, Egyptian Spoken Arabic, Belarusian, Breton, Bosnian, Catalan, German, Lower Sorbian, Greek, Esperanto, Spanish, Basque, Finnish, French, Galician, Swiss German, Hebrew, Upper Sorbian, Hungarian, Interlingua, Indonesian, Italian, Japanese, Khmer, Ripoarisch, Luxembourgish, Macedonian, Dutch, Norwegian Nynorsk, Norwegian, Occitan, Polish, Piedmontese, Portuguese, Brazilian Portuguese, Romanian, Tarandíne, Russian, Slovak, Serbian Cyrillic ekavian, Serbian Latin ekavian, Swedish, Telugu, Tagalog, Veps, Vietnamese, Volapük, Simplified Chinese, Traditional Chinese and others.

[edit] Usage

Semantic Maps showing a Yahoo! Maps map with markers representing queried coordinate data.

If you are new to both Maps and Semantic Maps, it is highly recommended you read how to use Maps first.

[edit] Querying coordinate data

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.

[edit] 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.

[edit] Form Inputs

Semantic Forms showing a Google Maps map and geocoding features provided by a hook of Semantic Maps.

Semantic Maps provides multiple form inputs. These form inputs are hooks for the Semantic Forms extension. They allow users to add, edit and query data using forms, instead of wiki code. For more info on how to work with form inputs, please read how to define them. Every mapping service has it's own form input.

Once you have defined a form with one or more fields using an input type provided by Maps, you can insert and edit data with it. When you create new data, a text field for coordinates and a map of the chosen mapping service will be shown. You can either simply enter the coordinates and ignore the map, or you can use the map to determine your coordinates. This is simply done by clicking on the location you want to add, which will result in the corresponding coordinates to be displayed into the coordinate text field.

You can find a list of all map properties you can set in #ask queries in the form inputs 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.

[edit] Geocoding locations in the form input

Semantic Maps has live geocoding capabilities in several of it's form inputs. This feature is present in the form of an extra text field underneath the coordinate field, where you can enter an address, and a 'look up coordinates' button. It's used by entering your address into the address field, and then clicking the related button. Once you've done this, the marker on the map will move to the correct location (or be placed there when it's not yet on the map), and the coordinates in the coordinate field will be updated.

This feature is only available for maps using the Google Maps or Yahoo! Maps mapping services. OpenLayers form inputs does not have it.

[edit] Map services

Semantic Maps current supports all mapping services of Maps, as listed below. Every service, and all of it's aliases are made available as result formats in #ask queries, and as input types for forms.

Service Description Parameter Aliases Demo's
Google Maps A web mapping service application and technology provided by Google, free for non-commercial uses. More googlemaps google, googlemap, gmap, gmaps Examples
Yahoo! Maps Yahoo! Maps is a free on-line mapping portal provided by Yahoo!. More yahoomaps yahoo, yahoomap, ymap, ymaps Examples
OpenLayers OpenLayers is an open source (provided under a modified BSD license) JavaScript library for displaying map data in web browsers. More openlayers layers, openlayer Examples
OpenStreetMap OpenStreetMap (OSM) is a collaborative project to create a free editable map of the world. OpenLayers is used to display the data. More osm openstreetmap, openstreetmaps Examples

Example of the usage of the format parameter in an #ask query:

{{#ask:[[Category:Locations]]|?Has coordinates|format=googlemaps}}

Example of the usage of the input type parameter in a coordinate form field:

{{{field|The coordinates|input type=googlemaps}}}

Both the #ask queries and the input types for forms support the 'map' value for their result format and input type, respectively. When you use this value, the default mapping service will be used. You can also, optionally add a 'service' parameter, which will then determine the mapping service that will be used. Note that the 'service' parameter will only be held into account when using the 'map' format or input type.

Example demonstrating the usage of the 'map' value in an #ask query. The default mapping service will be used.

{{#ask:[[Category:Locations]]|?Has coordinates|format=map}}

Example demonstrating the usage of the 'map' value together with the 'service' parameter in a form input.

{{{field|The coordinates|input type=map|service=googlemaps}}}

[edit] Map 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.

[edit] Ask queries

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

Here is an example of an #ask query that uses the 'googlemaps' format (view demo's):

{{
#ask:
[[Category:Locations]]
|?Has coordinates
|format=googlemaps
|width=800
|height=500
|zoom=8
|autozoom=off
}}

[edit] Form inputs

This table contains all common map properties you can place in coordinate field definitions of forms.

Property Usage Aliases Default Version
input type 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 , the zoom will be set so you can see the entire planet. - 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 current location, or when not set, to coordinates 0,0. center auto-detect Changed in 0.2

Here is an example of a definition of a coordinate field definition in a form that uses the 'googlemaps' format:

{{{
field
|The coordinates
|input type=googlemaps
|width=800
|height=500
|zoom=8
|autozoom=off
}}}

[edit] Settings

Semantic Maps allows you to configure a variety of settings, and so affect how the extension works. All settings are located in Maps_Settings.php, in the root of the Maps extension. Currently, Semantic Maps does not add any settings to the ones of Maps. Please refer to the Maps Settings for an overview of these settings, and instructions of how to modify them.

[edit] Contributing to the project

[edit] Extending Semantic Maps

Maps and Semantic have been designed to be very extendible. Due to their modular structure, it's possible to add a completely new mapping service without changing a thing in any of the core code, or even the extension's files. Adding a new mapping service has a whole list of advantages against creating your own extension to handle that service. Some of the most noteworthy are listed below.

  • Less work to create: The Maps and Semantic Maps code already handles the common features, and only requires mapping service specific code, sparing you the need to write code to handle problems other people have solved before. As a developer, you will also be able to take advantages of improvements made to Maps itself, without having to implement them over and over again in your own code.
  • Follows convention: By using the central Maps and Semantic Maps code, your not creating similar, but different code, which makes it easier for people to discover, locate and fix problems, and to add new functionality. This also makes usage for end user a lot easier, since the wiki code will always be similar to the extend possible.
  • Ease of installation: Installing two extensions (possibly bundled with 3rd party mapping service implementations) is far easier then installing a dozen for an end user. It also solves issues with incompatibility between multiple mapping services, which can cause extensions to break.
  • More publicity and usage: Since Maps is the only mapping extension for MediaWiki that handles a true mapping service independent platform, and cause of that provides multiple mapping services and a variety of both common and specific features, users are far more likely to choose Maps (and Semantic Maps) instead of multiple individual extensions.

[edit] How to extend Semantic Maps

You can learn how to create your own extension for Semantic Maps by looking at the source code and doing some experimenting, or you can read the manual, that goes through all the required steps.

[edit] Bugs and patches

If you found some bug and fixed it, please create a patch by going to the "SemanticMaps" directory, and typing:

svn diff >descriptivename.patch

Then add the patch to the bugs section of the future work page. Bug reports should also be added here. You can also send them to Jeroen De Dauw, jeroendedauw -at- gmail.com, and Yaron Koren, at yaron57 -at- gmail.com.

[edit] Feature requests

Feel free to add feature requests to the new proposals section of the future work page.

[edit] Translating

Translation of Semantic Maps is done through translatewiki.net. The translation for this extension can be found here. To add language values or change existing ones, you should create an account on translatewiki.net, then request permission from the administrators to translate a certain language or languages on this page (this is a very simple process). Once you have permission for a given language, you can log in and add or edit whatever messages you want to in that language.

[edit] Work for hire

The following people can be hired to set up a wiki that uses Maps and Semantic Maps, along with other MediaWiki components.

  • Jeroen De Dauw - You can also hire me to develop new features for Maps or it's extensions, or do optimizations for your specific needs. Just send me an email.

[edit] Getting support

If you have any Semantic Maps related questions, you can add them to the Talk page. You can alternatively also place any questions on the Semantic MediaWiki mailing list, semediawiki-user. If possible, add "[SM]" at the beginning of the subject line, to clarify the subject matter. Please contact the extensions authors only directly for urgent matters. Placing your questions on the talk page will create useful references for other people with similar problems.

[edit] Sites that use Semantic Maps

Are you using Semantic Maps? Then be sure to add your wiki to the top of this list, and feel free to link your favourite Semantic Maps-using articles!

[edit] External links

[edit] See also