FacilMap/Version 1/API/Migration guide from cdauth’s map

From OpenStreetMap Wiki
Jump to navigation Jump to search

The old API files will continue to be hosted on http://osm.cdauth.eu/ until they don’t seem to be used anymore. They will not be updated however. The map on http://osm.cdauth.eu/map/ redirects to the new URL http://facilmap.org/. The old Git repositories will stay in place but with a notice that they have been moved.

Clients

JavaScript code that uses the API of cdauth’s map needs to be changed in order to use the new class names. As a general rule, all pieces of code that contain the text “cdauth” need to be updated.

  • The old classes used the same class structure as OpenLayers but had a “cdauth” somewhere in the class name. The class extending OpenLayers.Map was called OpenLayers.Map.cdauth, the class extending OpenLayers.Layer.OSM.Mapnik was called OpenLayers.Layer.cdauth.OSM.Mapnik. The “cdauth” part was removed from the class names and the classes are now part of an object called FacilMap that has the same structure as the OpenLayers object. The two example class names are now FacilMap.Map and FacilMap.Layer.OSM.Mapnik.
  • The same applies to CSS class names derived from JavaScript class names. What was prevously olMapcdauth is now fmMap.
  • All the scripts that are part of the API are now hosted on http://dev.facilmap.org/. http://dev.facilmap.org/facilmap.js now contains a compressed version of the API JavaScript, whereas for debugging you can use http://dev.facilmap.org/facilmap_src.js (which is a single but uncompressed file) or http://dev.facilmap.org/facilmap_debug.js (which includes all the single files that the API JavaScript is generated of).

Hosting

Those who hosted an own instance of cdauth’s map need to consider the following changes.

  • The API itself is now in a separate repository from the map itself (that relies on the API). See http://gitorious.org/facilmap/api for the Git URLs for the API repository and http://gitorious.org/facilmap/facilmap_org for the map that runs on http://facilmap.org/.
  • Instead of one large prototypes.js file, the API source is now split into several smaller JavaScript files. The large JavaScript file that can be included by clients has to be built every time a change is made to the JavaScript files by executing the shell script build.sh.