OwnTracks Google map v3 won't pinpoint location


I seem to be having an issue when following the instructions here: https://github.com/openhab/openhab/wiki/GoogleMap

I cannot ever seem to get a pin drop in the map to identify my location. Owntracks reports it, and from the mosquitto log, I can see everything is logged in? Below are my item and .cfg files ( region based ), and the html site code that I am using. I can’t seem to figure out what I’m doing wrong, and I’ve noticed other posts with similar issues. I’d really like to get this working if possible. If anyone can please provide any insight, it would be greatly appreciated.


   /* OwnTracks - Mqttitude Testing Start */

Switch  PresenceRob_PhoneMqtt		"Rob @ Home"	{ mqttitude="mosquitto:owntracks/rhuehn/robphone/event:home" }
Switch  PresenceRob_Work_PhoneMqtt	"Rob @ Work"	{ mqttitude="mosquitto:owntracks/rhuehn/robphone/event:work" }

Location locationRob
String   mqttPositionRobRaw		"Rob Raw Data"   	{ mqtt="<[home:owntracks/rhuehn/robphone:state:default]" }
String   mqttRobLatitude     	"Rob's Lat"
String   mqttRobLongitude    	"Rob's Lon"
String   mqttRobAccuracy     	"Rob's Accuracy"
String   mqttS6Battery      	"Rob's Galaxy S6 Battery [%s%%]"       <battery>   (Phone, MQTT, Battery)


