<div>Hello all,</div><div><br></div><div>I have a quick question regarding the map.setcenter function. I&#39;m piecing together a script, and at the moment, I just want it to center my map on these particular coordinates 39.427,-91.324, prior to implementing the geolocation feature. I&#39;m not sure what I&#39;m doing wrong, but the map seems to zoom to the max extent, which shows empty map space on the top and bottom of the screen. So, I&#39;m not sure what I&#39;m doing wrong with this, but I&#39;d appreciate any pointers, or help.</div>
<div>best, code is below, the section I&#39;m concerned with is at line 33.</div><div><br></div><div>Thanks in advance.</div><div><br></div><div>function getLoc(){</div><div>if (Modernizr.geolocation) {</div><div> navigator.geolocation.getCurrentPosition(showMap,handle_error);</div>
<div>} else {</div><div>yqlgeo.get(&#39;visitor&#39;,norm_yql_resp);</div><div>}</div><div>}</div><div><br></div><div><br></div><div>function showMap(position)</div><div>{</div><div>alert(&#39;Lat: &#39; + position.coords.latitude + &#39; &#39; + &#39;Lon: &#39; + position.coords.longitude + &#39; &#39; + &#39;Acc: &#39; + position.coords.accuracy);</div>
<div><br></div><div>var map = new OpenLayers.Map(&#39;map&#39;,</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>{controls:[</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>new OpenLayers.Control.Navigation(),</div>
<div><span class="Apple-tab-span" style="white-space:pre">                        </span>new OpenLayers.Control.PanZoomBar(),</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>new OpenLayers.Control.LayerSwitcher(),</div>
<div><span class="Apple-tab-span" style="white-space:pre">                        </span>new OpenLayers.Control.Attribution(),</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>new OpenLayers.Control.OverviewMap()],</div>
<div><span class="Apple-tab-span" style="white-space:pre">                        </span>sphericalMercator: true,</div><div>  <span class="Apple-tab-span" style="white-space:pre">                </span>maxExtent: new OpenLayers.Bounds(-20037508.34,-20037508.34,20037508.34,20037508.34),</div>
<div>  <span class="Apple-tab-span" style="white-space:pre">                </span>maxResolution: 156543.0399,</div><div>  <span class="Apple-tab-span" style="white-space:pre">                </span>numZoomLevels: 21,</div><div>  <span class="Apple-tab-span" style="white-space:pre">                </span>units: &#39;m&#39;,</div>
<div>  <span class="Apple-tab-span" style="white-space:pre">                </span>projection: new OpenLayers.Projection(&quot;EPSG:900913&quot;),</div><div>  <span class="Apple-tab-span" style="white-space:pre">                </span>displayProjection: new OpenLayers.Projection(&quot;EPSG:4326&quot;)</div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span>}</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>);</div><div><br></div><div>var google_map = new OpenLayers.Layer.Google(&#39;Google Hybrid&#39;,{type: google.maps.MapTypeId.HYBRID});</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>    map.addLayer(google_map);</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>map.setCenter(new OpenLayers.LonLat(39.427,-91.324).transform(new OpenLayers.Projection(&quot;EPSG:4326&quot;),map.getProjectionObject(),16));</div>
<div>}</div><div><br></div><div>function handle_error(error) {</div><div>  switch(error.code){</div><div>  case error.PERMISSION_DENIED: alert(&quot;This application reguires you to agree to share your location. Please reload the page to see it work properly. There is a privacy disclaimer at the bottom of this page. This site does not currently record or store these data, and in the future will not record unique user information without informing the user or asking their permission. -Virtual Spatiality&quot;);</div>
<div>  break;</div><div>  </div><div>  case error.POSITION_UNAVAILABLE: alert(&quot;could not determine position&quot;);</div><div>  break;</div><div>  </div><div>  case error.TIMEOUT: alert(&quot;timeout retrieving position&quot;);</div>
<div>  break;</div><div>  </div><div>  default: alert(&quot;unknown error&quot;);</div><div>  break;</div><div>  }</div><div>}</div><div>function norm_yql_resp(response){</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>if (response.error) {</div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span>var error = {code : 0};</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>handle_error(error);</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>return;</div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span>}</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>var position = {</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>coords:</div>
<div><span class="Apple-tab-span" style="white-space:pre">                        </span>{</div><div><span class="Apple-tab-span" style="white-space:pre">                                </span>latitude: response.place.centroid.latitude,</div><div><span class="Apple-tab-span" style="white-space:pre">                                </span>longitude: response.place.centroid.longitude</div>
<div><span class="Apple-tab-span" style="white-space:pre">                        </span>},</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>address :</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>{</div>
<div><span class="Apple-tab-span" style="white-space:pre">                                </span>city: response.place.locality2.content,</div><div><span class="Apple-tab-span" style="white-space:pre">                                </span>region: response.place.admin1.content,</div>
<div><span class="Apple-tab-span" style="white-space:pre">                                </span>country: response.place.country.content</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>}</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>};</div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span>handle_geolocation_query(position);</div><div>}</div><div><span class="Apple-tab-span" style="white-space:pre">        </span></div><div><span class="Apple-tab-span" style="white-space:pre"><br>
</span></div>