Semantic Maps – Yahoo Maps query printer

From the archive: written in 2009 and kept for the record. Much of it is out of date.

Last 2 days I continued working on the query printers of Semantic Maps. I started of with creating a new abstract class, called SMMapPrinter, which inherits from SMWResultPrinter, and contains the common code of all QP’s in SM. It has one protected field, $m_locations, which obviously is an array holding all locations, and 3 functions. One public abstract getName(), one public getResult, and one protected getResultText. The last function does the work of putting all the locations into the $m_locations field, and so allows me to omit this in every QP inheriting from this class. Another small thing this function does is setting the default map parameters, using MapsUtils::setDefaultParValues.

Semantic Maps showing a Yahoo! Map with queried coordinates

Map code: {{#ask:[[Category:Locations]]|?Has coordinates|format=yahoomap|width=610|height=500}}

After this was done I adapted the Google Maps QP to work with it, and started work on the Yahoo Maps query printer. I did some reading in the Yahoo! Maps documentation on how to exactly place markers that allow the display of a text balloon after being clicked, which are called ‘smart markers’ in the Yahoo! Maps API. I got everything working (displaying all markers, the balloons and links in them and the map properties), except the automatic centre and zoom of the map to display all coordinates. I’ve got the code for this, it’s isn’t giving any errors, but for some reason isn’t working either. The map just centres on the first coordinate. I’m going to have another look at this tomorrow, but if I can’t find it, I’ll just start with implementing Google Earth or Open Layers in Maps.

Jeroen De Dauw is founder and CEO of Professional Wiki and builds NeoWiki. More about me. Reply by email or on Mastodon, Bluesky or X.