[OpenLayers-Users] Help with OpenLayer + Google Maps
Pedro Baracho
pedropbaracho at gmail.com
Mon Nov 16 09:28:12 EST 2009
var gmap = new OpenLayers.Layer.Google(
"Google Streets", // the default
{"sphericalMercator": true ,numZoomLevels: 20}
);
var vector_layer = new OpenLayers.Layer.Vector("title", {Projection: new
OpenLayers.Projection("EPSG:4326")});
On Mon, Nov 16, 2009 at 1:20 PM, hekuran S. Doli <
hekuran.doli at logisticsplus-ks.com> wrote:
> I'm using google map as layer in openlayer. I'm trying to add an point in
> the map as in example http://www.logisticsplus-ks.com/testmap/. I'm
> successfully adding the point in the map but when I move the map the point
> changes the position. So it does not stay at the coordinates that I give it.
>
>
> By the way the functions works perfectly with openstreet map, but not with
> google maps.
>
> In the following is the code that I'm using:
>
> <script type="text/javascript">
> var map;
>
>
>
> function init() {
> map = new OpenLayers.Map('map');
> map.addControl(new OpenLayers.Control.LayerSwitcher());
>
> var gmap = new OpenLayers.Layer.Google(
> "Google Streets", // the default
> {numZoomLevels: 20}
> );
>
> map.addLayers([gmap]);
>
> map.setCenter(new OpenLayers.LonLat(21.159739, 42.656138), 10);
> }
> var featurecollection = {"type":"Feature",
> "id":"OpenLayers.Feature.Vector_173", "properties":{},
> "geometry":{"type":"Point", "coordinates":[21.159739, 42.656138]}};
> function addGeoJson() {
> var geojson_format = new OpenLayers.Format.GeoJSON();
> var vector_layer = new OpenLayers.Layer.Vector();
> map.addLayer(vector_layer);
>
> //vector_layer.addFeatures(geojson_format.read(featurecollection));
>
> vector_layer.addFeatures(geojson_format.read(featurecollection));
> }
> </script>
>
> Any help would be appreciable.
> Thanks in advance,
> Hekuran
>
>
>
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20091116/b5bad381/attachment.html
More information about the Users
mailing list