<div dir="ltr">At first ,thanks a lot for the help.<div><br></div><div>Secondly, I don't know since this is an example downloaded by the internet. However I have tried by inserting this line in my code</div><div><br></div><div><div> map.setCenter(</div><div> new OpenLayers.LonLat(0,0).transform(</div><div> new OpenLayers.Projection("EPSG:4326"),</div><div> map.getProjectionObject()</div><div> ), 1</div><div> );</div></div><div><br></div><div><br></div><div><br></div><div>So, this is my final code:</div><div><br></div><div><div><html></div><div><head></div><div> <title>Prova GML</title></div><div> <script src="<a href="http://openlayers.org/api/OpenLayers.js" target="_blank">http://openlayers.org/api/OpenLayers.js</a>"></script></div><div></head></div><div> <body></div><div><br></div><div><div id="ch3_cluster" style="width: 100%; height: 100%;"></div></div><div><br></div><div><br></div><div> <script type="text/javascript"></div><div><br></div><div><br></div><div> var map = new OpenLayers.Map("ch3_cluster"); </div><div> </div><div> var layer = new OpenLayers.Layer.OSM("OpenStreetMap");</div><div> map.addLayer(layer);</div><div> </div><div> map.addControl(new OpenLayers.Control.LayerSwitcher());</div><div>// map.setCenter(new OpenLayers.LonLat(0,0), 2);</div><div><br></div><div> map.setCenter(</div><div> new OpenLayers.LonLat(0,0).transform(</div><div> new OpenLayers.Projection("EPSG:4326"),</div><div> map.getProjectionObject()</div><div> ), 1</div><div> );</div><div> </div><div> // World Cities</div><div> var citiesLayer = new OpenLayers.Layer.Vector("World Cities (GeoJSON)", </div><div> { protocol: new OpenLayers.Protocol.HTTP({</div><div> url: "<a href="http://localhost/world_cities.json" target="_blank">http://localhost/world_cities.json</a>",</div><div> format: new OpenLayers.Format.GeoJSON()</div><div> }),</div><div> strategies: [</div><div> new OpenLayers.Strategy.Fixed(), </div><div> new OpenLayers.Strategy.Cluster({distance: 15})</div><div> ]</div><div> });</div><div> map.addLayer(citiesLayer);</div><div><br></div><div><br></div><div><br></div><div></script></div><div></body></div><div></html></div></div><div><br></div><div>Now I have also tried with another and easier example found in the web but it doesn't work as well, so I was wondering whether I am missing something like a basic requirement or a Java updating or whatever in order to use these features. What I have done is to download the library ( but the source in this code should be the web as the first script states). Do you have any idea on that?</div><div><br></div><div>Thank you very much!</div><div><br></div><div>Niccolò</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">2014-09-21 19:19 GMT+02:00 Arnd Wippermann <span dir="ltr"><<a href="mailto:arnd.wippermann@web.de" target="_blank">arnd.wippermann@web.de</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><u></u>
<div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial">Hi,</font></span></div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial"></font></span> </div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial">your map is in projection EPSG:900913 (OSM).
</font></span></div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial">Are your data also in this projection or perhaps in EPSG:4326
(lonlat)?</font></span></div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial"></font></span> </div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial">If so, it could be that your data are shown (at x=0,y=0), but
you only can't see them.</font></span></div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial"></font></span> </div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial">Regards,</font></span></div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial">Arnd</font></span></div><br>
<div dir="ltr" lang="de" align="left">
<hr>
<font face="Tahoma"><b>Von:</b> <a href="mailto:openlayers-users-bounces@lists.osgeo.org" target="_blank">openlayers-users-bounces@lists.osgeo.org</a>
[mailto:<a href="mailto:openlayers-users-bounces@lists.osgeo.org" target="_blank">openlayers-users-bounces@lists.osgeo.org</a>] <b>Im Auftrag von </b>Niccolò
Dal Santo<br><b>Gesendet:</b> Freitag, 19. September 2014 23:11<br><b>An:</b>
Mark Prins<br><b>Cc:</b> openlayers-users<br><b>Betreff:</b> Re:
[OpenLayers-Users] Showing points from a database<br></font><br></div><div><div class="h5">
<div></div>
<div dir="ltr">Thank you very much for your answer. I have therefore started to
investigate the possiblity to use the GeoJSON format, and now I am trying to
train with this format with this example but it doesn't work
<div><br></div>
<div>
<div> <script type="text/javascript"></div>
<div><br></div>
<div> var map = new OpenLayers.Map("my_map");<br></div>
<div> </div>
<div> var layer = new OpenLayers.Layer.OSM("OpenStreetMap");</div>
<div> map.addLayer(layer);</div>
<div> </div>
<div> map.addControl(new OpenLayers.Control.LayerSwitcher());</div>
<div> map.setCenter(new OpenLayers.LonLat(0,0), 2);</div>
<div> </div>
<div> var citiesLayer = new OpenLayers.Layer.Vector("World Cities
(GeoJSON)", <br></div>
<div> { protocol: new
OpenLayers.Protocol.HTTP({</div>
<div> url: "<a href="http://localhost/openlayers/world_cities.json" target="_blank">http://localhost/openlayers/world_cities.json</a>",</div>
<div> format: new
OpenLayers.Format.GeoJSON()</div>
<div> }),</div>
<div> strategies: [</div>
<div> new
OpenLayers.Strategy.Fixed(), </div>
<div> new
OpenLayers.Strategy.Cluster({distance: 15})</div>
<div> ]</div>
<div> });</div>
<div> map.addLayer(citiesLayer);</div>
<div></script></div></div>
<div><br></div>
<div>In order to make the protocol work I have installed nginx on my laptop and
the url correctly points to the file world_cities.json in my browser. Anyway
this example doesn't work, any idea why?</div>
<div><br></div>
<div>Thanks! </div>
<div>Niccolò</div></div>
<div class="gmail_extra"><br>
<div class="gmail_quote">2014-09-19 15:54 GMT+02:00 Mark Prins <span dir="ltr"><<a href="mailto:mc.prins@gmail.com" target="_blank">mc.prins@gmail.com</a>></span>:<br>
<blockquote style="BORDER-LEFT:#ccc 1px solid;MARGIN:0px 0px 0px 0.8ex;PADDING-LEFT:1ex" class="gmail_quote">using plain text or (geo) json is much less error prone than
using<br>GML, and probably gives better performance<br>
<div>
<div><br>2014-09-19 15:45 GMT+02:00 Niccolò Dal Santo <<a href="mailto:ncl.dalsanto@gmail.com" target="_blank">ncl.dalsanto@gmail.com</a>>:<br>>
Hi there,<br>><br>> I am new of Openlayers and I need to show some
points that come from a<br>> database on a map centred in Turin (Italy),
with some information related to<br>> this point (for instance an image).
Searching on line I have found that<br>> Openlayers supports many formats
of data like GML, KML, GeoJSON and many<br>> others. Could you suggest a
format useful fror my problem and maybe some<br>> examples of how to use
it?<br>><br>> I have tried with this code generating a map of europe,
but it doesn't work<br>><br>> <html><br>>
<head><br>> <title>Prova
GML</title><br>> <script src="<a href="http://openlayers.org/api/OpenLayers.js" target="_blank">http://openlayers.org/api/OpenLayers.js</a>"></script><br>>
</head><br>> <body><br>>
<div id="ch3_gml" style="width: 100%; height:
100%;"></div><br>><br>> <script
type="text/javascript"><br>><br>> //
Create the map using the specified DOM element<br>>
var map = new OpenLayers.Map("ch3_gml");<br>><br>>
var layer = new
OpenLayers.Layer.OSM("OpenStreetMap");<br>>
map.addLayer(layer);<br>><br>>
map.addControl(new OpenLayers.Control.LayerSwitcher());<br>>
map.setCenter(new OpenLayers.LonLat(0,0),
2);<br>><br>> map.addLayer(new
OpenLayers.Layer.Vector("Europe (GML)", {<br>>
protocol: new OpenLayers.Protocol.HTTP({<br>>
url:
"./europe.gml",<br>>
format: new OpenLayers.Format.GML()<br>>
}),<br>>
strategies: [new OpenLayers.Strategy.Fixed()]<br>>
}));<br>> </script><br>>
</body><br>> </html><br>><br>> where europe.gml is a gml
file in the same folder of this script, but<br>> nothing
happens.<br>><br>> Thank you very much for your help!<br>><br>>
Regards<br>><br>> Niccolò<br>><br>> --<br>> Niccolò Dal
Santo<br>> <a href="tel:%2B39%20342%2015%2070%20842" value="+393421570842" target="_blank">+39 342 15 70 842</a><br>> <a href="mailto:ncl.dalsanto@gmail.com" target="_blank">ncl.dalsanto@gmail.com</a><br>><br></div></div>>
_______________________________________________<br>> Users mailing
list<br>> <a href="mailto:Users@lists.osgeo.org" target="_blank">Users@lists.osgeo.org</a><br>> <a href="http://lists.osgeo.org/mailman/listinfo/openlayers-users" target="_blank">http://lists.osgeo.org/mailman/listinfo/openlayers-users</a><br><span><font color="#888888"><br><br><br>--<br>Disclaimer;<br>This message
is just a reflection of what I thought at the time of<br>sending. The message
may contain information that is not intended for<br>you or that you don't
understand.<br>_______________________________________________<br>Users
mailing list<br><a href="mailto:Users@lists.osgeo.org" target="_blank">Users@lists.osgeo.org</a><br><a href="http://lists.osgeo.org/mailman/listinfo/openlayers-users" target="_blank">http://lists.osgeo.org/mailman/listinfo/openlayers-users</a></font></span></blockquote></div><br><br clear="all">
<div><br></div>-- <br>Niccolò Dal Santo
<div>+39 342 15 70 842</div>
<div><a href="mailto:ncl.dalsanto@gmail.com" target="_blank">ncl.dalsanto@gmail.com</a></div></div>
<br><br>
</div></div><hr style="border:none;color:#909090;background-color:#b0b0b0;min-height:1px;width:99%">
<table style="border-collapse:collapse;border:none">
<tbody><tr>
<td style="border:none;padding:0px 15px 0px 8px">
<a href="http://www.avast.com/" target="_blank">
<img border="0" src="http://static.avast.com/emails/avast-mail-stamp.png">
</a>
</td>
<td>
<p style="color:#3d4d5a;font-family:"Calibri","Verdana","Arial","Helvetica";font-size:12pt">
Diese E-Mail ist frei von Viren und Malware, denn der <a href="http://www.avast.com/" target="_blank">avast! Antivirus</a> Schutz ist aktiv.
</p>
</td>
</tr>
</tbody></table>
<br>
</div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>Niccolò Dal Santo<div>+39 342 15 70 842</div><div><a href="mailto:ncl.dalsanto@gmail.com" target="_blank">ncl.dalsanto@gmail.com</a></div>
</div>