Extension talk:Semantic Google Maps

Way to add areas for maps?
Does Semantic GM have any syntax to add areas or polygonal lines instead of just map points? Also, are text bubbles supported for map points? --83.145.207.200 11:58, 6 September 2008 (UTC)
 * Hi - no to the first two. As to the text bubbles, I don't quite know what you mean - clicking on any marker in an SGM map brings up a bubble with that page's name; is that what you're talking about? Yaron Koren 20:33, 7 September 2008 (UTC)
 * Yeah, I was just baffled for a moment with the bubbles. I studied the php source but my skills aren't sufficent in modifying the source to support GM polylines, is a support for them planned for some future release? Imho it could really enhance the capabilities of this awesome extension. --83.145.207.200 18:44, 12 September 2008 (UTC)
 * Hi, what would be the source of the polyline data - would it be semantic data? Yaron Koren 19:09, 12 September 2008 (UTC)
 * Not necessarely but both semantic and non-semantic input. For example it would be nice to be able to compare areas and route lengths on a map and also be able to add non-semantic polylines and areas simply because then one would not have to install another google maps extension simply because it provides these functions. It would be handy if everything was in one extension. --83.145.207.200 16:10, 30 September 2008 (UTC)
 * The coordinate pairs could be passed to SGM in this fashion: in order to form polyline routes. I'm not sure though if the api allows displaying or extracting route lengths as in the Google Maps site. --83.145.207.200 10:27, 23 October 2008 (UTC)

Semantic forms
Hi Robert, i talked with a some time ago about mediawiki and maps, good to know you migrated to Mediawiki. This extension it's the same i requested to Yaron from Semantic forms. It's really very interesting. As can see in these days, another extension with same propose was released too: http://www.mediawiki.org/wiki/Extension:Semantic_Layers I really would like to chat with you by IM, but for a long time i don't see you online on gtalk. For next i'll give some suggestion, thanks. Lleoliveirabr 16:45, 2 September 2007 (UTC) Lleoliveirabr 17:23, 2 September 2007 (UTC)
 * Hi Robert, i saw on your web page on Semantic forms that if you want to move the placemark, is necessary to click on any place on map. Another thing: there's no option to use a search to go to a city for example. On this example you can see how i would like to see. It's possible to move the placemark and option to move the map by typing a city... http://perso.orange.fr/universimmedia/geo/loc.htm What do you think?
 * Robert, some months ago i posted on Semantic forms google groups about this idea. Look the message:http://groups.google.com/group/semantic-forms/browse_thread/thread/e60db1b0bf11d692
 * I think Yaron could integrate your extension in Semantic forms. Lleoliveirabr 18:19, 2 September 2007 (UTC)
 * Eventually, yes. First the problem of the degree-symbol showing up as a question mark or html-character code in stead of a degree symbol should be solved.--Robert Buzink 22:17, 2 September 2007 (UTC)

Geocoder
I added a geocoder to the coordinatesmap input-type --Robert Buzink 22:12, 2 September 2007 (UTC)
 * Great.

Custom icons
I would like to know if is possible to add custom icons to forms that have coordinate map. So in the future when we have a way to search semantic data in the map, we could see the custom icons.
 * I don't know if this could be by uploading an icon and make a field in forms to specify this icon directory. What do you think Robert? Any idea? Lleoliveirabr 00:21, 3 September 2007 (UTC)
 * Would be no problem. just make extra field in the form called icon and specify url to icon file there. The overview-map (that doesnt exist yet at present! currently there are only maps within articles for one location) uses the coordinates-variable anyways, could just as easily use icon-variable.--Robert Buzink 13:08, 3 September 2007 (UTC)

Technical Difficulties with Parser functions or is this a gottcha with my IIS server once again
Love the extension and if I get it working I will be using it to death on my site.

I have working to the point were it appears in the form with a map and "Lookup coordinates" field which works wonderfully. However when I save it dones not add the coordinates. Nor does it appear to be parsing. I get the following text on the page instead of a map:

