Ticket #2 (closed enhancement: fixed)

Opened 4 years ago

Last modified 3 years ago

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

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

Change History

follow-up: ↓ 2   Changed 4 years ago by madair

  • status changed from new to assigned

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   Changed 4 years ago by dgrichard

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.

Changed 4 years ago by dgrichard

dynamic loading without requiring OL

  Changed 4 years ago by dgrichard

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

follow-up: ↓ 5   Changed 3 years ago by 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?

in reply to: ↑ 4   Changed 3 years ago by dgrichard

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.

Changed 3 years ago by dgrichard

Overriding methods that read defs files

  Changed 3 years ago by madair

  • status changed from assigned to closed
  • resolution set to fixed

added at rev #1612

Thanks for the contribution!

Note: See TracTickets for help on using tickets.