rule "MqttPostionParseRob"
    Item mqttPositionRobRaw	 changed
    val String json = (mqttPositionRobRaw.state as StringType).toString
    // {"_type": "location", "lat": "xx.5010314", "lon": "8.3444293",
    //    "tst": "1422616466", "acc": "xx.05", "batt": "40"}
    val String type = transform("JSONPATH", "$._type", json)
    if (type == "location") {
      val String lat  = transform("JSONPATH", "$.lat", json)
      val String lon  = transform("JSONPATH", "$.lon", json)
      val String acc  = transform("JSONPATH", "$.acc", json)
      val String batt = transform("JSONPATH", "$.batt", json)
      locationRob.postUpdate(new PointType(lat + "," + lon))
      mqttRobAccuracy.postUpdate(new DecimalType(acc))
      mqttS6Battery.postUpdate(new PercentType(batt))


<!DOCTYPE html>
    <style type="text/css"> 
    .Flexible-container {
      position: relative;
      padding-bottom: 0px;
      padding-top   : 0px;
      height        : 345px ;
      overflow: hidden;

    .Flexible-container iframe,   
    .Flexible-container object,  
    .Flexible-container embed {
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script>
    <script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?v=3.exp&libraries=places,drawing,geometry"></script>

    <script type="text/javascript">
        // Google Maps JavaScript API:
        // https://developers.google.com/maps/documentation/javascript/?hl=de
        // Marker Icons:
        // https://sites.google.com/site/gmapsdevelopment/

        // JQuery

        var map = null;
        //make an empty bounds variable
        var bounds = new google.maps.LatLngBounds();

        // LatLng's we want to show 
        var latlngHome   = new google.maps.LatLng("xx.251359", "-xx.738599");
        var latlngRob = new google.maps.LatLng("xx.251359", "-xx.738599"); // initialize to home ...
        var latlngJenna  = new google.maps.LatLng("xx.251359", "-xx.738599"); // initialize to home ...

        var map_options = { center    : latlngHome,
                            zoom      : 10,
                            mapTypeId : google.maps.MapTypeId.ROADMAP };

        $( "#map_canvas" ).ready($(function() {
          var map_canvas = document.getElementById('map_canvas');
          map = new google.maps.Map(map_canvas, map_options)

          var marker = new google.maps.Marker({
                            position  : latlngHome,
                            map       : map,
                            icon      : 'http://maps.google.com/mapfiles/kml/pal2/icon10.png',
                            title     : "City"

           var circle = new google.maps.Circle({
                        center        : latlngHome,
                        radius        : 500,
                        map           : map,
                        strokeColor   : '#050505',
                        strokeOpacity : 0.5,
                        strokeWeight  : 2,
                        fillColor     : '#000000',
                        fillOpacity   : 0,
                      }); // end of [Circle]


        $( document ).ready($(function() {
            // ******************************************************************************
              url     : "",
              data    : {},
              success : function( data ) {
                  if ( map == null) { return; }
                  if ( data == "Uninitialized") { return; }

                  var coords = data.split(',');
                  var latlngRob = new google.maps.LatLng(coords[0],coords[1]);

                  var marker = new google.maps.Marker({
                    position  : latlngRob,
                    map       : map,
                    icon      : 'http://maps.google.com/mapfiles/ms/icons/green-dot.png',
                    title     : "Rob"
                  }) // end of [Marker]

                    url     : "../rest/items/mqttRobAccuracy/state/",
                    data    : {},
                    success : function( data ) {
                    if ( data == "Uninitialized") { return; }
                      var accuracy = parseInt(data);
                      var circle = new google.maps.Circle({
                        center        : latlngRob,
                        radius        : accuracy,
                        map           : map,
                        strokeColor   : '#00FF00',
                        strokeOpacity : 0.8,
                        strokeWeight  : 2,
                        fillColor     : '#00FF00',
                        fillOpacity   : 0.35,
                      }); // end of [Circle]


                    } // end of [function]
                  }) // end of [$.ajax]
                } // end of [function]
            }) // end of [$.ajax]
            // ******************************************************************************
    <div id="map_canvas" class="Flexible-container" />


what response to you get if you just enter the URL “” in a browser inside your home network?

If this returns coordinates as expected I recommend to open just the map (in my case" in google chrome and to enable debug mode (I have a german system - this I do not know how it is called in English - but Ctrl+Shift+I should be the shortcut).

This will enable you to verify if there’s a syntax problem and to actually debug the thing … but first things first: to you get the coordinates with the URL?

with kind regards,

Hello @patrik_gfeller

Thanks very much for the reply! Really appreciated. When I open just the URL like you mentioned above, I am only getting " Uninitialized" on the page, so something is not working properly it looks like, I just can’t determine what unfortunately. If you have any thoughts it would be GREATLY appreciated.

My items and HTML code is almost a copy and paste from the Google v3 link, and I’m still getting " Uninitialized " and can’t seem to see any error. Is there any other reason perhaps it returns " Uninitialized"?


please make sure that your rules file contains the following line @ the beginning:
import org.openhab.core.library.types.*

You may also want to add log lines to the rule to see if it is called at all; and how far it is processed; e.g.:

logInfo(“mqtt.rules”, “Position update - Patrik (” + mqttPositionPatrikRaw.state + “)”)

Hey @patrik_gfeller

Thanks very much for your reply. I got it working, it was an issue with my broker. Thanks for your suggestions!

Can you elaborate on your broker settings? I seem to be geting a similar result to you and can’t figure it out.

I’m also having the same problem.

The problem is related to OpenHab, the String length for the field in postUpdate must not exceed 30 bytes, and iPhone or iOS in general replies with up to 17 byte for each parameter

so in the rule file you must update

locationRob.postUpdate(new PointType(lat + “,” + lon))


locationRob.postUpdate(new PointType(lat.substring(0,14) + “,” + lon.substring(0,14)))

resulting in 29 bytes to be stored

Hope this solves your problem

Samir Tafesh

Hi @shep

Could you please specify?
I assume I did not translate the mqtt setting correctly into my case:

I am using successfully:
Switch Loc_Home_NCO "NCO@Home" { mqttitude="mosquitto:owntracks/mosquitto/NCOs_iPhone/event:Home" }

accordingly I tried:
String mqttPositionNCORaw "NCOs Position" { mqtt="<[home:owntracks/mosquitto/NCOs_iPhone:state:default]" }

I still get “Uninitialized” and think I possibly messed up the syntax of the Raw Position.
Any suggestion?

Dear NCO,

Try to list the subcribed clients to Mosquitto

open an SSH terminal, and connect to your server hosting the Mosquitto server
then issue the following command, the # , is to list all subscribers

mosquitto_sub -h mosquittoServerIP -p 8883 -v -t ‘#’ -u username -P password

once your client connects
use the full subject in your .item,

String mqttPositionNCORaw “NCOs Position” { mqtt="<brokerName:fullSubject:state:default]" }

and in the .rule you update accordingly

Samir Tafesh

Thanks for your help @SamirTafesh,

I checked the events.log and found out, that it was ok after playing around with the syntax of my item:
{ mqtt="<[mosquitto:owntracks/mosquitto/NCOs_iPhone:state:default]" }
Now it’s working fine.

Obviously it’s working properly in Safari, but not in the iOS app. The latter just shows the map, but in most cases not the pins.

I think it has to do with loading order.