Opened 14 years ago

Closed 13 years ago

Last modified 13 years ago

#310 closed defect (fixed)

Flexible weblayout unit doesn't consistent with its map.

Reported by: liuar Owned by: madair
Priority: P1 Milestone: 2.0
Component: MapGuide Version: 1.1.1
Severity: Major Keywords:
Cc: Browser: All
External ID: 1267676 Operating System: All
state: New


  1. Create a Flexble weblayout with map which unit is meter.
  2. View it in browser, click the "Options" widget, the unit is degrees.
  3. The initial view of the map is not correct either.

Attachments (2)

UnknownProjectionPatchTrunk.patch (5.1 KB ) - added by chrisclaydon 13 years ago.
UnknownProjectionPatch2.2gp.patch (5.1 KB ) - added by chrisclaydon 13 years ago.

Download all attachments as: .zip

Change History (9)

comment:1 by liuar, 14 years ago

Priority: P2P1

In Openlayers.js

Line 10856: if (window.Proj4js) {

this.proj = new Proj4js.Proj(projCode);

} If proj4js included, the projection will be initialized.

Line 20817:

this.units = this.projection.getUnits()

If the projection has units, the layer’s unit will be the projection’s unit rather than map’s unit. However, for openlayers maps, the default coordinate system is always EPSG:4326, so the units will always be degrees.

In Map.js

Line 918: getUnits: function() {

return this.oMapOL.baseLayer.units;


The map’s units is its baselayer’s units, so the OptionView widget will get the degrees as unit and the initial view of non-degrees map will not be shown correctly.

comment:2 by liuar, 14 years ago

This is the ticket which introduce the proj4js.

comment:3 by chrisclaydon, 14 years ago

Temporarily reverted the change that causes this problem:

DM Solns is aware of the issue and will add the Proj4js reference back into the build when the projection/units/MG compatibility issues have been resolved.

comment:4 by madair, 13 years ago

Milestone: Future2.0
Resolution: fixed
Status: newclosed

this was fixed as part of some other tickets, changesets [2066] and [2077].

For maps that aren't in EPSG:4326, the projection must be specified for widgets that depend on the correct units (e.g. measure). For MapGuide, this is sometimes returned in the LoadMap response, but not always in which case it must be listed in the APpDef

comment:5 by chrisclaydon, 13 years ago

Recent changes to the MapGuide code improve the number of MG coordinate systems that can be used in the map that will result in an EPSG code being returned. However, not all systems will return a code, and some don't even have a corresponding code. In such cases, using a default LL/WGS84 system (as is currently the case) is not appropriate since it may be wildly different from the actual system, and may use different units, resulting in scale calculation problems.

This can be resolved by setting the projection code in MapGuide.js to a special value, "UNKNOWN" and then bypassing coordinate system initialization in OpenLayers.Projection for this code. This essentially makes everything behave as it did before Proj4js.js was linked in to the project.

by chrisclaydon, 13 years ago

by chrisclaydon, 13 years ago

comment:6 by chrisclaydon, 13 years ago

Please review the attached patches (changes are identical in both) that implement the change described above.

comment:7 by chrisclaydon, 13 years ago

Submitted patch to 2.2gp branch:

Note: See TracTickets for help on using tickets.