I am not expert Mediawiki developer, more of a wikivoyeur... so I am at a lost as to why it is not working. I do have the required dependency Parser functions. Am I missing something else? I run the site on an IIS server which bites me in the ass from time to time with MediaWiki. Currently I have Semantic Google Maps installed on our out of site development server but the live server has most of the goodies with the exception of Semantic Google Maps.

http://www.placeography.org/index.php?title=Main_Page Any ideas? Thanks. --Myotus 17:16, 5 September 2007 (UTC)

I have moved the Semantic Google Maps extension to my live server since it appears to do no harm other than it not functioning correctly for me. If anyone has any ideas on why it is not functioning correctly I would love to know! Thanks! Location Template Form with Semantic Google Maps Extension Example of Form with Data --Myotus 14:53, 6 September 2007 (UTC) Sergey gave me the solution (no, it is not the IIS server) so I figure I would put it here for anyone with similar issues... Works like a charm... --Myotus 13:53, 15 October 2007 (UTC) Solution:

"Stationstraat 3 Maastricht Netherlands" Default is confusing
Using the address "Stationstraat 3 Maastricht Netherlands" is very confusing for users. Especially if the coordinates have already been created and the user is editing not creating the page. Instead of an example, wouldn't it be better to have some text saying something like "Add address here"

Also, is it possible for that field to keep the value once it has been entered so the next person editing will know what the coordinates are for? see example of one of my pages using it to see what I mean --Myotus 05:11, 5 October 2007 (UTC)


 * I agree that this would be very helpful. For the time being I've changed "Stationstraat 3 Maastricht Netherlands" to something like "Please enter the address" (in Semantic_Maps.php), but like Myoutus said, having the actual street address in there once it's been entered would be ideal. Possible? --Weakmassive 19:27, 2 December 2007 (UTC)

No default size
One of the problem I faced is that there is no default size for the map so #insert_map parser function doesn't show the map with just coordinates specified.

P.S. it might be a good idea to set up a a discussion group (on Google groups for example) or mailing list and have a place to accept bugs like Mediazilla.

A few problems
Hello, just discovered this extension and am trying to work it into my wiki, which is using Semantic Forms. First off, I'm getting these errors on my homepage along with an error popup that says "Error: Failed to derive URL prefix for Timeline API code files".

Notice: Undefined variable: wgGoogleMapsOnThisPage in /home/2603/domains/mographwiki.net/html/extensions/Semantic_Maps.php on line 33

Notice: Undefined offset: 1 in /home/2603/domains/mographwiki.net/html/extensions/Semantic_Maps.php on line 61

Notice: Undefined variable: output in /home/2603/domains/mographwiki.net/html/extensions/Semantic_Maps.php on line 39

Notice: Use of undefined constant noparse - assumed 'noparse' in /home/2603/domains/mographwiki.net/html/extensions/Semantic_Maps.php on line 49

Notice: Use of undefined constant isHTML - assumed 'isHTML' in /home/2603/domains/mographwiki.net/html/extensions/Semantic_Maps.php on line 49

Also, I'm trying to get "Lookup coordinates" to work on my form pages... right now the map doesn't display and it's just a text field. I'm probably doing something wrong. I've disabled Semantic Maps (because of above errors), but the code is still in these pages:

Example of page with map Location template "Company" page template "Company" form

Thank you! --Weakmassive 15:34, 30 November 2007 (UTC)

Okay, I think I've somewhat fixed the above problems. I added "display_errors = off" to my php.ini to suppress the php warnings (which I think were due to the combination of the Dynamic Page List extension used and the front page and Semantic Maps). Then somehow I got the geocoder to work - I think it has something to do with how (and where) I entered the Semantic Maps info in LocalSettings.php. --Weakmassive 19:19, 2 December 2007 (UTC)


 * I finally set up and tested this extension myself and got all the same PHP notices, so I fixed the problems in the source code - if you copy over the code again, you should be able to run it without suppressing warnings. I also removed that "Stationstraat etc." default value - the text entry at the bottom now just defaults to blank. Yaron Koren 17:39, 4 December 2007 (UTC)

