Opened 16 years ago

Closed 15 years ago

#2 closed enhancement (fixed)

provide dynamic loading of defs as an add-on

Reported by: madair Owned by: madair
Priority: minor Milestone: 1.0.0
Component: core Version:
Keywords: Cc:

Description

As suggested by Richard, the default build should include just the core library with no dependence on OpenLayers code. In this case, projection definitions must be loaded through a script tag independently of the core library.

Dynamic lookup of def files can be provided by over-riding certain methods of the Proj4js object in a separate JS file which woudl be included in a dynamic lookup build.

Attachments (2)

proj4js.diff (7.4 KB ) - added by dgrichard 16 years ago.
dynamic loading without requiring OL
OverloadedProj4js.js (6.3 KB ) - added by dgrichard 15 years ago.
Overriding methods that read defs files

Download all attachments as: .zip

Change History (8)

comment:1 by madair, 16 years ago

Status: newassigned

changeset:21

two important changes:

  • dynamic loading using script tags removes much of the dependencies on OpenLayers and it also means that a proxy script is no longer required. Naturally IE behaves differently in that there isn't an onerror method on the script tag so a work-around is used.
  • the above change means only 3 methods from OL are required to support inheritence. A copy of these is implemented in the Proj4js namespace to simplify script loading.

in reply to:  1 comment:2 by dgrichard, 16 years ago

Replying to madair:

changeset:21

two important changes:

  • dynamic loading using script tags removes much of the dependencies on OpenLayers and it also means that a proxy script is no longer required. Naturally IE behaves differently in that there isn't an onerror method on the script tag so a work-around is used.
  • the above change means only 3 methods from OL are required to support inheritence. A copy of these is implemented in the Proj4js namespace to simplify script loading.

We are using PROJ4JS along with OpenLayers and dynamic loading is of major importance. Following your explanation, I have produce a version of proj4js.js allowing dynamic loading with just the addition of de OpenLayers.Utils.Try method(). It is attached to this ticket.

by dgrichard, 16 years ago

Attachment: proj4js.diff added

dynamic loading without requiring OL

comment:3 by dgrichard, 16 years ago

The patch also contains typo and thinks related with ticket#17.

comment:4 by madair, 15 years ago

dgrichard: can you a diff against the proj4js trunk please? I have trouble applying the patch as supplied.

Also, I would hesitate to put synchronous loading back in. In Javascript it seems that asynchronous loading is usually preferred so that the browser won't lock up. Maybe this patch can be coded as an add-on js file that overrides the default methods and included only if required?

in reply to:  4 comment:5 by dgrichard, 15 years ago

Replying to madair:

dgrichard: can you a diff against the proj4js trunk please? I have trouble applying the patch as supplied.

Also, I would hesitate to put synchronous loading back in. In Javascript it seems that asynchronous loading is usually preferred so that the browser won't lock up. Maybe this patch can be coded as an add-on js file that overrides the default methods and included only if required?

You're right and that what we are doing : overriding the default methods by just adding it after the proj4js is included ! I am going to attach the javascript file we are using.

by dgrichard, 15 years ago

Attachment: OverloadedProj4js.js added

Overriding methods that read defs files

comment:6 by madair, 15 years ago

Resolution: fixed
Status: assignedclosed

added at rev #1612

Thanks for the contribution!

Note: See TracTickets for help on using tickets.