Hi,

for writing OSM data there is no call to geometry.transform 

you can patch the file OSM.js

    createXML: {
        'point': function(point) {
            var id = null;
            var geometry = point.geometry ? point.geometry : point;

//at line 349 add this 5 lines
            if (this.externalProjection && this.internalProjection) {
                geometry = geometry.clone();
                geometry.transform(this.internalProjection,
                                   this.externalProjection);
            }
//
            var already_exists = false; // We don't return anything if the
node

and the transformation for writing works. 

What i don't understand, that an externalProjection given in the options is
used instead of 

// OSM coordinates are always in longlat WGS84
this.externalProjection = new OpenLayers.Projection("EPSG:4326");

as set in the initialize function, what should overwrite the options value.

With the patch one can create OSM data in different projection than
EPSG:4326.

Arnd
 

-----Ursprüngliche Nachricht-----
Von: openlayers-users-boun...@lists.osgeo.org
[mailto:openlayers-users-boun...@lists.osgeo.org] Im Auftrag von yvecai
Gesendet: Dienstag, 21. Dezember 2010 18:25
An: openlayers-users@lists.osgeo.org
Betreff: Re: [OpenLayers-Users] Write feature in another projection

Hi Stephane,
No, a tried the two ways to be sure and I paste the wrong one.
Anyway OpenLayer.Format.OSM does not seem to handle
'internal/externalProjection'. Now I'm happy with:
             var x = new OpenLayers.Format.WKT({
                 'internalProjection': new
OpenLayers.Projection("EPSG:900913"),
                 'externalProjection': new
OpenLayers.Projection("EPSG:4326")
                 });
CU
Yves

On 21. 12. 10 10:04, Stéphane Brunner wrote:
> Hello,
>
> Are you sure that you want OSM format in 900913 ? usually it should be in
4326.
>
> CU
> Stéphane
>
>
> 2010/12/20 yvecai<yve...@gmail.com>:
>> Reply to self:
>> This works with:
>>             var x = new OpenLayers.Format.WKT({
>>               'internalProjection': new
OpenLayers.Projection("EPSG:4326"),
>>               'externalProjection': new
OpenLayers.Projection("EPSG:900913")
>>             });
>>
>> Should I fill a ticket?
>> Yves
>>
>> On 19. 12. 10 23:55, yvecai wrote:
>>> I want to export osm data from a vector feature, but I can't export 
>>> to the proper projection.
>>> Isn't that supposed to work :
>>>
>>>         function export_vectors(feature) {
>>>             $("vectors").value = "hello";
>>>             var x = new OpenLayers.Format.OSM({
>>>               'internalProjection': new
OpenLayers.Projection("EPSG:4326"),
>>>               'externalProjection': new
>>> OpenLayers.Projection("EPSG:900913")
>>>             });
>>>             var content = x.write(feature);
>>>             $("vectors").value = content;
>>>             $("vectors").style.display = "block";
>>>         }
>>> ?
>>>
>>> Yves
>>> _______________________________________________
>>> Users mailing list
>>> us...@lists.osgeo.org
>>> http://lists.osgeo.org/mailman/listinfo/openlayers-users
>>>
>> _______________________________________________
>> Users mailing list
>> us...@lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/openlayers-users
>>

_______________________________________________
Users mailing list
us...@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/openlayers-users

_______________________________________________
Users mailing list
us...@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/openlayers-users

Reply via email to