<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML xmlns="http://www.w3.org/TR/REC-html40" xmlns:v =
"urn:schemas-microsoft-com:vml" xmlns:o =
"urn:schemas-microsoft-com:office:office" xmlns:w =
"urn:schemas-microsoft-com:office:word" xmlns:m =
"http://schemas.microsoft.com/office/2004/12/omml"><HEAD>
<META content="text/html; charset=iso-8859-1" http-equiv=Content-Type>
<META name=GENERATOR content="MSHTML 8.00.6001.23487">
<STYLE>@font-face {
font-family: Cambria Math;
}
@font-face {
font-family: Calibri;
}
@page WordSection1 {size: 612.0pt 792.0pt; margin: 70.85pt 70.85pt 2.0cm 70.85pt; }
P.MsoNormal {
MARGIN: 0cm 0cm 0pt; FONT-FAMILY: "Calibri","sans-serif"; FONT-SIZE: 11pt; mso-fareast-language: EN-US
}
LI.MsoNormal {
MARGIN: 0cm 0cm 0pt; FONT-FAMILY: "Calibri","sans-serif"; FONT-SIZE: 11pt; mso-fareast-language: EN-US
}
DIV.MsoNormal {
MARGIN: 0cm 0cm 0pt; FONT-FAMILY: "Calibri","sans-serif"; FONT-SIZE: 11pt; mso-fareast-language: EN-US
}
A:link {
COLOR: #0563c1; TEXT-DECORATION: underline; mso-style-priority: 99
}
SPAN.MsoHyperlink {
COLOR: #0563c1; TEXT-DECORATION: underline; mso-style-priority: 99
}
A:visited {
COLOR: #954f72; TEXT-DECORATION: underline; mso-style-priority: 99
}
SPAN.MsoHyperlinkFollowed {
COLOR: #954f72; TEXT-DECORATION: underline; mso-style-priority: 99
}
SPAN.E-MailFormatvorlage17 {
FONT-FAMILY: "Calibri","sans-serif"; COLOR: windowtext; mso-style-type: personal-compose
}
.MsoChpDefault {
FONT-FAMILY: "Calibri","sans-serif"; mso-fareast-language: EN-US; mso-style-type: export-only
}
DIV.WordSection1 {
page: WordSection1
}
</STYLE>
<!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></HEAD>
<BODY lang=DE link=#0563c1 vLink=#954f72>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN
class=500025119-04062013>Hi,</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN
class=500025119-04062013></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN
class=500025119-04062013>there is nothing wrong, but something missing. You use
an unusual projection for OpenLayers. </SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN
class=500025119-04062013>OL needs to calculate the resolutions for the
zoomlevels. For projection EPSG:4326 and EPSG:900913 there are default
resolutions.</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN
class=500025119-04062013></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN
class=500025119-04062013>Add maxExtent to your map options, then your features
should displayed.</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN
class=500025119-04062013></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT size=2 face=Arial><SPAN
class=500025119-04062013>To get the extends of a geoJSON file, you can register
"loadend" for the layer and calculate the extent.</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT size=2 face=Arial><SPAN
class=500025119-04062013></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT size=2 face=Arial><SPAN
class=500025119-04062013>GeoJSONLayer.events.register('loadend', GeoJSONLayer,
function(){<BR> var extent =
GeoJSONLayer.getDataExtent().toBBOX().replace(/,/g,", ");<BR>
alert("GeoJSONLayer dataExtent: " + extent);<BR>});</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN
class=500025119-04062013></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN
class=500025119-04062013>little example with features from GeoJSON in projection
EPSG:31466:</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><A
href="http://gis.ibbeck.de/ginfo/apps/OLExamples/OL212/BaseLayers/geoJson%20BaseLayer.asp">http://gis.ibbeck.de/ginfo/apps/OLExamples/OL212/BaseLayers/geoJson%20BaseLayer.asp</A></FONT></DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2
face=Arial></FONT> </DIV>
<DIV dir=ltr align=left><SPAN class=500025119-04062013><FONT color=#0000ff
size=2 face=Arial>Arnd</FONT></SPAN></DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2
face=Arial></FONT> </DIV><BR>
<DIV dir=ltr lang=de class=OutlookMessageHeader align=left>
<HR tabIndex=-1>
<FONT size=2 face=Tahoma><B>Von:</B> openlayers-users-bounces@lists.osgeo.org
[mailto:openlayers-users-bounces@lists.osgeo.org] <B>Im Auftrag von </B>Helmut
Seidel M.A.<BR><B>Gesendet:</B> Dienstag, 4. Juni 2013 13:52<BR><B>An:</B>
openlayers-users@lists.osgeo.org<BR><B>Betreff:</B> [OpenLayers-Users] Newby:
Display geoJSON Layer<BR></FONT><BR></DIV>
<DIV></DIV>
<DIV class=WordSection1>
<P class=MsoNormal>Hello everybody,<o:p></o:p></P>
<P class=MsoNormal><o:p> </o:p></P>
<P class=MsoNormal>I’m absolutely new to OpenLayers – For a start I wanted to
check out the possibilities of OpenLayers and display a geoJSON-Layer which
should act as the base layer. The layer uses the projection ESPSG 31468 / DHDN /
Gauss-Krüger 4.<o:p></o:p></P>
<P class=MsoNormal><o:p> </o:p></P>
<P class=MsoNormal>To say it in plain words I’m not too successfull in this, as
nothing is displayed.<o:p></o:p></P>
<P class=MsoNormal><o:p> </o:p></P>
<P class=MsoNormal>I tried the following code which I copied from various
sources:<o:p></o:p></P>
<P class=MsoNormal><o:p> </o:p></P>
<P class=MsoNormal><html><o:p></o:p></P>
<P
class=MsoNormal>
<head><o:p></o:p></P>
<P
class=MsoNormal>
<script src="Lib/OpenLayers.js"></script><o:p></o:p></P>
<P
class=MsoNormal>
<script type="text/javascript"><o:p></o:p></P>
<P
class=MsoNormal>
var map;<o:p></o:p></P>
<P class=MsoNormal><o:p></o:p></P>
<P
class=MsoNormal>
function init(){<o:p></o:p></P>
<P
class=MsoNormal>
var lon = 4596651.93;<o:p></o:p></P>
<P
class=MsoNormal>
var lat = 5355977.11;<o:p></o:p></P>
<P class=MsoNormal><o:p> </o:p></P>
<P
class=MsoNormal>
map = new OpenLayers.Map('map', {<o:p></o:p></P>
<P class=MsoNormal>
projection: "EPSG:31468"<o:p></o:p></P>
<P class=MsoNormal>
});<o:p></o:p></P>
<P class=MsoNormal><o:p> </o:p></P>
<P
class=MsoNormal>
var kmlLayer = new OpenLayers.Layer.Vector("GeoJSON", {<o:p></o:p></P>
<P
class=MsoNormal>
isBaseLayer: true,<o:p></o:p></P>
<P
class=MsoNormal>
strategies: [new OpenLayers.Strategy.Fixed()],<o:p></o:p></P>
<P
class=MsoNormal>
protocol: new OpenLayers.Protocol.HTTP({<o:p></o:p></P>
<P
class=MsoNormal>
url: "flurstuecke.json",<o:p></o:p></P>
<P
class=MsoNormal>
format: new OpenLayers.Format.GeoJSON()<o:p></o:p></P>
<P
class=MsoNormal>
})<o:p></o:p></P>
<P
class=MsoNormal>
});<o:p></o:p></P>
<P class=MsoNormal><o:p></o:p></P>
<P
class=MsoNormal>
map.addLayers([kmlLayer]);<o:p></o:p></P>
<P
class=MsoNormal>
map.addControl(new OpenLayers.Control.MousePosition());<o:p></o:p></P>
<P
class=MsoNormal>
map.setCenter(new OpenLayers.LonLat(lon, lat), 10);<o:p></o:p></P>
<P class=MsoNormal><o:p> </o:p></P>
<P
class=MsoNormal>
}<o:p></o:p></P>
<P
class=MsoNormal>
</script><o:p></o:p></P>
<P
class=MsoNormal>
</head><o:p></o:p></P>
<P
class=MsoNormal>
<body onload="init()"><o:p></o:p></P>
<P
class=MsoNormal>
<div id="map" style="width:300px; height:300px;<o:p></o:p></P>
<P
class=MsoNormal>
border: 1px solid black;"></div><o:p></o:p></P>
<P
class=MsoNormal>
</body><o:p></o:p></P>
<P class=MsoNormal></html><o:p></o:p></P>
<P class=MsoNormal><o:p> </o:p></P>
<P class=MsoNormal>Can anybody tell me whats wrong with it?<o:p></o:p></P>
<P class=MsoNormal><o:p> </o:p></P>
<P class=MsoNormal>By the way, how is it possible to retrive the extends of a
geoJSON file?<o:p></o:p></P>
<P class=MsoNormal><o:p> </o:p></P>
<P class=MsoNormal>Thank you all and regards<o:p></o:p></P>
<P class=MsoNormal><o:p> </o:p></P>
<P class=MsoNormal><SPAN
style="COLOR: #323e4f; mso-fareast-language: DE"><o:p> </o:p></SPAN></P>
<P class=MsoNormal><SPAN
style="COLOR: #323e4f; mso-fareast-language: DE">---<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN
style="COLOR: #323e4f; FONT-SIZE: 16pt; mso-fareast-language: DE">KnowHow -
Helmut Seidel M.A.<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN
style="COLOR: #323e4f; FONT-SIZE: 14pt; mso-fareast-language: DE">Softwareentwicklung
& Coaching<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN
style="COLOR: #323e4f; FONT-SIZE: 14pt; mso-fareast-language: DE"><o:p> </o:p></SPAN></P>
<P class=MsoNormal><SPAN
style="COLOR: #323e4f; mso-fareast-language: DE">Gabelsbergerstraße 17
B<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN style="COLOR: #323e4f; mso-fareast-language: DE">84034
Landshut<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN
style="COLOR: #323e4f; mso-fareast-language: DE">Telefon: 0871
9665230<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN
style="COLOR: #323e4f; mso-fareast-language: DE">Internet:
www.knowhow-la.de<o:p></o:p></SPAN></P>
<P class=MsoNormal><o:p> </o:p></P></DIV></BODY></HTML>