Jump to content

Extension talk:Semantic Google Maps

Add topic
From mediawiki.org
Latest comment: 15 years ago by Yaron Koren in topic Zoom does not work for me

Zoom does not work for me

[edit]

Google Maps 0.5 does not seem to take the zoom value in an ask query. My query looks like that:

{{#ask: [[Kategorie:Mitarbeiter]]
|?Koordinaten
|format=googlemap
|width=840
|height=550
|zoom=2
}}

Everything works fine (width and height are taken correctly), it's just that Google Maps is not interested in my zoom value, it always takes its own value so that all points are displayed on the map. Can you help with that? Thanks, Florian

That was done on purpose, although you could view it as a bug. The idea was to have "zoom" only apply when there are zero or one points on the map, and thus there's no better information on what the zoom level should be; with two or more points, as you note, the system sets the zoom to show all the points. Out of curiosity, why do you want a different zoom than that default level? Yaron Koren 16:06, 10 June 2009 (UTC)Reply
Because I want to display the location of different people, and although no people live near the border, I'd still like to set the zoom so that always the complete country is displayed by default. I'd appreciate if the user also has the option for an ask query, but thanks for the fast reply anyway. Florian
Same here (in version 0.6.3): I also would like to set the zoom level, because if you see two items on a map of Armenia you don't know where you are (until of course you are from Armenia ;-). Bernhard
Hm - maybe, when there's a difference between the "calculated" zoom and the "default" zoom, the system should go with the smaller of the two - meaning, the one that shows more area. Yaron Koren 15:30, 15 June 2009 (UTC)Reply
Hi, I've done a little patch in awaycity specially for this zoom to work when you have only one point. Line 195, just replace "map.setCenter(center, zoom); " by "map.setCenter(center, $zoom);", and that's all folks. Charles 22:22, 25 June 2009 (GMT)

Possible bug when using #show with #geocode

[edit]

The #show function can be used to retrieve properties that were set on the current page. For example you could have: {{#show:{{PAGENAME}}|?Property Name}}. It seems to work fine.
Also I've found that #geocode works, given a postal address it gets the longitude and latitude. However, I've found that when I combine #show with #geocode, something like:

