Help:Semantic Google Maps Mashup
From We The People
Contents |
Google Maps Mashups
- See Help:Inline_Queries for information on Inline Queries.
- See the extension on MediaWiki for more support.
Also, as a reference, you can view the list of automatically generated properties or Special:Properties.
The Basics
You can easily create Google Maps Mashups on the fly by using Inline Queries with "|format=googlemap". This is powerful in that you can display on the map all points relative to as many conditions as you would like. The map will also update each time it is loaded based upon updates to the wiki, so if your map is based upon recent activities, it will automatically display the most recent information available in the wiki.
Additional Entries
To make displaying easier, there are additional options of "|zoom=" and "|center=" that allow you to control how far in you want the zoom to be as well as where you want the map to be centered. "|zoom=11" is about city-level, while "|zoom=14" is street level. If you do not specify a center, it will automatically take the average of all the results and center it around that point. Note: "|center=" requires you to enter a geocoordinate (e.g. latitude and longitude). If you don't happen to know the latitude or longitude of a given street, you can enter
"|center={{#geocode:YOUR STREET ADDRESS, Washington, D.C.}}"
and the address will be automatically geoencoded for you. Also, if you are curious about an address's geocoordinates, you can place
{{#geocode:YOUR STREET ADDRESS, Washington, D.C.}}
on any page, and hit Save or Show Preview, and the result will be displayed in it's place
You can also add seven additional parameters to the query:
-
width=- the width of the map, in pixels; defaults to 400 -
height=- the height of the map, in pixels; defaults to 400 -
center=- the coordinates at the center of the map; defaults to the center of the current set of points -
zoom=- the zoom level of the map; should be an integer greater than equal to 1 (a value of 1 shows the whole world, and for most areas, the maximum zoom is around 18). Defaults to whatever the closest zoom is that shows all the points selected -
map type=- can be either G_NORMAL_MAP, G_SATELLITE_MAP or G_HYBRID_MAP; defaults to G_NORMAL_MAP -
map control=- the map control class displayed to let the user zoom and navigate; defaults to GLargeMapControl -
icon=- the name of a local image file to use, in place of the default icon, to mark points
Examples:
If we want to see the last 10 thefts in ward 5.
{{#ask:[[Geographic coordinate::+]][[Ward::5]][[offense::Theft]]
|?Geographic coordinate
|?offense
|?ward
|?occurred on
|sort=occurred on
|order=descending
|format=googlemap
|limit=10
|zoom=12
|center=38.91415300994180, -77.01692443940840
|width=600
|height=400
}}
- Notice how we have [[Geographic coordinate::+]]. This line just says to return all results with a geocoordinate, so we do not try to map things that do not have a place to map them!
- After that, we have [[Ward::5]][[offense::Theft]], which tells the search to only return Theft's in Ward 5.
- We then have a list of printouts, "|?offense" for example. These will display in the pop-out bubble on the map when we click on the location marker.
- We then have our Sort command, which tells the search to sort our results base on "occurred on", the property for when the crime occurred. Note that "descending" in the context of dates returns the most recent event first.
- Notice the "|format=googlemap", limit, zoom, center, width, and height.
- You are only limited by your imagination. You can make searches as explicit as you would like -- for example, let's see all homicides between june and august 2007 that used a knife.
{{#ask:[[Geographic coordinate::+]][[method::KNIFE]] [[offense::Homicide]][[occurred on::>1 June 2007]][[Occurred on::<31 August 2007]]
|?Geographic coordinate
|?offense
|?method
|?occurred on
|format=googlemap
|limit=10
|zoom=12
|width=600
|height=400
}}
