Hello, I'm relatively new to OpenLayers and having a problem with a
relatively basic setup...

I'm using the Google Base Maps and trying to add a point feature to the map
at point -70.84480 and -53.00471. (The airport in Punta Arenas, Chile). When
I add the point, the blue star appears at the correct longitude, but at an
incorrect latitude.  Furthermore, the point moves when I drag the map up or
down, jumping to a different latitude when the mouse button is released.
Additionally, when the map is dragged far enough to the right/east, the
point disappears.

I've tried using point.transform of the point geometry and changing the
projection on the vector layer, and been unable to fix this behavior.  I'm
sure I'm missing something relatively simple, but I'm new to this and after
two days of digging around the documentation and examples, I'm not sure what
it is.  Any suggestions would be appreciated.

The code can be found at: http://128.177.27.207/display.html

or:

                var layer_style = OpenLayers.Util.extend({},
                OpenLayers.Feature.Vector.style['default']);
                layer_style.fillOpacity = 0.2;
                layer_style.graphicOpacity = 1;

                var style_blue = OpenLayers.Util.extend({}, layer_style);
                style_blue.strokeColor = "blue";
                style_blue.fillColor = "blue";
                style_blue.graphicName = "star";
                style_blue.pointRadius = 10;
                style_blue.strokeWidth = 3;
                style_blue.rotation = 45;
                style_blue.strokeLinecap = "butt";

                var options = {
                    projection: new OpenLayers.Projection("EPSG:900913"),
                    units: "m",
                    numZoomLevels: 18,
                    maxResolution: 'auto',
                    maxExtent: new OpenLayers.Bounds(-20037508, -20037508,
                                             20037508, 20037508.34),
                    sphericalMercator: true
                };

                var map = new OpenLayers.Map('map', options);

                var google_physical =
                    new OpenLayers.Layer.Google("Google Physical",
                        {type: G_PHYSICAL_MAP});
                var google_sattelite =
                    new OpenLayers.Layer.Google("Google Satellite",
                        {type: G_SATELLITE_MAP});
                var google_hybrid =
                    new OpenLayers.Layer.Google("Google Hybrid",
                        {type: G_HYBRID_MAP});

                map.addLayers([google_sattelite,
                               google_physical, google_hybrid]);

                map.addControl(new OpenLayers.Control.LayerSwitcher());
                map.addControl(new OpenLayers.Control.MousePosition());
                map.addControl(new OpenLayers.Control.KeyboardDefaults());

                map.setCenter(new OpenLayers.LonLat(-13200000, 4500000), 5);
                map.zoomToMaxExtent();

                var vectorLayer =
                    new OpenLayers.Layer.Vector("Aircraft Location");

                var point = new OpenLayers.Geometry.Point(-70.84480, -53.00471);

                var feature = new OpenLayers.Feature.Vector(
                    point,
                    null,
                    style_blue);

                vectorLayer.addFeatures(feature);
                map.addLayer(vectorLayer);




David Van Gilst
DC-8 Network Engineer
National Suborbital Education and Research Center
University of North Dakota
(701) 330-2978
[email protected]
_______________________________________________
Users mailing list
[email protected]
http://openlayers.org/mailman/listinfo/users

Reply via email to