Hello, You can make think easier using spatial_ref_sys table of a posgresql database with postgis enabled. If you look, there's a column call proj4text in this table.
If you compare http://spatialreference.org/ref/epsg/2154/proj4js/ , http://spatialreference.org/ref/epsg/4326/proj4/ and "+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs" from spatial_ref_sys table, you see proj4 value = proj4text spatial_ref_sys table and that proj4 and proj4js are near the same, except some differences. You can make all proj4js code using the PHP code below. I suppose you have a Postgis database ready on your computer and you know how to execute php code. ------------------------------------------------------------------------------------------------------------------------------------------------------- <?php $conn_string = "host=localhost port=5432 dbname=mydatabase_with_postgis_activated user=my_user password=my_password"; $link = pg_connect($conn_string) or die("Could not connect"); $start_epsg = 'Proj4js.defs["EPSG:'; $end_epsg_start_proj4js = '"] = "'; $end_proj4js ='";'; $select_epsg = pg_query("SELECT srid,trim(proj4text) as proj4text from spatial_ref_sys"); /* //Uncomment if you want to make a particular file for proj4js file depending on defined epsgvalues $epsgvalues = "4326,2154"; $select_epsg = pg_query("SELECT srid,trim(proj4text) as proj4text from spatial_ref_sys WHERE srid IN(".$epsgvalues.")"); */ $stringData=""; while($proj4_code = pg_fetch_array($select_epsg)) { //To view result echo $start_epsg.$proj4_code["srid"].$end_epsg_start_proj4js.$proj4_code["proj4text"].$end_proj4js.'<br/>'; //To prepare content for writing result $stringData.=$start_epsg.$proj4_code["srid"].$end_epsg_start_proj4js.$proj4_code["proj4text"].$end_proj4js."\r\n"; } $myFile = "epsg.js"; $fh = fopen($myFile, 'w') or die("can't open file"); fwrite($fh, $stringData); fclose($fh); ?> ------------------------------------------------------------------------------------------------------------------------------------------------------- Regards ThomasG GIS specialist
_______________________________________________ Users mailing list Users@openlayers.org http://openlayers.org/mailman/listinfo/users