[Geomoose-users] print osm tiles

Dante Fuster dante.fuster at gmail.com
Thu Feb 12 11:59:52 PST 2015


Hello
I had also  the same problem to print a map with background like googlemaps
or OSM,  i dont need  complex print and i resolved to generate a screen
with only the content of the map and sending to save (screen capture) to
JPG or print directly.

i create a new service:
--------------------------
     <service name="print2" display="false">
        <url>php/print2.php</url>
        <step type='input'>
                <input type="hidden" name="impresion" value="true"/>
        </step>
    </service>
----------------------------
and the print2.php

-----------------------
<?php

include('config.php');
include('globalgis.php');

# Turn off the warning reporting
error_reporting(E_ERROR | E_PARSE);

//$predicates = array();

# the mode!

    header('Content-type: text/xml');
?>
    <results>

    <script><![CDATA[

    var barra = document.getElementById("OpenLayers.Control.PanZoomBar_11");
  barra.style.display="none";
  var ficha = document.getElementById("map");
  params  = 'width='+screen.width;
  params += ', height='+screen.height;
  params += ', scrollbars=auto';

  var ventimp = window.open(' ', 'popimpr',params);
  ventimp.document.write("<html>");
  ventimp.document.write("<head>");
  ventimp.document.write("<script type='text/javascript' src='
http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.js'></script>");
  ventimp.document.write("<script type='text/javascript'
src='build/jquery.fullscreen-min.js'></script>");
  ventimp.document.write("</head>");
  ventimp.document.write("<body>");
  ventimp.document.write( ficha.innerHTML );
  ventimp.document.write("</body>");
  ventimp.document.write("<html>");
    ventimp.document.write("<div id='buttons'>");
  ventimp.document.write("    <button
onclick='$(document).fullScreen(true)' autofocus='autofocus'>F</button>");
  ventimp.document.write("  </div>");
  ventimp.document.close();



//ventimp.print( );

//  ventimp.close();
   barra.style.display="";
   GeoMOOSE.changeTab('catalog');
    ]]></script>

    <html><![CDATA[
  ]]>
    </html>
    </results>
--------------------------

or a variation  to print directly

------------------------------
<?php

include('config.php');
include('globalgis.php');

# Turn off the warning reporting
error_reporting(E_ERROR | E_PARSE);

//$predicates = array();

# the mode!

    header('Content-type: text/xml');
?>
    <results>
    <script><![CDATA[
          var barra =
document.getElementById("OpenLayers.Control.PanZoomBar_11");
  barra.style.display="none";
  var ficha = document.getElementById("map");

  var ventimp = window.open(' ', 'popimpr');
  ventimp.document.write( ficha.innerHTML );

  ventimp.document.close();
ventimp.print( );

  ventimp.close();
   barra.style.display="";
    ]]></script>

    <html><![CDATA[

  ]]>

    </html>
    </results>

---------------------------------
i hope to help you , is simple and  was the minimum that i needed

Regards

Dante Fuster


2015-02-10 11:20 GMT-05:00 Brent Fraser <bfraser at geoanalytic.com>:

>  Geograefin,
>
>   I just copied the "frmt_wms_openstreetmap_tms.xml" file into the same
> folder as the map file and it works fine..  I suspect you could put the
> full path to the xml file in the DATA object in the map file, but I have
> not tried it.
>
>   Interestingly, the xml file (along with many others) are delivered with
> the GDAL source code, but not with the binary distributions I use.  The
> files are:
>
> frmt_wms_metacarta_tms.xml
> frmt_wms_metacarta_wmsc.xml
> frmt_wms_onearth_global_mosaic.xml
> frmt_wms_openstreetmap_tms.xml
> frmt_wms_tileservice_bmng.xml
> frmt_wms_tileservice_nysdop2004.xml
>
> I may have to try some of these!
>
> Best Regards,
> Brent Fraser
>
> On 2/10/2015 8:42 AM, geo.graefin at web.de wrote:
>
>
> Hello Brent,
>
> I'm sorry to bother you again, but I could not find where to store the xml
> file. How does the MapServer interact with GDAL? Where I have to
> reference the xml file? Apparently the content of the xml file should look
> like this one [
> http://code.metager.de/source/xref/lib/gdal/frmts/wms/frmt_wms_openstreetmap_tms.xml
> ].
> By these instructions [http://www.gdal.org/frmt_wms.html] I can not look
> through.
> Thank you very much in advance for answering!
>
> Greetings, Geograefin
>  *Gesendet:* Montag, 09. Februar 2015 um 16:38 Uhr
> *Von:* "Brent Fraser" <bfraser at geoanalytic.com> <bfraser at geoanalytic.com>
> *An:* geo.graefin at web.de, "GeoMOOSE Users List"
> <geomoose-users at lists.osgeo.org> <geomoose-users at lists.osgeo.org>
> *Betreff:* Re: Aw: Re: [Geomoose-users] print osm tiles
>  Geograefin,
>
>   Check your "frmt_wms_openstreetmap_tms.xml" file is working by using
> gdal_translate (or gdalinfo) command line program.
>
> Best Regards,
> Brent Fraser
>
> On 2/9/2015 7:31 AM, geo.graefin at web.de wrote:
>
>
> Dear Brent Fraser,
>
> in addition to the post you listed below, I have created a map file
> (my_osm.map), to support the printing of osm tiles.
>
> MAP
>
>  #--------------------------------------------------------------------------------
>
>  #---------------------------------MAPFILEHEADER----------------------------------
>
>  #--------------------------------------------------------------------------------
>     NAME 'background'
>     STATUS ON
>     DEBUG 5
>     CONFIG "MS_ERRORFILE" "/ms4w/tmp/ms_error.txt"
>     #EXTENT 1190889 6412149 1987057 6860988
>     #SIZE 100 100
>     #UNITS METERS
>     #IMAGETYPE PNG
>     PROJECTION
>         'init=epsg:3857'     #projection of the map
>     END
>     OUTPUTFORMAT
>         NAME png
>         DRIVER "GD/PNG"
>         MIMETYPE "image/png"
>         IMAGEMODE PC256
>         EXTENSION "png"
>     END
>     INCLUDE "../../geomoose_globals.map"
>
>  #--------------------------------------------------------------------------------
>
>  #-----------------------------------WEB-SECTION----------------------------------
>
>  #--------------------------------------------------------------------------------
>     WEB
>         IMAGEPATH "/ms4w/tmp/ms_tmp/"
>         IMAGEURL "/ms_tmp/"
>         METADATA
>             WMS_TITLE "open street map"
>             WMS_ABSTRACT "Open Street Map Kacheln"
>             WMS_ONLINERESOURCE "http://localhost/cgi-bin/mapserv?
>                 map=/geomoose2/maps/demo/test/angebote/my_osm.map"
>             WMS_SRS "EPSG:3857"        #projection of the service
>             WMS_ENABLE_REQUEST "*"
>         END
>     END
>
>  #--------------------------------------------------------------------------------
>
>  #-------------------------------------LAYER--------------------------------------
>
>  #--------------------------------------------------------------------------------
>       LAYER
>         NAME 'my_osm'
>         DATA "frmt_wms_openstreetmap_tms.xml"
>         STATUS ON
>         TYPE RASTER
>         PROCESSING "OVERSAMPLE_RATIO=1"
>         PROCESSING "LOAD_FULL_RES_IMAGE=NO"
>         UNITS METERS
>         METADATA
>             WMS_TITLE "open street map tiles"
>         END
>         PROJECTION
>             "proj=merc" "a=6378137" "b=6378137" "lat_ts=0.0" "lon_0=0.0"
> "x_0=0.0" "y_0=0" "k=1.0" "units=m" "nadgrids=@null" "no_defs"
>         END
>       END
> END     #end map
>
> Are the settings correct, the coordinate systems, too?
>
> And the settings in mapbook.xml are these:
>
>     <map-source name="background" type="mapserver">
>         <file>./test/angebote/my_osm.map</file>
>         <layer name="my_osm" status="on"/>
>     </map-source>
>
>      <layer title="Mein OSM" src="background/my_osm" legend="false"
> fade="false" unfade="false"/>
>
> I would be very grateful if you could check this! Currently, there is just
> a white display, when I turn on the layer.
> Thank you very much!
>
> Greetings, Geograefin
>
>  *Gesendet:* Mittwoch, 04. Februar 2015 um 18:56 Uhr
> *Von:* "Brent Fraser" <bfraser at geoanalytic.com>
> <http://bfraser@geoanalytic.com>
> *An:* geo.graefin at web.de, geomoose-users at lists.osgeo.org
> *Betreff:* Re: [Geomoose-users] print osm tiles
>  There's some info on a work-around:
>
> http://osgeo-org.1560.x6.nabble.com/Geomoose-users-Printing-tt4928024.html
>
> but the results are not very good.
>
> Best Regards,
> Brent Fraser
>
> On 2/4/2015 3:45 AM, geo.graefin at web.de wrote:
>
>  Hello,
>
> is there a current solution to print open street map tiles in GeoMOOSE?
>
> Thank you for your answers!
>
> Greetings, Geograefin
>
>
> _______________________________________________
> Geomoose-users mailing listGeomoose-users at lists.osgeo.orghttp://lists.osgeo.org/mailman/listinfo/geomoose-users
>
>
>
> _______________________________________________
> Geomoose-users mailing list
> Geomoose-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/geomoose-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/geomoose-users/attachments/20150212/cec1264e/attachment-0001.html>


More information about the Geomoose-users mailing list