<div dir="ltr">Hi. I assume so as well.<br><br>I have tried to use for example:<br>$this->map->setprojection('init=epsg:3857', MS_TRUE);<br>but it didn't change anything.<br><br>That's why I wrote "or do I need to set an option in the layer or map object?" - I figure I need to tell Mapscript what I am trying to do, but I couldn't figure out how.<br><br>3857 is defined in my /usr/share/proj/epsg<br><br><div>@Lars sorry about the duplicate reply. Accidentally missed the "Reply all"-button.<br><br>// Magnus<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Sep 20, 2020 at 8:53 PM Lars Schylberg <<a href="mailto:lars.schylberg@blixtmail.se">lars.schylberg@blixtmail.se</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
  
    
  
  <div>
    <p>Hi, I am not using PHP Mapscript, but shouldn't You set the
      extent to valid EPSG coordinates for EPSG:3857.  IE.  <span>Projected bounds:</span><br>
      -20026376.39 -20048966.10<br>
      20026376.39 20048966.10</p>
    <p>for global coverage.</p>
    <p>/Lars S.<br>
    </p>
    <div>Den 2020-09-20 kl. 18:32, skrev magma:<br>
    </div>
    <blockquote type="cite">
      
      <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>
      <br>
      <fieldset></fieldset>
      <pre>_______________________________________________
mapserver-users mailing list
<a href="mailto:mapserver-users@lists.osgeo.org" target="_blank">mapserver-users@lists.osgeo.org</a>
<a href="https://lists.osgeo.org/mailman/listinfo/mapserver-users" target="_blank">https://lists.osgeo.org/mailman/listinfo/mapserver-users</a></pre>
    </blockquote>
  </div>

_______________________________________________<br>
mapserver-users mailing list<br>
<a href="mailto:mapserver-users@lists.osgeo.org" target="_blank">mapserver-users@lists.osgeo.org</a><br>
<a href="https://lists.osgeo.org/mailman/listinfo/mapserver-users" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/mapserver-users</a></blockquote></div>