Skip to content

Instantly share code, notes, and snippets.

@dshorthouse
Last active March 10, 2017 19:37
Show Gist options
  • Save dshorthouse/1dc43361902ebe4655f883e0040efc02 to your computer and use it in GitHub Desktop.
Save dshorthouse/1dc43361902ebe4655f883e0040efc02 to your computer and use it in GitHub Desktop.
PHP MapScript reprojection/extent issues
<?php
//MapServer version 7.0.4
$map = ms_newMapObjFromString("MAP END");
$map->set("units", MS_DD);
$map->setProjection("proj=longlat,ellps=WGS84,datum=WGS84,no_defs", true);
$map->setExtent(-180, -90, 180, 90);
$map->setSize(100,100);
$map->setProjection("proj=robin,lon_0=0,x_0=0,y_0=0,ellps=WGS84,datum=WGS84,units=m,over,no_defs", true);
print_r($map->convertToString());
/*
Produces:
MAP
EXTENT -1e+15 -1e+15 1e+15 1e+15
...
*/
$map = ms_newMapObjFromString("MAP END");
$map->set("units", MS_DD);
$map->setProjection("proj=longlat,ellps=WGS84,datum=WGS84,no_defs", true);
$map->setExtent(-179.999, -89.999, 179.999, 89.999);
$map->setSize(100,100);
$map->setProjection("proj=robin,lon_0=0,x_0=0,y_0=0,ellps=WGS84,datum=WGS84,units=m,over,no_defs", true);
print_r($map->convertToString());
/*
Produces:
MAP
EXTENT -17005738.8536734 -17005738.8536734 17005738.8536734 17005738.8536734
...
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment