title: How to refresh gmap markers in primefaces p:gmap after updating the gmap with new markers
body: <p>I have problem on a project with Gmap component of Primefaces 3.5 I'm using JSF2.0.
  I have this command Button that do filtering on the markers and most important updates mapForm</p>
  
  <pre><code>&lt;h:form id="epsFilterForm"&gt;
        &lt;p:commandButton action="#{mapMB.filterProjects}" value="#{bundle['filter'] }" update=":mapForm" /&gt;
  &lt;/h:form&gt;
  </code></pre>
  
  <p>mapForm:</p>
  
  <pre><code>&lt;h:form id="mapForm"&gt;  
  &lt;p:gmap id="googleMap" center="48.849988,2.3805715" zoom="11"  type="TERRAIN" fitBounds="false" model="#{mapMB.advancedModel}" 
      widgetVar="wmap" style="width:1000px;height:700px;display: inline-block;" &gt;
  
      &lt;p:ajax event="overlaySelect"  listener="#{mapMB.onMarkerSelect}" /&gt;   
      &lt;p:gmapInfoWindow&gt;  
          &lt;p:outputPanel style="text-align:center;display:block;margin:auto:"&gt;
              &lt;p:panelGrid columns="2" styleClass="InfoTable" &gt;
  
                  &lt;p:outputLabel value="#{bundle['ep.operation.name'] }" /&gt;
                  &lt;p:outputLabel value="#{mapMB.selectedEp.opName}" /&gt;
              &lt;/p:panelGrid&gt;
          &lt;/p:outputPanel&gt;  
      &lt;/p:gmapInfoWindow&gt; 
  &lt;/p:gmap&gt;
  </code></pre>
  
  <p> </p>
  
  <p>MapMB - scope - Session scope
  populateAdvancedModel()</p>
  
  <pre><code>public void populateAdvancedModel(List&lt;EP&gt; eps) {
      advancedModel = new DefaultMapModel();
      int count = 0;
      Marker marker;
      for (EP ep :eps) {
          //advancedModel.addOverlay(new Marker(coord1, "Konyaalti", "konyaalti.png", "http://maps.google.com/mapfiles/ms/micons/blue-dot.png"));
          System.out.println("Integer.toString(ep.getId()):"+Integer.toString(ep.getId()));
          marker =  new Marker(new LatLng(  Double.parseDouble(ep.getLatitude()) ,  Double.parseDouble(ep.getLongitude())));
          marker.setTitle( Integer.toString(count));
          advancedModel.addOverlay(marker);
          count++;
      }
  }
  </code></pre>
  
  <p>filterProjects()</p>
  
  <pre><code>public String filterProjects() {
      //FilterMB filterMB = (FilterMB) JSFUtil.getManagedObject("filterMB");
      eps = EPDAO.filterEPs(client, architect, realizationType, state, selectedCert);
      populateAdvancedModel(eps);
      return null;
  }
  </code></pre>
  
  <p>onMarkerSelect()</p>
  
  <pre><code>public void onMarkerSelect(OverlaySelectEvent event) {
      Marker marker = (Marker) event.getOverlay();
      String markerTitle = marker.getTitle();
      selectedEp = eps.get(Integer.parseInt(markerTitle));
  }
  </code></pre>
  
  <p>When I load the page for first time everything is OK. Info (p:gmapInfoWindow ) window is loading and information for EP variable is there. But when I click the command button in epsFilterForm (that has some input fields that i haven't posted here) the map is updated and the filtered markers are there and they obviously have title when i hover on them, but overlaySelect event is not working in the same way. I thing that when page is loading for the first time there is some initial script that puts that behavior on the markers but when I refresh the map this initial script is not running again and that's is why when I click on the marker and overlaySelect event is fired I have null pointer Exception in onMarkerSelect() method (marker is null).      <strong>IMPORTANT</strong> - this is working without a problem on local server but when I deploy it to google app engine it's working as i described above.</p>