Lookup map does not show
I can display maps wonderfully, in the forms I also can add the coordinates. Anyway, the map with the lookup-function does not show up in the form.

The solution to this was to put the call to Semantic Google Maps AFTER the call to SemanticForms!

Coordinate changes
When I go back and edit a form in which I've previously added coordinates, the format for the coordinates changes once I save the page. For example, "39.092868° N, 94.575409° W" turns into "39.092868,-94.575409". When this happens, the coordinates are no longer seen in Attribute:Coordinates or in Semantic Layers. Any ideas? Thanks. Weakmassive 00:44, 21 March 2008 (UTC)

PHP Warning that aborts Skript
Warning: Cannot modify header information - headers already sent by (output started at /home/www/web406/html/extensions/SemanticMaps/Semantic_Maps.php:1) in /home/www/web406/html/includes/WebResponse.php on line 10

Since a few days I get thi strange message when Using Semantic Google Maps. DaSch 21:04, 11 May 2008 (UTC)


 * When I supress the error reporting all wikipages are displayed very strange, Tamplates are not included complete and some Text ist converted to lowercase. Is somebody working on this Extension or is the development stopped? DaSch 16:24, 18 May 2008 (UTC)

#ask does not display any points
Hi there,

this extension would be perfect for what we are doing with our wiki! I already got it working for displaying single points which is already great.

But I would also like to display the results of an ask query (e.g. : "show me all my points in a city" )

I think I did everything like described in the Documentation and also checked againsted referenced sites like verwaltungskooperation.at. The only thing I receive is a world map without any points at all.

Versions used are:

MediaWiki 1.12.0 PHP 5.2.6 (apache2handler), MySQL 5.0.45, SMW 1.2, SemanticGoogleMaps 0.3.1, SMW+ 1.1

update: also tried SMW Version 1.2.1a-SVN (SVN revision 37993) but with the same result

This is what I do:

Which simply displays the world map

To check whether the query itself is correct I do a

which diplays the following results:

- Hotel (Coordinates 49.43452° N, 11.871479° E) - Shop1 (Coordinates 49.428993° N, 11.866682° E) - Shop2 (Coordinates 49.429993° N, 11.866682° E)

So the fact base seems to be correct. Since displaying of single points is also working I have no clou whats wrong here. Is somebody able to help me with this one?

Thanks in advance! Michael


 * Very odd. Since you have "SMW+" installed (which I guess is the current name for the Halo extension), and I don't know if anyone else has tried running SGM with Halo before, I suspect that that might be the source of the problem. Can you try un-including Halo (to the extent that it's possible - I've heard that there are some problems with that) and seeing if that affects the mapping? Yaron Koren 12:11, 24 July 2008 (UTC)


 * Thanks for the quick response! I un-included Halo and also upgraded to the latest Mediawiki version (1.14-alpha) but with no effect. Still the empty world map remains. Do you have any additional suggestions? Is there a debugging functionality that I can use? Thanks! --Mkonder 15:37, 24 July 2008 (UTC)


 * Wow, I have no idea, then. There's no debugging functionality that I know of, but you could try debugging it manually using print statements and the like... that's the only solution I can think of at the moment. Yaron Koren 13:00, 25 July 2008 (UTC)

Including Semantic form data
I thought I'd include data entered through Semantic Forms and output through a template but I am having problems here.

Using

Produces the intended map in the template output.

Making a simple table with the form output, thus

Also produces the intended output, that is the data that would produce the map. Trying to enclose the form data by a call to semantic_google_map like this:

Fails utterly in producing anything at all. I checked the brackets and they should be OK.

Am I doing something stupid or doesn't the extension support this (yet)?


 * There are a few issues here: first all, you have too many braces. The call should look like:

