[Users] simple vector problems

Matt Priour mpriour at kestrelcomputer.com
Sat Apr 24 04:51:27 CEST 2010


You need the div reference in your map constructor.

var map = new OpenLayers.Map('gxmap');



From: shaun.anderson at verizon.net 
Sent: Friday, April 23, 2010 8:06 PM
To: users at geoext.org 
Subject: [Users] simple vector problems


Hi All,

I am new to GeoExt. I have been trying to use the tutorials and examples, but I can't seem to get past a simple problem.

I tried to use this simple vector display code from the tutorial, and it doesn't work in Firefox or IE.

<html>
<head>
<title> A Basic GeoExt Page </title>
<script src="ext-3.2.0/adapter/ext/ext-base.js" type="text/javascript"></script>
<script src="ext-3.2.0/ext-all.js"  type="text/javascript"></script>
<script src="OpenLayers/OpenLayers.js" type="text/javascript"></script>
<script src="GeoExt/script/GeoExt.js" type="text/javascript"></script>
<script type="text/javascript">
var vectorLayer = new OpenLayers.Layer.Vector();
for (var i = 0; i < 10; i++){
    var x = -180 + Math.random() * 360;
    var y = -90 + Math.random() * 180;
    var numSides = 3 + Math.round(Math.random() * 6);
    vectorLayer.addFeature(
        new OpenLayers.Feature.Vector(
            OpenLayers.Geometry.Polygon.createRegularPolygon(
                new OpenLayers.Geometry.Point(x, y),
                numSides)));
}
var map = new OpenLayers.Map();
map.addLayer(vectorLayer);
 </script>
</head>
<body>
<div id="gxmap"></div>
</body>
</html>

I've tried some other examples to try and display KML and GML files but they haven't worked. Actually the Sundials example worked when I had the WMS baselayer and the GML,  but when I commented out the baselayer, the GML wouldn't show by itself. Can you display a KML/GML file by itself without a WMS baselayer?

Any help would be appreciated.
Thanks



--------------------------------------------------------------------------------


_______________________________________________
Users mailing list
Users at geoext.org
http://www.geoext.org/cgi-bin/mailman/listinfo/users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.geoext.org/pipermail/users/attachments/20100423/3df57f24/attachment.htm 


More information about the Users mailing list