<br><font size=2 face="sans-serif">Thanks Julien</font>
<br><font size=2 face="sans-serif">I just had a look at the read function
of format.geojson and crs is not read.</font>
<br><font size=2 face="sans-serif">this.externalProjection  has to
be defined in the format.</font>
<br>
<br><font size=2 face="sans-serif">There is </font>
<br><font size=2 face="sans-serif">if (this.internalProjection &&
this.externalProjection && !collection) {</font>
<br><font size=2 face="sans-serif">           
geometry.transform(this.externalProjection, </font>
<br><font size=2 face="sans-serif">           
                   this.internalProjection);
</font>
<br><font size=2 face="sans-serif">        }</font>
<br>
<br><font size=2 face="sans-serif">My idea is to set the externalProjection
by a function</font>
<br><font size=2 face="sans-serif">var geojson_format = new OpenLayers.Format.GeoJSON({</font>
<br><font size=2 face="sans-serif">        'internalProjection':
map.getProjectionObject(),</font>
<br><font size=2 face="sans-serif">        'externalProjection':
getGeojsonProjection(request.responseText)</font>
<br><font size=2 face="sans-serif">});</font>
<br><font size=2 face="sans-serif">function getGeojsonProjection( geojson
)</font>
<br><font size=2 face="sans-serif">{</font>
<br><font size=2 face="sans-serif">        //parse
the json for CRS code and create the projection, if no CRS return 4326</font>
<br><font size=2 face="sans-serif">        ......</font>
<br>
<br><font size=2 face="sans-serif">        //Example:
return new OpenLayers.Projection("EPSG:32198");</font>
<br><font size=2 face="sans-serif">}<br>
</font>
<p><font size=3>That will work if all the features are ine the same projection.</font>
<p><font size=3>Perhaps someone as a better idea?</font>
<p><font size=3>many thanks</font>
<p><font size=3>steve</font>
<p>
<p>
<br>
<br>
<br>
<table width=100%>
<tr valign=top>
<td width=40%><font size=1 face="sans-serif"><b>Julien-Samuel Lacroix <jlacroix@mapgears.com>@lists.osgeo.org</b>
</font>
<br><font size=1 face="sans-serif">Envoyé par : openlayers-users-bounces@lists.osgeo.org</font>
<p><font size=1 face="sans-serif">2013-10-11 15:41</font>
<td width=59%>
<table width=100%>
<tr valign=top>
<td>
<div align=right><font size=1 face="sans-serif">A</font></div>
<td><font size=1 face="sans-serif">openlayers-users@lists.osgeo.org</font>
<tr valign=top>
<td>
<div align=right><font size=1 face="sans-serif">cc</font></div>
<td>
<tr valign=top>
<td>
<div align=right><font size=1 face="sans-serif">Objet</font></div>
<td><font size=1 face="sans-serif">Re: [OpenLayers-Users] geosjon format
with epsg other than 4326</font></table>
<br>
<table>
<tr valign=top>
<td>
<td></table>
<br></table>
<br>
<br>
<br>
<br>
<br><tt><font size=2>Hi,<br>
<br>
Others may be able to give you more info on this one, but...<br>
<br>
If I recall correctly there was a long discussion on the GeoJSON <br>
mailing-list [1] on the usability of this CRS tag. I think that the <br>
conclusion was to remove it from GeoJSON, other may correct me if I'm <br>
wrong. So don't plan on it. Are you in control of this data and service?
<br>
maybe it could return you a WFS. Or maybe a GetCapabilities to the data
<br>
server would tell you the projection before you receive the GeoJSON.<br>
<br>
This is a tricky one, I agree.<br>
<br>
<br>
[1] <br>
http://lists.geojson.org/pipermail/geojson-geojson.org/2013-May/thread.html<br>
<br>
Julien<br>
<br>
<br>
On 13-10-11 11:09 AM, Steve.Toutant@inspq.qc.ca wrote:<br>
> Hi,<br>
><br>
> Sometimes I receive geojson from a wps service in different projection<br>
> than 4326. I manage it like this for example<br>
> geojson_format = new OpenLayers.Format.GeoJSON({'internalProjection':<br>
> map.getProjectionObject(),'externalProjection': new<br>
> OpenLayers.Projection("EPSG:32198")});<br>
><br>
> It works but 32198 is hardcoded, and I don't know when the epsg will
be<br>
> different.<br>
><br>
> I read that if different than 4326, the geojson should have a crs
tag as<br>
> defined here<br>
> http://geojson.org/geojson-spec.html#named-crs<br>
><br>
> Someone has defined a new OpenLayers.Format.GeoJSON that can read
this<br>
> tag and set the externalProjection code?<br>
><br>
> thanks<br>
> steve<br>
><br>
><br>
> _______________________________________________<br>
> Users mailing list<br>
> Users@lists.osgeo.org<br>
> http://lists.osgeo.org/mailman/listinfo/openlayers-users<br>
><br>
<br>
-- <br>
Julien-Samuel Lacroix<br>
Mapgears<br>
http://www.mapgears.com/<br>
_______________________________________________<br>
Users mailing list<br>
Users@lists.osgeo.org<br>
http://lists.osgeo.org/mailman/listinfo/openlayers-users<br>
</font></tt>
<br>
<br>
<br>