Ticket #1776 (closed bug: worksforme)

Opened 5 years ago

Last modified 4 years ago

OpenLayers.Format.GeoJSON.write does not reproject most of the points when internal and external Projection is specified.

Reported by: openlayers Owned by:
Priority: minor Milestone:
Component: general Version: 2.7
Keywords: Cc:
State:

Description

1) GeoJSON layer on the map, with a Projection that differs from the map Projection.

Proj4js.defsEPSG:900913? = "+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m

+nadgrids=@null +no_defs";

Proj4js.defsEPSG:28992? = "+proj=sterea +lat_0=52.15616055555555 +lon_0=5.38763888888889 +k=1.0 +x_0=155000 +y_0=46

3000 +ellps=bessel +towgs84=565.,49.9,465.8,-0.409,0.36,-1.869,4.08 +units=m +no_defs"; The map is in 900913. The layer 28992. 2) SelectFeature on that layer is active. 3) User toggles a control and activates the modifyFeature control and modifies the polygon. 4) User selects to save the modifications. For each modified polygon the following code is called:

var formatter = new OpenLayers.Format.GeoJSON({internalProjection: new OpenLayers.Projection("EPSG:900913"), externalProjection: new OpenLayers.Projection("EPSG:28992")}); var coords = formatter.write(f.geometry, false);

5) Upon inspection of the coords it is found that for an 8 point polygon only points 3,4 and 7 are transformed.

Change History

Changed 4 years ago by crschmidt

  • status changed from new to closed
  • resolution set to worksforme

Just tried it, though not with those projection parameters (since I don't have an easy proj4js setup here) and could not reproduce. My guess is that the geometry in question can't be reprojected into the coordinate system for the other points, but a minimal example HTML page would be neccesary to confirm. Please feel free to reopen if you create one of these.

Note: See TracTickets for help on using tickets.