[OpenLayers-Users] How to display a specific place ?

Ravi Krishna ravikrishna at qburst.com
Mon May 17 05:06:58 EDT 2010


Hi,
Thanks for ur reply..but it didnt work with me.. I am posting the code of my
map. Can u please edit it and send me the working code which comes with some
specified place when we open it..:)
Ravi

<html>
<head>
  <script src="
http://maps.google.com/maps?file=api&v=2&key=ABQIAAAACEqFvKuI3jg904cT0XlYjhTpH3CbXHjuCVmaTc5MkkU4wO1RRhSu36OAUnbWUv-uMRvzw0s82T09xg"
type="text/javascript"></script>
  <title>OpenLayers Example</title>
    <script
    src="/root/Desktop/OpenLayers-2.8-rc5/OpenLayers.js"></script>
    </head>
    <body>
      <div style="width:100%; height:100%" id="map"></div>
      <script defer="defer" type="text/javascript">
        var map = new OpenLayers.Map('map');
        var wms = new OpenLayers.Layer.WMS( "OpenLayers WMS",
            "http://labs.metacarta.com/wms/vmap0", {layers: 'basic'} );
    var google = new OpenLayers.Layer.Google( "Google", { type: G_HYBRID_MAP
} );map.addLayer(google);
        map.addLayer(wms);
        map.zoomToMaxExtent();
      </script>

</body>
</html>

2010/5/17 Ramón Boza [via OSGeo.org] <
ml-node+5063890-1564863673-541374 at n2.nabble.com<ml-node%2B5063890-1564863673-541374 at n2.nabble.com>
>

