Hello,<br><br>You can make think easier using spatial_ref_sys table of a posgresql database with postgis enabled.<br>If you look, there's a column call proj4text in this table.<br><br>If you compare <a href="http://spatialreference.org/ref/epsg/2154/proj4js/">http://spatialreference.org/ref/epsg/2154/proj4js/</a> , <a href="http://spatialreference.org/ref/epsg/4326/proj4/">http://spatialreference.org/ref/epsg/4326/proj4/</a> and "+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs" from spatial_ref_sys table, you see proj4 value = proj4text spatial_ref_sys table and<br>
that proj4 and proj4js are near the same, except some differences.<br><br>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.<br>
<br>-------------------------------------------------------------------------------------------------------------------------------------------------------<br><?php<br><br>$conn_string = "host=localhost port=5432 dbname=mydatabase_with_postgis_activated user=my_user password=my_password";<br>
$link = pg_connect($conn_string) or die("Could not connect");<br><br><br>$start_epsg = 'Proj4js.defs["EPSG:';<br>$end_epsg_start_proj4js = '"] = "';<br>$end_proj4js ='";';<br>
<br>$select_epsg = pg_query("SELECT srid,trim(proj4text) as proj4text from spatial_ref_sys");<br><br>/*<br>//Uncomment if you want to make a particular file for proj4js file depending on defined epsgvalues<br>$epsgvalues = "4326,2154";<br>
$select_epsg = pg_query("SELECT srid,trim(proj4text) as proj4text from spatial_ref_sys WHERE srid IN(".$epsgvalues.")");<br>*/<br><br>$stringData="";<br>while($proj4_code = pg_fetch_array($select_epsg)) {<br>
//To view result<br>echo $start_epsg.$proj4_code["srid"].$end_epsg_start_proj4js.$proj4_code["proj4text"].$end_proj4js.'<br/>';<br>//To prepare content for writing result<br>$stringData.=$start_epsg.$proj4_code["srid"].$end_epsg_start_proj4js.$proj4_code["proj4text"].$end_proj4js."\r\n";<br>
}<br><br>$myFile = "epsg.js";<br>$fh = fopen($myFile, 'w') or die("can't open file");<br>fwrite($fh, $stringData);<br>fclose($fh);<br><br>?><br><br>-------------------------------------------------------------------------------------------------------------------------------------------------------<br>
<br>Regards<br><br>ThomasG<br>GIS specialist<br><div style="visibility: hidden; display: inline;" id="avg_ls_inline_popup"></div><style type="text/css">#avg_ls_inline_popup { position:absolute; z-index:9999; padding: 0px 0px; margin-left: 0px; margin-top: 0px; width: 240px; overflow: hidden; word-wrap: break-word; color: black; font-size: 10px; text-align: left; line-height: 13px;}</style>