{{#semantic_google_map:{{#geocode:RecipeGeoStreet::, RecipeGeoTown::, ...
 * Aha, OK I'll give that a try.
 * Hm no, doing

=Where in the world is }}}?= {{#semantic_google_map:{{#geocode:}}}, }}}, RecipeGeoCounty::,RecipeGeoCountry::}}|8|G_NORMAL_MAP|GLargeMapControl|pmap|600|450}}
 * Gives the header "Where in the world is Shrewsbury?" But no map.

Second, if any of the properties are of type "Page", that still won't work, since it'll be a link passed in to #geocode instead of just a string; it might be easier to call the properties separately from the mapping call. Yaron Koren 20:26, 27 July 2008 (UTC)
 * No, they are strings all of them so that's OK then.


 * I would try separating that call into its constituent parts, to try to see where the error is coming in. Yaron Koren 12:14, 28 July 2008 (UTC)
 * I thought I already had done that. Putting }}} etc outside the {{#semantic_google_map:{{#geocode: ...}}...}} call gives me all data I need to produce a map. If I add the form data place holders inside the semantic google map call (as in the code snippet above) I get nothing. Perhaps I am missunderstanding what you mean? --85.225.73.203 04:34, 29 July 2008 (UTC)


 * Okay, try having just the #geocode call by itself and see if that works. Yaron Koren 13:57, 29 July 2008 (UTC)


 * Aha! {{#geocode:Shrewsbury, England}} gives me coordinates, while {{#geocode:}}}, }}}}} does not. And again, checking all my form placeholders outside {{#geocode:...}} produces the correct values. So the fault may lay with the geocode extension....? Perhaps I should try contacting the author of that extension.--85.225.73.203 06:31, 30 July 2008 (UTC)
 * Well, I just tried a simple test of using #geocode in this way, and it actually worked for me. I have two thoughts: (a) is it possible that at least one of these semantic properties is of a type other than "String"? (b) if you're displaying these values by themselves elsewhere in the template, you can remove the property tag from around the instance of those values within #geocode - they don't need to be tagged twice. Yaron Koren 12:58, 30 July 2008 (UTC)
 * This is getting really bizarre. Well, yes I was certain they were strings (they were listed as such, although I faintly remember changing one of them to string after creation) so just to make sure, I created new properties (sans the "Recipe" part), type String and used those in the template. Same bizarre behaviour - no map. They are listed under "Unused Properties" although they return correct values not in the geocode call (apparently there is some limit for being listed as used). And no, they are not used twice in the same template unless I am testing the behaviour.--85.225.75.113 06:30, 31 July 2008 (UTC)
 * Seems you can insert the values the way I tried {{#geocode:}}} you need to add only the value like so {{{19|}}} . At least in my case.--85.225.75.113 19:34, 31 July 2008 (UTC)

Form Defaults
Hi Yaron, just a couple of points of feedback on an excellent extensions :)

After each update I find myself making the same changes to the extension, that is, updaing the size of the map and the default location displayed. It would be great to have an easy way of configuring these defaults in the LocalSettings.php Thanks mate Rodeoclash 11:46, 18 September 2008 (UTC)
 * Sorry, I should mention that this is for the Semantic Form plug-in, the in page display is fine. Rodeoclash 11:51, 18 September 2008 (UTC)


 * Hi, thanks. If you set the default location, are you also setting the default zoom level? Yaron Koren 12:16, 18 September 2008 (UTC)


 * Yes, I'm resetting the default position and zoom after each install. Rodeoclash 05:34, 29 September 2008 (UTC)


 * Hi - now that I think about it, this should already be possible - just add "default=..." to the coordinate field in each form definition. Does that work for you, or do you need more control than that? Yaron Koren 23:59, 30 September 2008 (UTC)


 * Actually, I realize now that the 'default' value is not at all the same thing, since that one affects the data as well. Anyway, I added some parameters for setting the center, zoom, width and height of both the form input map and the query map, in the version I just released, 0.4. Yaron Koren 16:54, 3 October 2008 (UTC)

Customization
Hi, Great extension! I want to be able to change the map type and controls etc. Basically I want to change the type to G_PHYSICAL_MAP (a terrain map) and add large controls. I have replaced all the G_NORMAL_MAPs I could find in the php files but I couldn't get it to work. Does anyone have any ideas on how to control the the map type? --Judson 10:59, 1 October 2008


 * That's a good idea; in the latest version, 0.4, I added 'map type' and 'map control' parameters to both the query map and the form input map, to let those be customized; and I changed the default value for the control to be GLargeMapControl, since I think that's the better interface. Yaron Koren 17:27, 3 October 2008 (UTC)


 * Actually, I just changed the default control for the form-input map back to GSmallMapControl, but it's still customizable. Yaron Koren 18:50, 3 October 2008 (UTC)


 * Thanks, it works great! Check it out:  www.netcairns.com.   Judson 10:26, 25 October 2008

Adding a distance calculator function
Perhaps we could add a distance calculator, which would have as inputs the longitude and latitude of two points and would output the distance along the earth's surface. It would be straight-forward to code and I think very useful. It would be helpful if it were compatible with the results returned by the geocode function. For example suppose we have Point1:        ( x1, y1) where x1 is the degrees north ( if it is south then it will be negative ) y1 is the degrees east ( if it is west, then it will be negative ) and Point2:    ( x2, y2 )

We first convert them to radians, ( x degrees = x * pi / 180 radians). We assume that the sin and cos functions, which we use below, use radians, as is the case with most implementations of those functions. We'll use capital letters for the points that have been converted to radians: ( X1, Y1 ) and ( X2, Y2)

Then the straight line distance through the earth between the two points is: D_through = R * sqrt { (cos(X1)*sin(Y1) - cos(X2)*sin(Y2))^2 + (cos(X1)*cos(Y1) - cos(X2)*cos(Y2))^2 + ( sin(X1) - sin(X2))^2 } and the distance along the surface D_surface = 2 * R * asin ( D_through / [ 2 * R ] ) where the radius of the earth R = [20,000 / pi] km ( i.e. 10,000 km from the equator to pole ). For those who have not yet got used to modern units such as km, which have only been in common usage since 1793, we could possibly also allow a conversion to miles (1.609344 km = 1 mile ). That would require another parameter specifying the units required. Notes:
 * The mathematical functions are available in the Math Functions Extension
 * To derive the equation above, convert polar coordinates to cartesian coordinates and then use Pythagorous.
 * We're ignoring the fact that the earth is not a perfect sphere, i.e. slightly flattened at the poles.
 * We also ignore altitude.
 * So the distance quoted is the distance along the surface of the earth at sea-level.

The code in C++ might look something like:

Pnelnik 12:42, 21 October 2008 (UTC)


 * Interesting. What would be an example of the usage of such a function? And have you checked to see if some other MW extension already contains it? Yaron Koren 17:06, 21 October 2008 (UTC)

For example, a distance calculator would be used by a wiki of universities. Suppose, in a wiki, we have the address of 100 universities, then using the geocode we can get the coordinates. Now if a user wants to rank the universities in distance from him, if he mentions where he is, then we can get the distance to each university.

I posted this same message on the Extension_talk:MathFunctions yesterday ( 21-Oct-2008 ) and within a few hours had implemented it. Pnelnik 11:22, 22 October 2008 (UTC)


 * Ah, great to hear; that's probably a better location for that function anyway. Yaron Koren 12:57, 22 October 2008 (UTC)

Text Bubbles
My goal is to have the semantic query create a google map and then once an icon is clicked and the text bubble pops up displaying three lines of data. I have been able to acheive this by adding more display fields (ex. ?distance). My issue is that the last item displayed then becomes the label for the icon (the data that pops up when it is rolled over). Do you know how to change the label to be the page name? Also, if you know how to increase the height of the text bubble that would be helpful. Here is my page: www.netcairns.com. This extension really is a great idea and I don't think I could make a more user friendly way for my wiki to display data and links on the front page. Judson 11:51, 25 October 2008


 * The first one looks like a bug in SGM; the second one, unfortunately, I think is a limitation of the Google Maps API - I looked into it at some point before. Yaron Koren 13:53, 26 October 2008 (UTC)


 * The first issue is now fixed, in SGM 0.4.2. Yaron Koren 15:51, 30 October 2008 (UTC)


 * Thanks. By the way, I added Semantic Forms to my website and it works great!  Judson November 2, 2008