[OpenLayers-Users] Showing points from a database
Niccolò Dal Santo
ncl.dalsanto at gmail.com
Fri Sep 19 06:45:31 PDT 2014
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
ncl.dalsanto at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/openlayers-users/attachments/20140919/781dddfd/attachment.html>
More information about the Users
mailing list