Semantic Maps

Default Display
Semantic Maps can be used to as a form input fields to the Semantic Forms extension. Simply set 'input type=map' to the Form field.

By default, the map displays at a global zoom level centered on the coordinates 0,0 with a map marker near 0,0. Depending on the scenario, it may be appropriate to change the zoom and center default map display settings. The Semantic Maps extension offers map form input properties to control this behavior.

To center your map, pass the property 'center' followed by the coordinates in your field instantiation. Such as

You may notice nothing has seemed to change. What is happening here is that Semantic Maps is still setting the zoom to a global scale, even if 'zoom' is passed as a map property to the form input field. To rectify this situation, you will need to change a small part of the PHP code. The file that needs to be changed is $IP/extensions/SemanticMaps/FormInputs/SM_FormInput.php. There may be version incompatibility issues at work here.

In the function 'setZoom', comment out the conditional statement, except the line where '$this->zoom - $this->defaultZoom'. The defaultZoom value is set in your global variables (eg, $egGoogleMapZoom). You may either change this global variable or set $this->defaultZoom just before setting $this->zoom.

Once this is set, you will have a map centered correctly around your focus area at the appropriate zoom level without a marker on the map.

Coordinate bug
When using the map input in a Form, you may notice that the value of the coordinate field (which is populated by the map input geo-coding event, such as clicking on a point on the map) contains strange characters. These strange characters correlate to the degrees symbol (°). However, the mapping engine will have difficulty interpreting the strange coordinate values. This will cause erratic behavior. For example, the coordinates in the screen shot may be mapped to a location in China, not Montgomery County, Maryland.

To fix this, you will have to tell Semantic Maps not to convert the Cartesian coordinates to DMS. This will involve editing the map functions for the mapping service you are using (Semantic Map sets variable '$this->showAddresFunction' to geo-coding function based on mapping service used)
 * Google Maps
 * 1) edit $IP/extensions/SemanticMaps/GoogleMaps/SM_GoogleMapsFunctions.js
 * 2) under , comment out the line beginning with   and add the line: document.getElementById(outputElementName).value= point.y + ', ' + point.x;
 * 3) under , comment out the line beginning with   and add the line: document.getElementById(locationFieldName).value= point.y + ', ' + point.x;
 * OpenLayers
 * 1) edit $IP/extensions/SemanticMaps/OpenLayers/SM_OpenLayersFunctions.js
 * 2) under  ,
 * Yahoo
 * 1) edit $IP/extensions/SemanticMaps/YahooMaps/SM_YahooMapsFunctions.js
 * 2) under  ,
 * 1) under  ,

Data format
To change the returned format of the coordinates (default is set to DMS) you will have to make changes to the  function in   as defined in the SemanticMaps extensions. overwrites  in SemanticMediaWiki (for versions <1.5.0).

In the case of the Bus Stop Knowledgebase System‎, the default will be overwritten to just display the raw lat/long values. To do so, replace the code within conditional beginning with  with: if ($lat) { return $this->m_lat; } else { return $this->m_long; }