{{#geocode: {{#show:{{PAGENAME}}|?Postal Address}} }}

it sometimes works, for example when it is all wrapped up in a template, but very often it does not work. To see an example of this bug on a page, have a look at this page

My question: is there a way to get #show and #geocode to work together consistently?
Pnelnik 11:57, 16 March 2009 (UTC)Reply

Automate geotagging

[edit]

I would guess that most wiki's that use sematic google maps would like any points that they mark on the map to be geo-tagged. That would enable search engines which use the physical location would pick up the fact that the given page refers to a particular physical location. I wonder could get get the geo-tag added automatically when a semantic google map is created? Perhaps it could be an optional parameter. Pnelnik 13:10, 24 February 2009 (UTC)Reply

What do you mean by geotagging? Yaron Koren 15:04, 24 February 2009 (UTC)Reply
There's an article on Geotagging in wikipedia. It is the process of adding geographical identification metadata to various media such as photographs, video, websites, or RSS feeds and is a form of geospatial metadata. These data usually consist of latitude and longitude coordinates, though they can also include altitude, bearing, accuracy data, and place names. Geotagging can help users find a wide variety of location-specific information. For instance, one can find images taken near a given location by entering latitude and longitude coordinates into a Geotagging-enabled image search engine. Geotagging-enabled information services can also potentially be used to find location-based news, websites, or other resources. Pnelnik 16:08, 24 February 2009 (UTC
Yes, but isn't that what placing coordinates on a page does already? Yaron Koren 17:13, 24 February 2009 (UTC)Reply
I wonder will the external search engines, such as google, pick up the co-ordinates if they are not displayed either in a semantic data fact box or explicity? Pnelnik 11:52, 26 February 2009 (UTC)Reply
Okay, now I understand - do you know what tag or tags would need to be added? Yaron Koren 18:36, 26 February 2009 (UTC)Reply

Problems with Multidomain Website / Wrong API key

[edit]

I have a page that is accessible through different domains. Because I have to use different keys for any domain I created a switch/case with all domains and the matching keys. In fact that onl works when I'm logged in in Firefox, when beeing logged in with IE it also does not work. So maybe there could be an option so that always the right Google-API-Key is used when accessing the page. Another problem is taht when the API-Key does not match a blank page is displayed, thats really horrible because the visitors are send to nothing and have no idea what is happening. So please help me as fast as possible becuase this is a very heavy problem. --DaSch

The easiest solution is to add an if-statement to your LocalSettings.php file, setting the value of $wgGoogleMapsAPIKey depending on the domain name. Yaron Koren 14:35, 28 January 2009 (UTC)Reply
switch ($_SERVER['SERVER_NAME']) {
case 'www.wecowi.org':
	$wgGoogleMapsKey = "ABQIAAAA__GiJtD656qFFpzcpAt-ARSWbsg7MD554WMk_Vh9EIKtEkVf3hTsPDSbJSOXz5CqPuXyBxB_jBqvxA";
	break;
case 'www.wecowi.de':
	$wgGoogleMapsKey = "ABQIAAAA__GiJtD656qFFpzcpAt-ARToxIPrRWuzP1fkVd5zyU-_jiuotxS2E7iLB8LwRDGhTHapBRwglqEfPw";
	break;
case 'www.wecowi.net':
	$wgGoogleMapsKey = "ABQIAAAA__GiJtD656qFFpzcpAt-ARTelo5jm4yb5qTkge9jr64VyQqomxR71qR5NBiG9WC3r1hk6DnRn_QVxw";
	break;
case 'www.wecowi.com':
	$wgGoogleMapsKey = "ABQIAAAA__GiJtD656qFFpzcpAt-ARThrbGFYKenk4bBPElF2PVDGIcSfRTqn5xz9CCfCqw-8JwL_4lyK2rrhg";
	break;
case 'www.wecowi.info':
	$wgGoogleMapsKey = "ABQIAAAA__GiJtD656qFFpzcpAt-ART3AsKhdKI84fD204XOe4ns1ro_1xRAiSOSMN0WpwBr4dMnGTd-tXa_dA";
	break;
case 'www.wecowi.eu':
	$wgGoogleMapsKey = "ABQIAAAA__GiJtD656qFFpzcpAt-ART-95oevjTj25nO9771qTZ_4UMIaBQqAQhxlIFG0GVHGbJx5CcO8V8KWw";
	break;
	}

I made this. But it only works when I'm logged in. Even other users beeing logged in are getting an error. So I'm not sure if this is checked with every page beeing loaded. --DaSch 16:12, 28 January 2009 (UTC)Reply

Sorry, I don't know what to tell you. There's no special domain-checking PHP code that can be run in the extension but can't be run in LocalSettings.php. Yaron Koren 18:13, 28 January 2009 (UTC)Reply
Yes sure, but the effects are very strange and by know a had to disable the extension because pages with a map are displayed blank. --DaSch 19:30, 28 January 2009 (UTC)Reply
Yeah, that's true - the error-handling could be better. Yaron Koren 20:09, 28 January 2009 (UTC)Reply
Well, it seams that the $_SERVER['SERVER_NAME'] parameter not always gives the correct domain, so i changed it to only taking the tld. that works. Maybe the www was not always there or something like this. --DaSch 11:55, 30 January 2009 (UTC)Reply
Well, no the error is getting even stranger. On some pages the API-Key is not right. The same page is displayed in Safari with no error an not displayed in Opera because of a wrong API-Key, other pages work the other way, not in Safari but in Opera. Maybe the handling of the API-Key is somewhere buggy. Is it maybe cached somewhere? There also seams to be a bug within IE so that the $_SERVER['SERVER_NAME'] is giving a wrong value. Maybe there could be a possibility to check the domain by javascript at runtime. And the configuration would be with an array of domain and key. Then the script could check for hostname in the request and take the right API-Key. By the way, I think maybe it would be better to have a alternative to GoogleMaps with similar functions, without the API-Key Problems and Google and so on. --DaSch 15:57, 30 January 2009 (UTC)Reply
I think now i solved the problem. The thing is that you get a different API-Key when giving a subdirectory. So when generating the API-Key you have to use http://domain.tld/wiki and not http://domain.tld/ because this does not always work. I hope this is my last posting to this problem :) .--DaSch 10:49, 3 February 2009 (UTC)Reply
I think the problem is that the keys are cached. So when I preview the page I have another path when viewing the page. Then the wrong key is already cached and the map is not displayed because of using the wrong cached key. --DaSch 18:58, 25 March 2009 (UTC)Reply
Yes, chunks of parser function output (including Google API key) are always cached so if you want to avoid it, the only way for you to fix it in current version is to disable caching which I don't recommend. The other solution is to tweak the code so API key is determined in JavaScript and not on the server side, but it'll require some customizations to extension code and logic. --Sergey Chernyshev 19:25, 25 March 2009 (UTC)Reply
[edit]

Is there a way to add sidebar to the map? I have a map here http://www.transitunlimited.org/Downtown_San_Jose#Map which shows various places in an area. The map isn't very useful if someone can't look for a place by name and see where it is. (The map does well in terms of looking up a street and see the marker located near there.) 24.4.95.191 07:53, 25 February 2009 (UTC)Reply

There's no way to do that, but that might be an interesting idea, possibly using the Local Search control. Yaron Koren 20:54, 25 February 2009 (UTC)Reply
I am thinking towards something like this: http://econym.googlepages.com/example_map2.htm or http://econym.googlepages.com/example_map2b.htm
I think it needs to have a div and an array to collect the markers. I played with the codes but couldn't get any results.24.4.95.191 03:32, 26 February 2009 (UTC)Reply
Oh, I understand - you want a sidebar that lists all the locations. Yeah, that would be nice; let me know if you make any progress. Yaron Koren 05:19, 26 February 2009 (UTC)Reply
You might want to check out this extension to see if their method can be incorporated. --Tosfos 04:31, 5 April 2009 (UTC)Reply

OpenStreetMap instead of Google Maps?

[edit]

Do you happen to know what it would take to get this extension to work with OpenStreetMap instead of Google Maps? Thanks. —Fleminra 20:21, 14 March 2009 (UTC)Reply

This would most likely have to be done using the OpenLayers library, which is handled by the Semantic Layers extension. Unfortunately that extension hasn't been updated in a while, though. Yaron Koren 20:41, 15 March 2009 (UTC)Reply

Custom markers

[edit]

At mikomos we are using SGM. It's working very well. We have one minor issue: the custom markers are being stretched vertically. This can be seen here, compared to the icon file here. I remember reading about this problem somewhere and someone (I think from the Google team) tracked it down to Mediawiki's CSS imposing a line height. This style was being inherited by the map which skewed the icons. This may be the case here as well. We have this problem under all skins, except one which skews the icons even more. I guess the solution would be to prevent the map from inheriting the CSS, hopefully without any unintended consequences. --Tosfos 01:19, 20 May 2009 (UTC)Reply

Well, one solution is to include clear space in the image, so that its dimensions will be what Google Maps expects. As to the CSS - assuming it can be fixed via CSS, can't you just fix it in the MediaWiki:Common.css page? Yaron Koren 04:10, 20 May 2009 (UTC)Reply