[Users] simple vector problems

Bart van den Eijnden bartvde at osgis.nl
Sat Apr 24 08:43:17 CEST 2010


Make sure you only create your vector layer in the onload handler of <body>.

Best regards,
Bart

On Apr 24, 2010, at 3:06 AM, shaun.anderson at verizon.net wrote:

> 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/20100424/6763a8cf/attachment.htm 


More information about the Users mailing list