<div dir="ltr">Hi all.<div><br></div><div>I have used PHP Mapscript for a few years to render static images of maps, from data I have in PostgreSQL/PostGIS. A simplified example of my code looks like this:</div><div><br></div><div><?php<br><br><font face="monospace">$this->map = ms_newMapObj('');<br>$this->map->selectOutputFormat('png');<br>$this->map->imagecolor->setRGB(56, 112, 192);<br>$this->map->setextent(-180, -90, 180, 90);<br>$this->map->set('width', 1000);<br>$this->map->set('height', 600);<br><br>$layer = ms_newLayerObj($this->map);<br>$layer->setConnectionType(MS_POSTGIS);<br>$layer->set('name', 'world');<br>$layer->set('type', MS_LAYER_POLYGON);<br>$layer->set('status', MS_ON);<br>$layer->set('connection', "host={$this->postgis['host']} port={$this->postgis['port']} dbname={$this->postgis['db']} user={$this->postgis['user']} password={$this->postgis['pass']}");<br><br>// $layer->set('data', "geom FROM (SELECT id, geom FROM osm_country_polygons) AS a USING UNIQUE id USING srid=4326");<br>$layer->set('data', "geom FROM (SELECT id, ST_Transform(geom, 3857) AS geom FROM osm_country_polygons) AS a USING UNIQUE id USING srid=3857");<br><br>$class = ms_newClassObj($layer);<br>$style = ms_newStyleObj($class);<br>$style->color->setRGB(160, 160, 160);<br>$style->outlinecolor->setRGB(48, 48, 48);<br><br>header('Content-Type: image/png');<br>$image = $this->map->draw();<br>$image->saveImage();<br></font></div><div><span style="font-family:monospace">?></span><br></div><div><br></div><div>Using SRID 4326 works great (the commented line). However the line below, which is enabled, using 3857 does not work. It renders an all blue image (<i>$this->map->imagecolor->setRGB(56, 112, 192)</i>).</div><div><br></div><div>Is it not possible to change the projection, or do I need to set an option in the layer or map object? I have tried to read and Google this for some time now, but whatever I try seems to fail for me.</div><div><br></div><div>Most thankful for a good hint/solution.</div><div><br></div><div>// Magnus</div></div>