Skip to main content
1-Visitor
December 7, 2015
Question

Reset marker on Googlemap if selected location is 0000 : 0000

  • December 7, 2015
  • 4 replies
  • 5850 views

Hi,

I have a mashup where I need to locate on map the position of connected devices.

Now i've got 2 devices.

The first have a real location : it is diplayed on my googlemap with a marker.

The 2nd have no location, the value is 0.0000 : 0.0000.


When I select the 2nd device, the marker on the map does not reset -> i still view the location of 1st device 

I've got other properties which are updated fine by mey GetProperties call. 

How can I make reset my googlemap if there is no real location ? I don't find any option to do this on the widget.

I have found this function below on the google developper's website. But how can I implement it on my Mashup ?

// Deletes all markers in the array by removing references to them.
function deleteMarkers() {
  clearMarkers
();
  markers
= [];

}


Thanks for your help



    4 replies

    5-Regular Member
    December 7, 2015

    Gaelle, I believe 0.0000 : 0.0000 points to no location at all; which is why you don't see the marker move anywhere. If you want to hide the markers if there is no location, you could possibly write a service with output set to either true or false and bind that to the 'ShowMarkers' property. If the service outputs false in case of no location, the marker would simply disappear. Does this make sense?

    gpaillot1-VisitorAuthor
    1-Visitor
    December 7, 2015

    Hi Annjan, it's a good idea, thank you ! I will do this tomorrow morning and come back to tell the result !

    Thanks again

    5-Regular Member
    December 7, 2015

    No problem, let me know how it works out

    1-Visitor
    December 9, 2015

    By the way, what is the behaviour expected, what do you mean by "reset the map" ?

    With ShowMarkers, if the location is not found, nothing will be display. Do you want to display all the location valid, except the invalid one ?

    If "reset the map" means center the map to a default location, the invalid location could be replaced by the default location.

    gpaillot1-VisitorAuthor
    1-Visitor
    December 9, 2015

    I want to display all the location valid, except the invalid one.

    Today, when i select a thing with an invalid location, just after a thing with a valid location, the GMAP still displays the valid location of the previous object.

    gpaillot1-VisitorAuthor
    1-Visitor
    December 9, 2015

    I think i was not clear, i want to display location on my map, one by one, depending on the thing selected.

    I don't bind "all data" of GetImplementThingWithData on my map.

    I bind it with my property gpsLocation of the SelectedRow of the GetProperty service.

    gpaillot1-VisitorAuthor
    1-Visitor
    December 16, 2015

    Hi all,

    Just to keep you inform and thanks for your help : I have opened a ticket to the PTC support, and after reproducing my issue, I've got the confirmation that it is a bug.

    5-Regular Member
    December 16, 2015

    For everyone interested in this topic the coordinates 0,0 are in fact valid but there is a small bug in the GoogleMap Widget that prevents the map from showing a marker at that location (in the center of an ocean). You can see that the map associated with the LocationPicker Widget does in fact render that as a valid point. There is a JIRA submitted against the issue, but in the mean-time, if anyone needs this location to be marked for whatever reason you can always go in and modify Widgets yourself. Keep in mind that we will not support anything that is broken in the process with the Widget, but if you feel comfortable changing it and actually need that coordinate feel free to modify the code.