> Hello,
>
> There are different approaches you can use to solve this.
>
> 1) As you are looking to represent on a map a concrete projection, is to
> have the coordinates (BBox in latlon, center in latlon and zoom for
> googlemaps) hardcoded in like a datamodel of your app.
>
> So when you want to use them just
> map.setCenter(centerLatLon,zoomlvl,MapType.NORMAL_MAP_TYPE);
>
> 2) When working with different coordinate systems, like myself
> (epsg:23031), when you want to transform that coordinates to google ones you
> have to use one functionality, implemented by yourself.
>
> googleLatLon = UTM2LatLon(myBBoxInUTM);
> zoomLvl = getZoomForGoogleBBox(googleLatLon);
>
> BTW it will not be stranger that someone implemented some webservice or so
> that given a name, like 'india' returns you the information needed to its
> representation, google can have that webservice itself, really I always work
> with 23031 so didn't searched for.
>
> Ramón Boza
> Programador
> [hidden email] <http://user/SendEmail.jtp?type=node&node=5063890&i=0>
>
> Avda. Meridiana, 30-32 - 08018 Barcelona (Spain)
> Tel: +34 93 320 82 15 - Fax: +34 93 485 57 77
> www.sitep.com - [hidden email]<http://user/SendEmail.jtp?type=node&node=5063890&i=1>
>   Abans d’imprimir aquest correu, assegura’t que és del tot necessari. El
> medi ambient és cosa de tots!
> AVISO DE CONFIDENCIALIDAD
>
> Este mensaje va dirigido, de manera exclusiva, a su destinatario y contiene
> información confidencial y sujeta al secreto profesional, cuya divulgación
> no está permitida por la ley. En caso de haber recibido este mensaje por
> error, le rogamos que, de forma inmediata, nos lo comunique mediante correo
> electrónico remitido a nuestra atención y proceda a su eliminación, así como
> a la de cualquier documento adjunto al mismo. Asimismo, le comunicamos que
> la distribución, copia o utilización de este mensaje, o de cualquier
> documento adjunto al mismo, cualquiera que fuera su finalidad, están
> prohibidas por la ley.
>
> INFORMACION RELATIVA A LA LOPD
>
> En cumplimiento de la Ley Orgánica 15/1999 de Protección de Datos de
> Carácter Personal (LOPD), le informamos de que sus datos de contacto han
> sido incorporados en ficheros titularidad de Sistemas de Información
> Territorial y Posicionamiento S.L., que responden a la finalidad de servir
> de directorio o agenda de contactos, así como para facilitar la gestión
> administrativa y comercial desarrollada por la empresa. Usted tiene la
> posibilidad de ejercer los derechos de acceso, rectificación, cancelación y
> oposición previstos en la ley, mediante carta dirigida a Sistemas de
> Información Territorial y Posicionamiento S.L., Ref. Protección de datos,
> C/Avda. Meridiana nº 30-32 Escalera B, Entresuelo 2ª, 08018-Barcelona.
>
> -----Mensaje original-----
> De: [hidden email] <http://user/SendEmail.jtp?type=node&node=5063890&i=2>[mailto:[hidden
> email] <http://user/SendEmail.jtp?type=node&node=5063890&i=3>] En nombre
> de Ravi Krishna
> Enviado el: lunes, 17 de mayo de 2010 8:29
> Para: [hidden email]<http://user/SendEmail.jtp?type=node&node=5063890&i=4>
> Asunto: [OpenLayers-Users] How to display a specific place ?
>
>
> Hi,
> I am a beginner with Openlayers. I tried out the tutorials and could
> display
> maps from metacarta. Now i am trying to display google maps inside
> OpenLayers. i could display the google maps.., but how can i display a
> specif portion of map when it comes first. eg: how can i display India when
>
> it first shows.
> i will copy the code below :
>
> <html>
> <head>
> <script src="/root/Desktop/OpenLayers-2.8-rc5/OpenLayers.js"></script>
> <script type="text/javascript">
>  var map;
>  function init() {
> map_controls = [ new OpenLayers.Control.OverviewMap(),new
> OpenLayers.Control.LayerSwitcher(),new OpenLayers.Control.PanZoomBar(),new
> OpenLayers.Control.MouseToolbar(),new
> OpenLayers.Control.KeyboardDefaults()];
> var map = new OpenLayers.Map('map', { controls: map_controls });
> var wms = new OpenLayers.Layer.WMS(
> "Ravi's OpenLayers WMS",
> "
> http://maps.google.com/maps/api/staticmap?center=63.259591,-144.667969&zoom=6&size=400x400\
>
> &markers=color:blue|label:S|62.107733,-145.541936&markers=size:tiny|color:green|Delta+Junction,AK\&markers=size:mid|color:0xFFFF00|label:C|Tok,AK&sensor=false",{layers:
>
> 'basic'});
> map.addLayers([wms]);
> map.zoomToMaxExtent();
> }
> </script>
> </head>
>  <body onload="init()">
> <div id="map" style="width: 600px; height: 350px"></div>
> </body>
>
> --
> View this message in context:
> http://osgeo-org.1803224.n2.nabble.com/How-to-display-a-specific-place-tp5063850p5063850.html
> Sent from the OpenLayers Users mailing list archive at Nabble.com.
> _______________________________________________
> Users mailing list
> [hidden email] <http://user/SendEmail.jtp?type=node&node=5063890&i=5>
> http://openlayers.org/mailman/listinfo/users
>
> Se certificó que el correo entrante no contiene virus.
> Comprobada por AVG - www.avg.es
> Versión: 9.0.819 / Base de datos de virus: 271.1.1/2872 - Fecha de la
> versión: 05/16/10 20:26:00
>
>
> _______________________________________________
> Users mailing list
> [hidden email] <http://user/SendEmail.jtp?type=node&node=5063890&i=6>
> http://openlayers.org/mailman/listinfo/users
>
>
> ------------------------------
>  View message @
> http://osgeo-org.1803224.n2.nabble.com/How-to-display-a-specific-place-tp5063850p5063890.html
> To unsubscribe from How to display a specific place ?, click here<http://osgeo-org.1803224.n2.nabble.com/subscriptions/Unsubscribe.jtp?code=cmF2aWtyaXNobmFAcWJ1cnN0LmNvbXw1MDYzODUwfDEwODY3NjQzMTg=>.
>
>
>

-- 
View this message in context: http://osgeo-org.1803224.n2.nabble.com/How-to-display-a-specific-place-tp5063850p5064217.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20100517/9cbb8852/attachment.html


More information about the Users mailing list