using plain text or (geo) json is much less error prone than using GML, and probably gives better performance
2014-09-19 15:45 GMT+02:00 Niccolò Dal Santo <[email protected]>: > Hi there, > > I am new of Openlayers and I need to show some points that come from a > database on a map centred in Turin (Italy), with some information related to > this point (for instance an image). Searching on line I have found that > Openlayers supports many formats of data like GML, KML, GeoJSON and many > others. Could you suggest a format useful fror my problem and maybe some > examples of how to use it? > > I have tried with this code generating a map of europe, but it doesn't work > > <html> > <head> > <title>Prova GML</title> > <script src="http://openlayers.org/api/OpenLayers.js"></script> > </head> > <body> > <div id="ch3_gml" style="width: 100%; height: 100%;"></div> > > <script type="text/javascript"> > > // Create the map using the specified DOM element > var map = new OpenLayers.Map("ch3_gml"); > > var layer = new OpenLayers.Layer.OSM("OpenStreetMap"); > map.addLayer(layer); > > map.addControl(new OpenLayers.Control.LayerSwitcher()); > map.setCenter(new OpenLayers.LonLat(0,0), 2); > > map.addLayer(new OpenLayers.Layer.Vector("Europe (GML)", { > protocol: new OpenLayers.Protocol.HTTP({ > url: "./europe.gml", > format: new OpenLayers.Format.GML() > }), > strategies: [new OpenLayers.Strategy.Fixed()] > })); > </script> > </body> > </html> > > where europe.gml is a gml file in the same folder of this script, but > nothing happens. > > Thank you very much for your help! > > Regards > > Niccolò > > -- > Niccolò Dal Santo > +39 342 15 70 842 > [email protected] > > _______________________________________________ > Users mailing list > [email protected] > http://lists.osgeo.org/mailman/listinfo/openlayers-users -- Disclaimer; This message is just a reflection of what I thought at the time of sending. The message may contain information that is not intended for you or that you don't understand. _______________________________________________ Users mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/openlayers-users
