Print servlet not printing OpenLayers.TMS layer

View: New views
9 Messages — Rating Filter:   Alert me  

Print servlet not printing OpenLayers.TMS layer

by Mike Totman :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I have an app I've inherited that was already using OpenLayers to do
its mapping, and I'm trying to get the MapFish print module to handle
printing those maps to PDF.

The application stores the map tiles in its own database and retrieves
them by URL using a TMS layer which retrieves the tiles via a custom
servlet that response to URLs encoding the tiles in the
zoomlevel/row/column format.  e.g. /app/map/0/0/1.jpg

I'm using the printer servlet installed as part of the application
(which is running under JBoss 4.2) and it seems to work fine.  Calls
to pdf/info.json return the appropriate result.

When I try to print (I added a PrintAction stolen from the sample
print app), I get a PDF file with the title, footer and nothing else.
Or, if I have an overlay with extra features turned on, those appear
as well (i.e. Icons, points of interest, etc.), though all in the
center, not in their correct positions.

The map is essentially 2 layers (3 if you count the unused base layer):
1. The TMS map layer
2. The features/points-of-interest overlay layer, which is a Vector layer
3. The non-existent base layer.

The code creating them looks like this:
        map = new OpenLayers.Map('ext-gen43', options);
        layer = new OpenLayers.Layer.Vector('POI');
        tmsLayer = new OpenLayers.Layer.TMS( mapTitle,
                mapUrl, {displayOutsideMaxExtent: false, layername: 'db',
serviceVersion: '1.0',  type:'png'} );
        map.addLayers([tmsLayer, layer]);
        map.addLayer(new OpenLayers.Layer("No base layer",{isBaseLayer: true}));

I only added the base layer after the printing wasn't working, it
hasn't affected anything, but it was mentioned as a good idea on the
"How to Optimize" page of the wiki.

The printAction, customized, looks like this:
        var print = new mapfish.widgets.print.PrintAction({
                map: map,
                configUrl: '/epso/pdf/info.json',
                overrides: {},
                fillSpec: function(printCommand) {
                        mapfish.widgets.print.PrintAction.prototype.fillSpec.call(this,
printCommand);
       
                        //our layout needs two fields... hard code them here
                        printCommand.spec.comment = "No comment";
                        printCommand.spec.mapTitle = tmsLayer.name;
                        printCommand.spec.layout = "A4 portrait";
                        printCommand.spec.pages = [
                                {
                                        center: [6, 45.5],
                                        scale: 4000000,
                                        dpi: 190
                                }
                        ]
                        layers: [
                                {
                                        type: 'TMS',
                                        layers: ['db'],
                                        baseURL: tmsLayer.mapURL,
                                        format: 'image/png'
                                },
                                {
                                        type: 'Vector',
                                        layers: ['POI'],
                                        baseURL: '',
                                        format: 'image/png'
                                }
                        ]
                }
        });

Here is my config.yaml.  joker.spiekerpoint.com is my machine, and we
run via https:, so that's why it's port 8443:
#===========================================================================
# allowed DPIs
#===========================================================================
dpis:
  - 254
  - 190
  - 127
  - 56

#===========================================================================
# the allowed scales
#===========================================================================
scales:
  - 25000
  - 50000
  - 100000
  - 200000
  - 500000
  - 1000000
  - 2000000
  - 4000000
  - 8000000
  - 16000000
  - 32000000
  - 64000000

#===========================================================================
# the list of allowed hosts
#===========================================================================
#  - !ipMatch1
#    ip: www.camptocamp.org
#  - !dnsMatch
#    host: labs.metacarta.com
#    port: 80
#  - !dnsMatch
#    host: demo.mapfish.org
#    port: 80
hosts:
  - !localMatch
    dummy: true
  - !dnsMatch
    host: joker.spiekerpoint.com
    port: 8443

layouts:
  #===========================================================================
  A4 portrait:
  #===========================================================================
    mainPage:
      rotation: true
      pageSize: A4
      header:
        height: 50
        items:
          - !text
            font: Helvetica
            fontSize: 30
            align: right
            text: '${mapTitle}'
      items:
        - !map
          spacingAfter: 30
          width: 440
          height: 483
        - !text
          text: '${comment}'
          spacingAfter: 30
        - !scalebar
          maxSize: 150
      footer:
        height: 30
        items:
          - !columns
            items:
              - !text
                backgroundColor: #FF0000
                align: left
                text: © 2006-2009 Hour-Zero Crisis Consulting Ltd
              - !text
                align: right
                text: 'Page ${pageNum}'
----EOF----

Any thoughts on where my problem is?  Is there something I could look
at to see why it's not showing the main layer?

Thanks for any help.
--
Mike Totman

S P I E K E R   P O I N T   I N C
9675 45 Ave NW Edmonton AB
http://www.spiekerpoint.com
_______________________________________________
Users mailing list
Users@...
http://www.mapfish.org/cgi-bin/mailman/listinfo/users

Re: Print servlet not printing OpenLayers.TMS layer

by Eric Lemoine-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Mike

The print module does not support TMS layers. It supports TileCache
layers though. Sorry for that.


On Saturday, May 23, 2009, Mike Totman <mtotman@...> wrote:

> I have an app I've inherited that was already using OpenLayers to do
> its mapping, and I'm trying to get the MapFish print module to handle
> printing those maps to PDF.
>
> The application stores the map tiles in its own database and retrieves
> them by URL using a TMS layer which retrieves the tiles via a custom
> servlet that response to URLs encoding the tiles in the
> zoomlevel/row/column format.  e.g. /app/map/0/0/1.jpg
>
> I'm using the printer servlet installed as part of the application
> (which is running under JBoss 4.2) and it seems to work fine.  Calls
> to pdf/info.json return the appropriate result.
>
> When I try to print (I added a PrintAction stolen from the sample
> print app), I get a PDF file with the title, footer and nothing else.
> Or, if I have an overlay with extra features turned on, those appear
> as well (i.e. Icons, points of interest, etc.), though all in the
> center, not in their correct positions.
>
> The map is essentially 2 layers (3 if you count the unused base layer):
> 1. The TMS map layer
> 2. The features/points-of-interest overlay layer, which is a Vector layer
> 3. The non-existent base layer.
>
> The code creating them looks like this:
>         map = new OpenLayers.Map('ext-gen43', options);
>         layer = new OpenLayers.Layer.Vector('POI');
>         tmsLayer = new OpenLayers.Layer.TMS( mapTitle,
>                 mapUrl, {displayOutsideMaxExtent: false, layername: 'db',
> serviceVersion: '1.0',  type:'png'} );
>         map.addLayers([tmsLayer, layer]);
>         map.addLayer(new OpenLayers.Layer("No base layer",{isBaseLayer: true}));
>
> I only added the base layer after the printing wasn't working, it
> hasn't affected anything, but it was mentioned as a good idea on the
> "How to Optimize" page of the wiki.
>
> The printAction, customized, looks like this:
>         var print = new mapfish.widgets.print.PrintAction({
>                 map: map,
>                 configUrl: '/epso/pdf/info.json',
>                 overrides:      {},
>                 fillSpec: function(printCommand) {
>                         mapfish.widgets.print.PrintAction.prototype.fillSpec.call(this,
> printCommand);
>
>                         //our layout needs two fields... hard code them here
>                         printCommand.spec.comment = "No comment";
>                         printCommand.spec.mapTitle = tmsLayer.name;
>                         printCommand.spec.layout = "A4 portrait";
>                         printCommand.spec.pages = [
>                                 {
>                                         center: [6, 45.5],
>                                         scale: 4000000,
>                                         dpi: 190
>                                 }
>                         ]
>                         layers: [
>                                 {
>                                         type: 'TMS',
>                                         layers: ['db'],
>                                         baseURL: tmsLayer.mapURL,
>                                         format: 'image/png'
>                                 },
>                                 {
>                                         type: 'Vector',
>                                         layers: ['POI'],
>                                         baseURL: '',
>                                         format: 'image/png'
>                                 }
>                         ]
>                 }
>         });
>
> Here is my config.yaml.  joker.spiekerpoint.com is my machine, and we
> run via https:, so that's why it's port 8443:
> #===========================================================================
> # allowed DPIs
> #===========================================================================
> dpis:
>   - 254
>   - 190
>   - 127
>   - 56
>
> #===========================================================================
> # the allowed scales
> #===========================================================================
> scales:
>   - 25000
>   - 50000
>   - 100000
>   - 200000
>   - 500000
>   - 1000000
>   - 2000000
>   - 4000000
>   - 8000000
>   - 16000000
>   - 32000000
>   - 64000000
>
> #===========================================================================
> # the list of allowed hosts
> #===========================================================================
> #  - !ipMatch1
> #    ip: www.camptocamp.org
> #  - !dnsMatch
> #    host: labs.metacarta.com
> #    port: 80
> #  - !dnsMatch
> #    host: demo.mapfish.org
> #    port: 80
> hosts:
>   - !localMatch
>     dummy: true
>   - !dnsMatch
>     host: joker.spiekerpoint.com
>     port: 8443
>
> layouts:
>   #===========================================================================
>   A4 portrait:
>   #===========================================================================
>     mainPage:
>       rotation: true
>       pageSize: A4
>       header:
>         height: 50
>         items:
>           - !text
>             font: Helvetica
>             fontSize: 30
>             align: right
>             text: '${mapTitle}'
>       items:
>         - !map
>           spacingAfter: 30
>           width: 440
>           height: 483
>         - !text
>           text: '${comment}'
>           spacingAfter: 30
>         - !scalebar
>           maxSize: 150
>       footer:
>         height: 30
>         items:
>           - !columns
>             items:
>               - !text
>                 backgroundColor: #FF0000
>                 align: left
>                 text: © 2006-2009 Hour-Zero Crisis Consulting Ltd
>               - !text
>                 align: right
>                 text: 'Page ${pageNum}'
> ----EOF----
>
> Any thoughts on where my problem is?  Is there something I could look
> at to see why it's not showing the main layer?
>
> Thanks for any help.
> --
> Mike Totman
>
> S P I E K E R   P O I N T   I N C
> 9675 45 Ave NW Edmonton AB
> http://www.spiekerpoint.com
> _______________________________________________
> Users mailing list
> Users@...
> http://www.mapfish.org/cgi-bin/mailman/listinfo/users
>

--
Eric Lemoine

Camptocamp France SAS
Savoie Technolac, BP 352
73377 Le Bourget du Lac, Cedex

Tel : 00 33 4 79 44 44 96
Mail : eric.lemoine@...
http://www.camptocamp.com
_______________________________________________
Users mailing list
Users@...
http://www.mapfish.org/cgi-bin/mailman/listinfo/users

Re: Print servlet not printing OpenLayers.TMS layer

by Mike Totman :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

So what would be involved in creating support for TMS?  I don't know
the details of the OpenLayers or MapFish implementations, so how
likely would it be for me to create that?

On Sat, May 23, 2009 at 2:49 PM, Eric Lemoine
<eric.lemoine@...> wrote:

> Hi Mike
>
> The print module does not support TMS layers. It supports TileCache
> layers though. Sorry for that.
>
>
> On Saturday, May 23, 2009, Mike Totman <mtotman@...> wrote:
>> I have an app I've inherited that was already using OpenLayers to do
>> its mapping, and I'm trying to get the MapFish print module to handle
>> printing those maps to PDF.
>>
>> The application stores the map tiles in its own database and retrieves
>> them by URL using a TMS layer which retrieves the tiles via a custom
>> servlet that response to URLs encoding the tiles in the
>> zoomlevel/row/column format.  e.g. /app/map/0/0/1.jpg
>>
>> I'm using the printer servlet installed as part of the application
>> (which is running under JBoss 4.2) and it seems to work fine.  Calls
>> to pdf/info.json return the appropriate result.
>>
>> When I try to print (I added a PrintAction stolen from the sample
>> print app), I get a PDF file with the title, footer and nothing else.
>> Or, if I have an overlay with extra features turned on, those appear
>> as well (i.e. Icons, points of interest, etc.), though all in the
>> center, not in their correct positions.
>>
>> The map is essentially 2 layers (3 if you count the unused base layer):
>> 1. The TMS map layer
>> 2. The features/points-of-interest overlay layer, which is a Vector layer
>> 3. The non-existent base layer.
>>
>> The code creating them looks like this:
>>         map = new OpenLayers.Map('ext-gen43', options);
>>         layer = new OpenLayers.Layer.Vector('POI');
>>         tmsLayer = new OpenLayers.Layer.TMS( mapTitle,
>>                 mapUrl, {displayOutsideMaxExtent: false, layername: 'db',
>> serviceVersion: '1.0',  type:'png'} );
>>         map.addLayers([tmsLayer, layer]);
>>         map.addLayer(new OpenLayers.Layer("No base layer",{isBaseLayer: true}));
>>
>> I only added the base layer after the printing wasn't working, it
>> hasn't affected anything, but it was mentioned as a good idea on the
>> "How to Optimize" page of the wiki.
>>
>> The printAction, customized, looks like this:
>>         var print = new mapfish.widgets.print.PrintAction({
>>                 map: map,
>>                 configUrl: '/epso/pdf/info.json',
>>                 overrides:      {},
>>                 fillSpec: function(printCommand) {
>>                         mapfish.widgets.print.PrintAction.prototype.fillSpec.call(this,
>> printCommand);
>>
>>                         //our layout needs two fields... hard code them here
>>                         printCommand.spec.comment = "No comment";
>>                         printCommand.spec.mapTitle = tmsLayer.name;
>>                         printCommand.spec.layout = "A4 portrait";
>>                         printCommand.spec.pages = [
>>                                 {
>>                                         center: [6, 45.5],
>>                                         scale: 4000000,
>>                                         dpi: 190
>>                                 }
>>                         ]
>>                         layers: [
>>                                 {
>>                                         type: 'TMS',
>>                                         layers: ['db'],
>>                                         baseURL: tmsLayer.mapURL,
>>                                         format: 'image/png'
>>                                 },
>>                                 {
>>                                         type: 'Vector',
>>                                         layers: ['POI'],
>>                                         baseURL: '',
>>                                         format: 'image/png'
>>                                 }
>>                         ]
>>                 }
>>         });
>>
>> Here is my config.yaml.  joker.spiekerpoint.com is my machine, and we
>> run via https:, so that's why it's port 8443:
>> #===========================================================================
>> # allowed DPIs
>> #===========================================================================
>> dpis:
>>   - 254
>>   - 190
>>   - 127
>>   - 56
>>
>> #===========================================================================
>> # the allowed scales
>> #===========================================================================
>> scales:
>>   - 25000
>>   - 50000
>>   - 100000
>>   - 200000
>>   - 500000
>>   - 1000000
>>   - 2000000
>>   - 4000000
>>   - 8000000
>>   - 16000000
>>   - 32000000
>>   - 64000000
>>
>> #===========================================================================
>> # the list of allowed hosts
>> #===========================================================================
>> #  - !ipMatch1
>> #    ip: www.camptocamp.org
>> #  - !dnsMatch
>> #    host: labs.metacarta.com
>> #    port: 80
>> #  - !dnsMatch
>> #    host: demo.mapfish.org
>> #    port: 80
>> hosts:
>>   - !localMatch
>>     dummy: true
>>   - !dnsMatch
>>     host: joker.spiekerpoint.com
>>     port: 8443
>>
>> layouts:
>>   #===========================================================================
>>   A4 portrait:
>>   #===========================================================================
>>     mainPage:
>>       rotation: true
>>       pageSize: A4
>>       header:
>>         height: 50
>>         items:
>>           - !text
>>             font: Helvetica
>>             fontSize: 30
>>             align: right
>>             text: '${mapTitle}'
>>       items:
>>         - !map
>>           spacingAfter: 30
>>           width: 440
>>           height: 483
>>         - !text
>>           text: '${comment}'
>>           spacingAfter: 30
>>         - !scalebar
>>           maxSize: 150
>>       footer:
>>         height: 30
>>         items:
>>           - !columns
>>             items:
>>               - !text
>>                 backgroundColor: #FF0000
>>                 align: left
>>                 text: © 2006-2009 Hour-Zero Crisis Consulting Ltd
>>               - !text
>>                 align: right
>>                 text: 'Page ${pageNum}'
>> ----EOF----
>>
>> Any thoughts on where my problem is?  Is there something I could look
>> at to see why it's not showing the main layer?
>>
>> Thanks for any help.
>> --
>> Mike Totman
>>
>> S P I E K E R   P O I N T   I N C
>> 9675 45 Ave NW Edmonton AB
>> http://www.spiekerpoint.com
>> _______________________________________________
>> Users mailing list
>> Users@...
>> http://www.mapfish.org/cgi-bin/mailman/listinfo/users
>>
>
> --
> Eric Lemoine
>
> Camptocamp France SAS
> Savoie Technolac, BP 352
> 73377 Le Bourget du Lac, Cedex
>
> Tel : 00 33 4 79 44 44 96
> Mail : eric.lemoine@...
> http://www.camptocamp.com
>



--
Mike Totman

S P I E K E R   P O I N T   I N C
9675 45 Ave NW Edmonton AB
http://www.spiekerpoint.com
_______________________________________________
Users mailing list
Users@...
http://www.mapfish.org/cgi-bin/mailman/listinfo/users

Re: Print servlet not printing OpenLayers.TMS layer

by Mike Totman :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Or, since you mentioned Tile Cache support, can I use something like
the software at http://tilecache.org to create a TileCache server from
my existing TMS server/interface?

On Mon, May 25, 2009 at 10:56 AM, Mike Totman <mtotman@...> wrote:

> So what would be involved in creating support for TMS?  I don't know
> the details of the OpenLayers or MapFish implementations, so how
> likely would it be for me to create that?
>
> On Sat, May 23, 2009 at 2:49 PM, Eric Lemoine
> <eric.lemoine@...> wrote:
>> Hi Mike
>>
>> The print module does not support TMS layers. It supports TileCache
>> layers though. Sorry for that.
>>
>>
>> On Saturday, May 23, 2009, Mike Totman <mtotman@...> wrote:
>>> I have an app I've inherited that was already using OpenLayers to do
>>> its mapping, and I'm trying to get the MapFish print module to handle
>>> printing those maps to PDF.
>>>
>>> The application stores the map tiles in its own database and retrieves
>>> them by URL using a TMS layer which retrieves the tiles via a custom
>>> servlet that response to URLs encoding the tiles in the
>>> zoomlevel/row/column format.  e.g. /app/map/0/0/1.jpg
>>>
>>> I'm using the printer servlet installed as part of the application
>>> (which is running under JBoss 4.2) and it seems to work fine.  Calls
>>> to pdf/info.json return the appropriate result.
>>>
>>> When I try to print (I added a PrintAction stolen from the sample
>>> print app), I get a PDF file with the title, footer and nothing else.
>>> Or, if I have an overlay with extra features turned on, those appear
>>> as well (i.e. Icons, points of interest, etc.), though all in the
>>> center, not in their correct positions.
>>>
>>> The map is essentially 2 layers (3 if you count the unused base layer):
>>> 1. The TMS map layer
>>> 2. The features/points-of-interest overlay layer, which is a Vector layer
>>> 3. The non-existent base layer.
>>>
>>> The code creating them looks like this:
>>>         map = new OpenLayers.Map('ext-gen43', options);
>>>         layer = new OpenLayers.Layer.Vector('POI');
>>>         tmsLayer = new OpenLayers.Layer.TMS( mapTitle,
>>>                 mapUrl, {displayOutsideMaxExtent: false, layername: 'db',
>>> serviceVersion: '1.0',  type:'png'} );
>>>         map.addLayers([tmsLayer, layer]);
>>>         map.addLayer(new OpenLayers.Layer("No base layer",{isBaseLayer: true}));
>>>
>>> I only added the base layer after the printing wasn't working, it
>>> hasn't affected anything, but it was mentioned as a good idea on the
>>> "How to Optimize" page of the wiki.
>>>
>>> The printAction, customized, looks like this:
>>>         var print = new mapfish.widgets.print.PrintAction({
>>>                 map: map,
>>>                 configUrl: '/epso/pdf/info.json',
>>>                 overrides:      {},
>>>                 fillSpec: function(printCommand) {
>>>                         mapfish.widgets.print.PrintAction.prototype.fillSpec.call(this,
>>> printCommand);
>>>
>>>                         //our layout needs two fields... hard code them here
>>>                         printCommand.spec.comment = "No comment";
>>>                         printCommand.spec.mapTitle = tmsLayer.name;
>>>                         printCommand.spec.layout = "A4 portrait";
>>>                         printCommand.spec.pages = [
>>>                                 {
>>>                                         center: [6, 45.5],
>>>                                         scale: 4000000,
>>>                                         dpi: 190
>>>                                 }
>>>                         ]
>>>                         layers: [
>>>                                 {
>>>                                         type: 'TMS',
>>>                                         layers: ['db'],
>>>                                         baseURL: tmsLayer.mapURL,
>>>                                         format: 'image/png'
>>>                                 },
>>>                                 {
>>>                                         type: 'Vector',
>>>                                         layers: ['POI'],
>>>                                         baseURL: '',
>>>                                         format: 'image/png'
>>>                                 }
>>>                         ]
>>>                 }
>>>         });
>>>
>>> Here is my config.yaml.  joker.spiekerpoint.com is my machine, and we
>>> run via https:, so that's why it's port 8443:
>>> #===========================================================================
>>> # allowed DPIs
>>> #===========================================================================
>>> dpis:
>>>   - 254
>>>   - 190
>>>   - 127
>>>   - 56
>>>
>>> #===========================================================================
>>> # the allowed scales
>>> #===========================================================================
>>> scales:
>>>   - 25000
>>>   - 50000
>>>   - 100000
>>>   - 200000
>>>   - 500000
>>>   - 1000000
>>>   - 2000000
>>>   - 4000000
>>>   - 8000000
>>>   - 16000000
>>>   - 32000000
>>>   - 64000000
>>>
>>> #===========================================================================
>>> # the list of allowed hosts
>>> #===========================================================================
>>> #  - !ipMatch1
>>> #    ip: www.camptocamp.org
>>> #  - !dnsMatch
>>> #    host: labs.metacarta.com
>>> #    port: 80
>>> #  - !dnsMatch
>>> #    host: demo.mapfish.org
>>> #    port: 80
>>> hosts:
>>>   - !localMatch
>>>     dummy: true
>>>   - !dnsMatch
>>>     host: joker.spiekerpoint.com
>>>     port: 8443
>>>
>>> layouts:
>>>   #===========================================================================
>>>   A4 portrait:
>>>   #===========================================================================
>>>     mainPage:
>>>       rotation: true
>>>       pageSize: A4
>>>       header:
>>>         height: 50
>>>         items:
>>>           - !text
>>>             font: Helvetica
>>>             fontSize: 30
>>>             align: right
>>>             text: '${mapTitle}'
>>>       items:
>>>         - !map
>>>           spacingAfter: 30
>>>           width: 440
>>>           height: 483
>>>         - !text
>>>           text: '${comment}'
>>>           spacingAfter: 30
>>>         - !scalebar
>>>           maxSize: 150
>>>       footer:
>>>         height: 30
>>>         items:
>>>           - !columns
>>>             items:
>>>               - !text
>>>                 backgroundColor: #FF0000
>>>                 align: left
>>>                 text: © 2006-2009 Hour-Zero Crisis Consulting Ltd
>>>               - !text
>>>                 align: right
>>>                 text: 'Page ${pageNum}'
>>> ----EOF----
>>>
>>> Any thoughts on where my problem is?  Is there something I could look
>>> at to see why it's not showing the main layer?
>>>
>>> Thanks for any help.
>>> --
>>> Mike Totman
>>>
>>> S P I E K E R   P O I N T   I N C
>>> 9675 45 Ave NW Edmonton AB
>>> http://www.spiekerpoint.com
>>> _______________________________________________
>>> Users mailing list
>>> Users@...
>>> http://www.mapfish.org/cgi-bin/mailman/listinfo/users
>>>
>>
>> --
>> Eric Lemoine
>>
>> Camptocamp France SAS
>> Savoie Technolac, BP 352
>> 73377 Le Bourget du Lac, Cedex
>>
>> Tel : 00 33 4 79 44 44 96
>> Mail : eric.lemoine@...
>> http://www.camptocamp.com
>>
>
>
>
> --
> Mike Totman
>
> S P I E K E R   P O I N T   I N C
> 9675 45 Ave NW Edmonton AB
> http://www.spiekerpoint.com
>



--
Mike Totman

S P I E K E R   P O I N T   I N C
9675 45 Ave NW Edmonton AB
http://www.spiekerpoint.com
_______________________________________________
Users mailing list
Users@...
http://www.mapfish.org/cgi-bin/mailman/listinfo/users

Re: Print servlet not printing OpenLayers.TMS layer

by Mike Totman :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Ok, so now I've read a bunch of stuff about TileCache, I'd like to get
confirmation about my understanding of the situation.

Reviewing what I think is the relevant background:
Currently, our app stores tiles (pre-made, via gdal2tiles.py) in our
own database, for many different maps, which are uploaded by the user.
We serve them up via a custom servlet that accepts URLs of the form:
    https://joker.spiekerpoint.com:8443/epso/servlet/maps?mapid=13&file=1.0/db/2/0/2.png

We are using OpenLayers to display these maps on the client side,
using a call like:
    tmsLayer = new OpenLayers.Layer.TMS( mapTitle, mapUrl,
{displayOutsideMaxExtent: false, layername: 'db', serviceVersion:
'1.0',  type:'png'} );
where "mapUrl" is the request URL above, starting at "/epso/...".

Now, you say the MapFish print module supports TileCache, I'm not sure
where that fits into this model.  Does TileCache essentially fit "in
between" our servlet at the request from the MapFish module,
essentially translating the request from MapFish?  Or is it just
another way of requesting the same tiles that our servlet is
providing?  Or do I have the whole model/architecture confused?

Perhaps some "diagrams" will help.

Our current system:
OL --request--> Our servlet --> DB ==> returns map tile stored in database

With TileCache:
1) OL --request--> TC --> Our servlet --> DB ==> returns map tile
stored in datbase
or,
2) OL --request--> TC --> DB ==> returns map tile stored in datbase

If one of these two is right (#2 might require some extra code/glue),
I'm still unclear then how to configure the print module to use the TC
way.  Do I have to create an OpenLayers.Layer.TileCache() object the
same way as the OpenLayers.Layer.TMS() object above?

On Mon, May 25, 2009 at 11:06 AM, Mike Totman <mtotman@...> wrote:

>
> Or, since you mentioned Tile Cache support, can I use something like
> the software at http://tilecache.org to create a TileCache server from
> my existing TMS server/interface?
>
> On Mon, May 25, 2009 at 10:56 AM, Mike Totman <mtotman@...> wrote:
> > So what would be involved in creating support for TMS?  I don't know
> > the details of the OpenLayers or MapFish implementations, so how
> > likely would it be for me to create that?
> >
> > On Sat, May 23, 2009 at 2:49 PM, Eric Lemoine
> > <eric.lemoine@...> wrote:
> >> Hi Mike
> >>
> >> The print module does not support TMS layers. It supports TileCache
> >> layers though. Sorry for that.
> >>
> >>
> >> On Saturday, May 23, 2009, Mike Totman <mtotman@...> wrote:
> >>> I have an app I've inherited that was already using OpenLayers to do
> >>> its mapping, and I'm trying to get the MapFish print module to handle
> >>> printing those maps to PDF.
> >>>
> >>> The application stores the map tiles in its own database and retrieves
> >>> them by URL using a TMS layer which retrieves the tiles via a custom
> >>> servlet that response to URLs encoding the tiles in the
> >>> zoomlevel/row/column format.  e.g. /app/map/0/0/1.jpg
> >>>
> >>> I'm using the printer servlet installed as part of the application
> >>> (which is running under JBoss 4.2) and it seems to work fine.  Calls
> >>> to pdf/info.json return the appropriate result.
> >>>
> >>> When I try to print (I added a PrintAction stolen from the sample
> >>> print app), I get a PDF file with the title, footer and nothing else.
> >>> Or, if I have an overlay with extra features turned on, those appear
> >>> as well (i.e. Icons, points of interest, etc.), though all in the
> >>> center, not in their correct positions.
> >>>
> >>> The map is essentially 2 layers (3 if you count the unused base layer):
> >>> 1. The TMS map layer
> >>> 2. The features/points-of-interest overlay layer, which is a Vector layer
> >>> 3. The non-existent base layer.
> >>>
> >>> The code creating them looks like this:
> >>>         map = new OpenLayers.Map('ext-gen43', options);
> >>>         layer = new OpenLayers.Layer.Vector('POI');
> >>>         tmsLayer = new OpenLayers.Layer.TMS( mapTitle,
> >>>                 mapUrl, {displayOutsideMaxExtent: false, layername: 'db',
> >>> serviceVersion: '1.0',  type:'png'} );
> >>>         map.addLayers([tmsLayer, layer]);
> >>>         map.addLayer(new OpenLayers.Layer("No base layer",{isBaseLayer: true}));
> >>>
> >>> I only added the base layer after the printing wasn't working, it
> >>> hasn't affected anything, but it was mentioned as a good idea on the
> >>> "How to Optimize" page of the wiki.
> >>>
> >>> The printAction, customized, looks like this:
> >>>         var print = new mapfish.widgets.print.PrintAction({
> >>>                 map: map,
> >>>                 configUrl: '/epso/pdf/info.json',
> >>>                 overrides:      {},
> >>>                 fillSpec: function(printCommand) {
> >>>                         mapfish.widgets.print.PrintAction.prototype.fillSpec.call(this,
> >>> printCommand);
> >>>
> >>>                         //our layout needs two fields... hard code them here
> >>>                         printCommand.spec.comment = "No comment";
> >>>                         printCommand.spec.mapTitle = tmsLayer.name;
> >>>                         printCommand.spec.layout = "A4 portrait";
> >>>                         printCommand.spec.pages = [
> >>>                                 {
> >>>                                         center: [6, 45.5],
> >>>                                         scale: 4000000,
> >>>                                         dpi: 190
> >>>                                 }
> >>>                         ]
> >>>                         layers: [
> >>>                                 {
> >>>                                         type: 'TMS',
> >>>                                         layers: ['db'],
> >>>                                         baseURL: tmsLayer.mapURL,
> >>>                                         format: 'image/png'
> >>>                                 },
> >>>                                 {
> >>>                                         type: 'Vector',
> >>>                                         layers: ['POI'],
> >>>                                         baseURL: '',
> >>>                                         format: 'image/png'
> >>>                                 }
> >>>                         ]
> >>>                 }
> >>>         });
> >>>
> >>> Here is my config.yaml.  joker.spiekerpoint.com is my machine, and we
> >>> run via https:, so that's why it's port 8443:
> >>> #===========================================================================
> >>> # allowed DPIs
> >>> #===========================================================================
> >>> dpis:
> >>>   - 254
> >>>   - 190
> >>>   - 127
> >>>   - 56
> >>>
> >>> #===========================================================================
> >>> # the allowed scales
> >>> #===========================================================================
> >>> scales:
> >>>   - 25000
> >>>   - 50000
> >>>   - 100000
> >>>   - 200000
> >>>   - 500000
> >>>   - 1000000
> >>>   - 2000000
> >>>   - 4000000
> >>>   - 8000000
> >>>   - 16000000
> >>>   - 32000000
> >>>   - 64000000
> >>>
> >>> #===========================================================================
> >>> # the list of allowed hosts
> >>> #===========================================================================
> >>> #  - !ipMatch1
> >>> #    ip: www.camptocamp.org
> >>> #  - !dnsMatch
> >>> #    host: labs.metacarta.com
> >>> #    port: 80
> >>> #  - !dnsMatch
> >>> #    host: demo.mapfish.org
> >>> #    port: 80
> >>> hosts:
> >>>   - !localMatch
> >>>     dummy: true
> >>>   - !dnsMatch
> >>>     host: joker.spiekerpoint.com
> >>>     port: 8443
> >>>
> >>> layouts:
> >>>   #===========================================================================
> >>>   A4 portrait:
> >>>   #===========================================================================
> >>>     mainPage:
> >>>       rotation: true
> >>>       pageSize: A4
> >>>       header:
> >>>         height: 50
> >>>         items:
> >>>           - !text
> >>>             font: Helvetica
> >>>             fontSize: 30
> >>>             align: right
> >>>             text: '${mapTitle}'
> >>>       items:
> >>>         - !map
> >>>           spacingAfter: 30
> >>>           width: 440
> >>>           height: 483
> >>>         - !text
> >>>           text: '${comment}'
> >>>           spacingAfter: 30
> >>>         - !scalebar
> >>>           maxSize: 150
> >>>       footer:
> >>>         height: 30
> >>>         items:
> >>>           - !columns
> >>>             items:
> >>>               - !text
> >>>                 backgroundColor: #FF0000
> >>>                 align: left
> >>>                 text: © 2006-2009 Hour-Zero Crisis Consulting Ltd
> >>>               - !text
> >>>                 align: right
> >>>                 text: 'Page ${pageNum}'
> >>> ----EOF----
> >>>
> >>> Any thoughts on where my problem is?  Is there something I could look
> >>> at to see why it's not showing the main layer?
> >>>
> >>> Thanks for any help.
> >>> --
> >>> Mike Totman
> >>>
> >>> S P I E K E R   P O I N T   I N C
> >>> 9675 45 Ave NW Edmonton AB
> >>> http://www.spiekerpoint.com
> >>> _______________________________________________
> >>> Users mailing list
> >>> Users@...
> >>> http://www.mapfish.org/cgi-bin/mailman/listinfo/users
> >>>
> >>
> >> --
> >> Eric Lemoine
> >>
> >> Camptocamp France SAS
> >> Savoie Technolac, BP 352
> >> 73377 Le Bourget du Lac, Cedex
> >>
> >> Tel : 00 33 4 79 44 44 96
> >> Mail : eric.lemoine@...
> >> http://www.camptocamp.com
> >>
> >
> >
> >
> > --
> > Mike Totman
> >
> > S P I E K E R   P O I N T   I N C
> > 9675 45 Ave NW Edmonton AB
> > http://www.spiekerpoint.com
> >
>
>
>
> --
> Mike Totman
>
> S P I E K E R   P O I N T   I N C
> 9675 45 Ave NW Edmonton AB
> http://www.spiekerpoint.com



--
Mike Totman

S P I E K E R   P O I N T   I N C
9675 45 Ave NW Edmonton AB
http://www.spiekerpoint.com
_______________________________________________
Users mailing list
Users@...
http://www.mapfish.org/cgi-bin/mailman/listinfo/users

Re: Print servlet not printing OpenLayers.TMS layer

by Eric Lemoine-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Sorry for the late reply. See my answers below.

On Tuesday, May 26, 2009, Mike Totman <mtotman@...> wrote:

> Ok, so now I've read a bunch of stuff about TileCache, I'd like to get
> confirmation about my understanding of the situation.
>
> Reviewing what I think is the relevant background:
> Currently, our app stores tiles (pre-made, via gdal2tiles.py) in our
> own database, for many different maps, which are uploaded by the user.
> We serve them up via a custom servlet that accepts URLs of the form:
>     https://joker.spiekerpoint.com:8443/epso/servlet/maps?mapid=13&file=1.0/db/2/0/2.png
>
> We are using OpenLayers to display these maps on the client side,
> using a call like:
>     tmsLayer = new OpenLayers.Layer.TMS( mapTitle, mapUrl,
> {displayOutsideMaxExtent: false, layername: 'db', serviceVersion:
> '1.0',  type:'png'} );
> where "mapUrl" is the request URL above, starting at "/epso/...".
>
> Now, you say the MapFish print module supports TileCache, I'm not sure
> where that fits into this model.  Does TileCache essentially fit "in
> between" our servlet at the request from the MapFish module,
> essentially translating the request from MapFish?  Or is it just
> another way of requesting the same tiles that our servlet is
> providing?  Or do I have the whole model/architecture confused?

TileCache traditionally seats between OpenLayers and the map server,
it caches the tiles received from the map server. TileCache can act as
a WMS server, so it can be used by any WMS client.

>
> Perhaps some "diagrams" will help.
>
> Our current system:
> OL --request--> Our servlet --> DB ==> returns map tile stored in database
>
> With TileCache:
> 1) OL --request--> TC --> Our servlet --> DB ==> returns map tile
> stored in datbase

I doubt TC would be able to communicate with your servlet.


> or,
> 2) OL --request--> TC --> DB ==> returns map tile stored in datbase

It depends on what DB is. If DB is a directory of tiles laid out the
TC way then yes.

>
> If one of these two is right (#2 might require some extra code/glue),
> I'm still unclear then how to configure the print module to use the TC
> way.  Do I have to create an OpenLayers.Layer.TileCache() object the

Layer.TileCache allows accessing tiles arranged in a certain way (the
TC way) directly from the HTTP server (Apache) - TC isn't even needed.
This works if all your tiles are in the cache. The print module
supports Layer.TileCache layers.

Hope this clarifies things

> same way as the OpenLayers.Layer.TMS() object above?
>
> On Mon, May 25, 2009 at 11:06 AM, Mike Totman <mtotman@...> wrote:
>>
>> Or, since you mentioned Tile Cache support, can I use something like
>> the software at http://tilecache.org to create a TileCache server from
>> my existing TMS server/interface?
>>
>> On Mon, May 25, 2009 at 10:56 AM, Mike Totman <mtotman@...> wrote:
>> > So what would be involved in creating support for TMS?  I don't know
>> > the details of the OpenLayers or MapFish implementations, so how
>> > likely would it be for me to create that?
>> >
>> > On Sat, May 23, 2009 at 2:49 PM, Eric Lemoine
>> > <eric.lemoine@...> wrote:
>> >> Hi Mike
>> >>
>> >> The print module does not support TMS layers. It supports TileCache
>> >> layers though. Sorry for that.
>> >>
>> >>
>> >> On Saturday, May 23, 2009, Mike Totman <mtotman@...> wrote:
>> >>> I have an app I've inherited that was already using OpenLayers to do
>> >>> its mapping, and I'm trying to get the MapFish print module to handle
>> >>> printing those maps to PDF.
>> >>>
>> >>> The application stores the map tiles in its own database and retrieves
>> >>> them by URL using a TMS layer which retrieves the tiles via a custom
>> >>> servlet that response to URLs encoding the tiles in the
>> >>> zoomlevel/row/column format.  e.g. /app/map/0/0/1.jpg
>> >>>
>> >>> I'm using the printer servlet installed as part of the application
>> >>> (which is running under JBoss 4.2) and it seems to work fine.  Calls
>> >>> to pdf/info.json return the appropriate result.
>> >>>
>> >>> When I try to print (I added a PrintAction stolen from the sample
>> >>> print app), I get a PDF file with the title, footer and nothing else.
>> >>> Or, if I have an overlay with extra features turned on, those appear
>> >>> as well (i.e. Icons, points of interest, etc.), though all in the
>> >>> center, not in their correct positions.
>> >>>
>> >>> The map is essentially 2 layers (3 if you count the unused base layer):
>> >>> 1. The TMS map layer
>> >>> 2. The features/points-of-interest overlay layer, which is a Vector layer
>> >>> 3. The non-existent base layer.
>> >>>
>> >>> The code creating them looks like this:
>> >>>         map = new OpenLayers.Map('ext-gen43', options);
>> >>>         layer = new OpenLayers.Layer.Vector('POI');
>> >>>         tmsLayer = new OpenLayers.Layer.TMS( mapTitle,
>> >>>                 mapUrl, {displayOutsideMaxExtent: false, layername: 'db',
>> >>> serviceVersion: '1.0',  type:'png'} );
>> >>>         map.addLayers([tmsLayer, layer]);
>> >>>         map.addLayer(new OpenLayers.Layer("No base layer",{isBaseLayer: true}));
>> >>>
>> >>> I only added the base layer after the printing wasn't working, it
>> >>> hasn't affected anything, but it was mentioned as a good idea on the
>> >>> "How to Optimize" page of the wiki.
>> >>>
>> >>> The printAction, customized, looks like this:
>> >>>         var print = new mapfish.widgets.print.PrintAction({
>> >>>                 map: map,
>> >>>                 configUrl: '/epso/pdf/info.json',
>> >>>                 overrides:      {},
>> >>>                 fillSpec: function(printCommand) {
>> >>>                         mapfish.widgets.print.PrintAction.prototyp

--
Eric Lemoine

Camptocamp France SAS
Savoie Technolac, BP 352
73377 Le Bourget du Lac, Cedex

Tel : 00 33 4 79 44 44 96
Mail : eric.lemoine@...
http://www.camptocamp.com
_______________________________________________
Users mailing list
Users@...
http://www.mapfish.org/cgi-bin/mailman/listinfo/users

Re: Print servlet not printing OpenLayers.TMS layer

by Mike Totman :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Returning to this thread after a long time off, due to distraction and changed priorities.

Once again, I'm trying to get MapFish printing to work for a TMS layer in our OpenLayers app.  I know MapFish doesn't currently support TMS layers, and I can't find any other tools that can translate TMS to another format MapFish understands (e.g. WMS), so I'm wondering what it would take for me to add support for TMS to MapFish, at least in a limited way needed for our app?

Or is there a tool that can do the translation/presentation of TMS as WMS (or whatever) so MapFish can print our maps? I've looked at GeoWebCache and GeoMoose, but at best they serve up WMS like TMS, not the other way around.

On Mon, May 25, 2009 at 10:56 AM, Mike Totman <mtotman@...> wrote:
So what would be involved in creating support for TMS?  I don't know
the details of the OpenLayers or MapFish implementations, so how
likely would it be for me to create that?

On Sat, May 23, 2009 at 2:49 PM, Eric Lemoine
<eric.lemoine@...> wrote:
> Hi Mike
>
> The print module does not support TMS layers. It supports TileCache
> layers though. Sorry for that.
>
>
> On Saturday, May 23, 2009, Mike Totman <mtotman@...> wrote:
>> I have an app I've inherited that was already using OpenLayers to do
>> its mapping, and I'm trying to get the MapFish print module to handle
>> printing those maps to PDF.
>>
>> The application stores the map tiles in its own database and retrieves
>> them by URL using a TMS layer which retrieves the tiles via a custom
>> servlet that response to URLs encoding the tiles in the
>> zoomlevel/row/column format.  e.g. /app/map/0/0/1.jpg
>>
>> I'm using the printer servlet installed as part of the application
>> (which is running under JBoss 4.2) and it seems to work fine.  Calls
>> to pdf/info.json return the appropriate result.
>>
>> When I try to print (I added a PrintAction stolen from the sample
>> print app), I get a PDF file with the title, footer and nothing else.
>> Or, if I have an overlay with extra features turned on, those appear
>> as well (i.e. Icons, points of interest, etc.), though all in the
>> center, not in their correct positions.
>>
>> The map is essentially 2 layers (3 if you count the unused base layer):
>> 1. The TMS map layer
>> 2. The features/points-of-interest overlay layer, which is a Vector layer
>> 3. The non-existent base layer.
>>
>> The code creating them looks like this:
>>         map = new OpenLayers.Map('ext-gen43', options);
>>         layer = new OpenLayers.Layer.Vector('POI');
>>         tmsLayer = new OpenLayers.Layer.TMS( mapTitle,
>>                 mapUrl, {displayOutsideMaxExtent: false, layername: 'db',
>> serviceVersion: '1.0',  type:'png'} );
>>         map.addLayers([tmsLayer, layer]);
>>         map.addLayer(new OpenLayers.Layer("No base layer",{isBaseLayer: true}));
>>
>> I only added the base layer after the printing wasn't working, it
>> hasn't affected anything, but it was mentioned as a good idea on the
>> "How to Optimize" page of the wiki.
>>
>> The printAction, customized, looks like this:
>>         var print = new mapfish.widgets.print.PrintAction({
>>                 map: map,
>>                 configUrl: '/epso/pdf/info.json',
>>                 overrides:      {},
>>                 fillSpec: function(printCommand) {
>>                         mapfish.widgets.print.PrintAction.prototype.fillSpec.call(this,
>> printCommand);
>>
>>                         //our layout needs two fields... hard code them here
>>                         printCommand.spec.comment = "No comment";
>>                         printCommand.spec.mapTitle = tmsLayer.name;
>>                         printCommand.spec.layout = "A4 portrait";
>>                         printCommand.spec.pages = [
>>                                 {
>>                                         center: [6, 45.5],
>>                                         scale: 4000000,
>>                                         dpi: 190
>>                                 }
>>                         ]
>>                         layers: [
>>                                 {
>>                                         type: 'TMS',
>>                                         layers: ['db'],
>>                                         baseURL: tmsLayer.mapURL,
>>                                         format: 'image/png'
>>                                 },
>>                                 {
>>                                         type: 'Vector',
>>                                         layers: ['POI'],
>>                                         baseURL: '',
>>                                         format: 'image/png'
>>                                 }
>>                         ]
>>                 }
>>         });
>>
>> Here is my config.yaml.  joker.spiekerpoint.com is my machine, and we
>> run via https:, so that's why it's port 8443:
>> #===========================================================================
>> # allowed DPIs
>> #===========================================================================
>> dpis:
>>   - 254
>>   - 190
>>   - 127
>>   - 56
>>
>> #===========================================================================
>> # the allowed scales
>> #===========================================================================
>> scales:
>>   - 25000
>>   - 50000
>>   - 100000
>>   - 200000
>>   - 500000
>>   - 1000000
>>   - 2000000
>>   - 4000000
>>   - 8000000
>>   - 16000000
>>   - 32000000
>>   - 64000000
>>
>> #===========================================================================
>> # the list of allowed hosts
>> #===========================================================================
>> #  - !ipMatch1
>> #    ip: www.camptocamp.org
>> #  - !dnsMatch
>> #    host: labs.metacarta.com
>> #    port: 80
>> #  - !dnsMatch
>> #    host: demo.mapfish.org
>> #    port: 80
>> hosts:
>>   - !localMatch
>>     dummy: true
>>   - !dnsMatch
>>     host: joker.spiekerpoint.com
>>     port: 8443
>>
>> layouts:
>>   #===========================================================================
>>   A4 portrait:
>>   #===========================================================================
>>     mainPage:
>>       rotation: true
>>       pageSize: A4
>>       header:
>>         height: 50
>>         items:
>>           - !text
>>             font: Helvetica
>>             fontSize: 30
>>             align: right
>>             text: '${mapTitle}'
>>       items:
>>         - !map
>>           spacingAfter: 30
>>           width: 440
>>           height: 483
>>         - !text
>>           text: '${comment}'
>>           spacingAfter: 30
>>         - !scalebar
>>           maxSize: 150
>>       footer:
>>         height: 30
>>         items:
>>           - !columns
>>             items:
>>               - !text
>>                 backgroundColor: #FF0000
>>                 align: left
>>                 text: © 2006-2009 Hour-Zero Crisis Consulting Ltd
>>               - !text
>>                 align: right
>>                 text: 'Page ${pageNum}'
>> ----EOF----
>>
>> Any thoughts on where my problem is?  Is there something I could look
>> at to see why it's not showing the main layer?
>>
>> Thanks for any help.
>> --
>> Mike Totman
>>
>> S P I E K E R   P O I N T   I N C
>> 9675 45 Ave NW Edmonton AB
>> http://www.spiekerpoint.com
>> _______________________________________________
>> Users mailing list
>> Users@...
>> http://www.mapfish.org/cgi-bin/mailman/listinfo/users
>>
>
> --
> Eric Lemoine
>
> Camptocamp France SAS
> Savoie Technolac, BP 352
> 73377 Le Bourget du Lac, Cedex
>
> Tel : 00 33 4 79 44 44 96
> Mail : eric.lemoine@...
> http://www.camptocamp.com
>



--
Mike Totman

S P I E K E R   P O I N T   I N C
9675 45 Ave NW Edmonton AB
http://www.spiekerpoint.com



--
Mike Totman

S P I E K E R   P O I N T   I N C
9675 45 Ave NW Edmonton AB
http://www.spiekerpoint.com

_______________________________________________
Users mailing list
Users@...
http://www.mapfish.org/cgi-bin/mailman/listinfo/users

Re: Print servlet not printing OpenLayers.TMS layer

by Mike Totman :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Is there nowhere to get information on how to develop new layer support for MapFish?  I have been unable to find anything on the mapfish sites, or via Google.  I'd rather not try to develop blind.  Can anyone help?

On Tue, Oct 20, 2009 at 5:30 PM, Mike Totman <mtotman@...> wrote:
Returning to this thread after a long time off, due to distraction and changed priorities.

Once again, I'm trying to get MapFish printing to work for a TMS layer in our OpenLayers app.  I know MapFish doesn't currently support TMS layers, and I can't find any other tools that can translate TMS to another format MapFish understands (e.g. WMS), so I'm wondering what it would take for me to add support for TMS to MapFish, at least in a limited way needed for our app?

Or is there a tool that can do the translation/presentation of TMS as WMS (or whatever) so MapFish can print our maps? I've looked at GeoWebCache and GeoMoose, but at best they serve up WMS like TMS, not the other way around.


On Mon, May 25, 2009 at 10:56 AM, Mike Totman <mtotman@...> wrote:
So what would be involved in creating support for TMS?  I don't know
the details of the OpenLayers or MapFish implementations, so how
likely would it be for me to create that?

On Sat, May 23, 2009 at 2:49 PM, Eric Lemoine
<eric.lemoine@...> wrote:
> Hi Mike
>
> The print module does not support TMS layers. It supports TileCache
> layers though. Sorry for that.
>
>
> On Saturday, May 23, 2009, Mike Totman <mtotman@...> wrote:
>> I have an app I've inherited that was already using OpenLayers to do
>> its mapping, and I'm trying to get the MapFish print module to handle
>> printing those maps to PDF.
>>
>> The application stores the map tiles in its own database and retrieves
>> them by URL using a TMS layer which retrieves the tiles via a custom
>> servlet that response to URLs encoding the tiles in the
>> zoomlevel/row/column format.  e.g. /app/map/0/0/1.jpg
>>
>> I'm using the printer servlet installed as part of the application
>> (which is running under JBoss 4.2) and it seems to work fine.  Calls
>> to pdf/info.json return the appropriate result.
>>
>> When I try to print (I added a PrintAction stolen from the sample
>> print app), I get a PDF file with the title, footer and nothing else.
>> Or, if I have an overlay with extra features turned on, those appear
>> as well (i.e. Icons, points of interest, etc.), though all in the
>> center, not in their correct positions.
>>
>> The map is essentially 2 layers (3 if you count the unused base layer):
>> 1. The TMS map layer
>> 2. The features/points-of-interest overlay layer, which is a Vector layer
>> 3. The non-existent base layer.
>>
>> The code creating them looks like this:
>>         map = new OpenLayers.Map('ext-gen43', options);
>>         layer = new OpenLayers.Layer.Vector('POI');
>>         tmsLayer = new OpenLayers.Layer.TMS( mapTitle,
>>                 mapUrl, {displayOutsideMaxExtent: false, layername: 'db',
>> serviceVersion: '1.0',  type:'png'} );
>>         map.addLayers([tmsLayer, layer]);
>>         map.addLayer(new OpenLayers.Layer("No base layer",{isBaseLayer: true}));
>>
>> I only added the base layer after the printing wasn't working, it
>> hasn't affected anything, but it was mentioned as a good idea on the
>> "How to Optimize" page of the wiki.
>>
>> The printAction, customized, looks like this:
>>         var print = new mapfish.widgets.print.PrintAction({
>>                 map: map,
>>                 configUrl: '/epso/pdf/info.json',
>>                 overrides:      {},
>>                 fillSpec: function(printCommand) {
>>                         mapfish.widgets.print.PrintAction.prototype.fillSpec.call(this,
>> printCommand);
>>
>>                         //our layout needs two fields... hard code them here
>>                         printCommand.spec.comment = "No comment";
>>                         printCommand.spec.mapTitle = tmsLayer.name;
>>                         printCommand.spec.layout = "A4 portrait";
>>                         printCommand.spec.pages = [
>>                                 {
>>                                         center: [6, 45.5],
>>                                         scale: 4000000,
>>                                         dpi: 190
>>                                 }
>>                         ]
>>                         layers: [
>>                                 {
>>                                         type: 'TMS',
>>                                         layers: ['db'],
>>                                         baseURL: tmsLayer.mapURL,
>>                                         format: 'image/png'
>>                                 },
>>                                 {
>>                                         type: 'Vector',
>>                                         layers: ['POI'],
>>                                         baseURL: '',
>>                                         format: 'image/png'
>>                                 }
>>                         ]
>>                 }
>>         });
>>
>> Here is my config.yaml.  joker.spiekerpoint.com is my machine, and we
>> run via https:, so that's why it's port 8443:
>> #===========================================================================
>> # allowed DPIs
>> #===========================================================================
>> dpis:
>>   - 254
>>   - 190
>>   - 127
>>   - 56
>>
>> #===========================================================================
>> # the allowed scales
>> #===========================================================================
>> scales:
>>   - 25000
>>   - 50000
>>   - 100000
>>   - 200000
>>   - 500000
>>   - 1000000
>>   - 2000000
>>   - 4000000
>>   - 8000000
>>   - 16000000
>>   - 32000000
>>   - 64000000
>>
>> #===========================================================================
>> # the list of allowed hosts
>> #===========================================================================
>> #  - !ipMatch1
>> #    ip: www.camptocamp.org
>> #  - !dnsMatch
>> #    host: labs.metacarta.com
>> #    port: 80
>> #  - !dnsMatch
>> #    host: demo.mapfish.org
>> #    port: 80
>> hosts:
>>   - !localMatch
>>     dummy: true
>>   - !dnsMatch
>>     host: joker.spiekerpoint.com
>>     port: 8443
>>
>> layouts:
>>   #===========================================================================
>>   A4 portrait:
>>   #===========================================================================
>>     mainPage:
>>       rotation: true
>>       pageSize: A4
>>       header:
>>         height: 50
>>         items:
>>           - !text
>>             font: Helvetica
>>             fontSize: 30
>>             align: right
>>             text: '${mapTitle}'
>>       items:
>>         - !map
>>           spacingAfter: 30
>>           width: 440
>>           height: 483
>>         - !text
>>           text: '${comment}'
>>           spacingAfter: 30
>>         - !scalebar
>>           maxSize: 150
>>       footer:
>>         height: 30
>>         items:
>>           - !columns
>>             items:
>>               - !text
>>                 backgroundColor: #FF0000
>>                 align: left
>>                 text: © 2006-2009 Hour-Zero Crisis Consulting Ltd
>>               - !text
>>                 align: right
>>                 text: 'Page ${pageNum}'
>> ----EOF----
>>
>> Any thoughts on where my problem is?  Is there something I could look
>> at to see why it's not showing the main layer?
>>
>> Thanks for any help.
>> --
>> Mike Totman
>>
>> S P I E K E R   P O I N T   I N C
>> 9675 45 Ave NW Edmonton AB
>> http://www.spiekerpoint.com
>> _______________________________________________
>> Users mailing list
>> Users@...
>> http://www.mapfish.org/cgi-bin/mailman/listinfo/users
>>
>
> --
> Eric Lemoine
>
> Camptocamp France SAS
> Savoie Technolac, BP 352
> 73377 Le Bourget du Lac, Cedex
>
> Tel : 00 33 4 79 44 44 96
> Mail : eric.lemoine@...
> http://www.camptocamp.com
>



--
Mike Totman

S P I E K E R   P O I N T   I N C
9675 45 Ave NW Edmonton AB
http://www.spiekerpoint.com



--
Mike Totman

S P I E K E R   P O I N T   I N C
9675 45 Ave NW Edmonton AB
http://www.spiekerpoint.com



--
Mike Totman

S P I E K E R   P O I N T   I N C
9675 45 Ave NW Edmonton AB
http://www.spiekerpoint.com

_______________________________________________
Users mailing list
Users@...
http://www.mapfish.org/cgi-bin/mailman/listinfo/users

Re: Print servlet not printing OpenLayers.TMS layer

by Claude Philipona :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

The MapFish print module has been developed with priority to support
the types of layers needed by the funding projects. There are now
requests to support some extra types of layers, including GeoWebCache.
It would be interesting to collaborate and to include some how your
needs . Do you have any funding for this improvement or are you ready
to collaborate with the development.

Claude

On Fri, Oct 30, 2009 at 01:30, Mike Totman <mtotman@...> wrote:

> Is there nowhere to get information on how to develop new layer support for
> MapFish?  I have been unable to find anything on the mapfish sites, or via
> Google.  I'd rather not try to develop blind.  Can anyone help?
>
> On Tue, Oct 20, 2009 at 5:30 PM, Mike Totman <mtotman@...>
> wrote:
>>
>> Returning to this thread after a long time off, due to distraction and
>> changed priorities.
>>
>> Once again, I'm trying to get MapFish printing to work for a TMS layer in
>> our OpenLayers app.  I know MapFish doesn't currently support TMS layers,
>> and I can't find any other tools that can translate TMS to another format
>> MapFish understands (e.g. WMS), so I'm wondering what it would take for me
>> to add support for TMS to MapFish, at least in a limited way needed for our
>> app?
>>
>> Or is there a tool that can do the translation/presentation of TMS as WMS
>> (or whatever) so MapFish can print our maps? I've looked at GeoWebCache and
>> GeoMoose, but at best they serve up WMS like TMS, not the other way around.
>>
>> On Mon, May 25, 2009 at 10:56 AM, Mike Totman <mtotman@...>
>> wrote:
>>>
>>> So what would be involved in creating support for TMS?  I don't know
>>> the details of the OpenLayers or MapFish implementations, so how
>>> likely would it be for me to create that?
>>>
>>> On Sat, May 23, 2009 at 2:49 PM, Eric Lemoine
>>> <eric.lemoine@...> wrote:
>>> > Hi Mike
>>> >
>>> > The print module does not support TMS layers. It supports TileCache
>>> > layers though. Sorry for that.
>>> >
>>> >
>>> > On Saturday, May 23, 2009, Mike Totman <mtotman@...>
>>> > wrote:
>>> >> I have an app I've inherited that was already using OpenLayers to do
>>> >> its mapping, and I'm trying to get the MapFish print module to handle
>>> >> printing those maps to PDF.
>>> >>
>>> >> The application stores the map tiles in its own database and retrieves
>>> >> them by URL using a TMS layer which retrieves the tiles via a custom
>>> >> servlet that response to URLs encoding the tiles in the
>>> >> zoomlevel/row/column format.  e.g. /app/map/0/0/1.jpg
>>> >>
>>> >> I'm using the printer servlet installed as part of the application
>>> >> (which is running under JBoss 4.2) and it seems to work fine.  Calls
>>> >> to pdf/info.json return the appropriate result.
>>> >>
>>> >> When I try to print (I added a PrintAction stolen from the sample
>>> >> print app), I get a PDF file with the title, footer and nothing else.
>>> >> Or, if I have an overlay with extra features turned on, those appear
>>> >> as well (i.e. Icons, points of interest, etc.), though all in the
>>> >> center, not in their correct positions.
>>> >>
>>> >> The map is essentially 2 layers (3 if you count the unused base
>>> >> layer):
>>> >> 1. The TMS map layer
>>> >> 2. The features/points-of-interest overlay layer, which is a Vector
>>> >> layer
>>> >> 3. The non-existent base layer.
>>> >>
>>> >> The code creating them looks like this:
>>> >>         map = new OpenLayers.Map('ext-gen43', options);
>>> >>         layer = new OpenLayers.Layer.Vector('POI');
>>> >>         tmsLayer = new OpenLayers.Layer.TMS( mapTitle,
>>> >>                 mapUrl, {displayOutsideMaxExtent: false, layername:
>>> >> 'db',
>>> >> serviceVersion: '1.0',  type:'png'} );
>>> >>         map.addLayers([tmsLayer, layer]);
>>> >>         map.addLayer(new OpenLayers.Layer("No base
>>> >> layer",{isBaseLayer: true}));
>>> >>
>>> >> I only added the base layer after the printing wasn't working, it
>>> >> hasn't affected anything, but it was mentioned as a good idea on the
>>> >> "How to Optimize" page of the wiki.
>>> >>
>>> >> The printAction, customized, looks like this:
>>> >>         var print = new mapfish.widgets.print.PrintAction({
>>> >>                 map: map,
>>> >>                 configUrl: '/epso/pdf/info.json',
>>> >>                 overrides:      {},
>>> >>                 fillSpec: function(printCommand) {
>>> >>
>>> >>  mapfish.widgets.print.PrintAction.prototype.fillSpec.call(this,
>>> >> printCommand);
>>> >>
>>> >>                         //our layout needs two fields... hard code
>>> >> them here
>>> >>                         printCommand.spec.comment = "No comment";
>>> >>                         printCommand.spec.mapTitle = tmsLayer.name;
>>> >>                         printCommand.spec.layout = "A4 portrait";
>>> >>                         printCommand.spec.pages = [
>>> >>                                 {
>>> >>                                         center: [6, 45.5],
>>> >>                                         scale: 4000000,
>>> >>                                         dpi: 190
>>> >>                                 }
>>> >>                         ]
>>> >>                         layers: [
>>> >>                                 {
>>> >>                                         type: 'TMS',
>>> >>                                         layers: ['db'],
>>> >>                                         baseURL: tmsLayer.mapURL,
>>> >>                                         format: 'image/png'
>>> >>                                 },
>>> >>                                 {
>>> >>                                         type: 'Vector',
>>> >>                                         layers: ['POI'],
>>> >>                                         baseURL: '',
>>> >>                                         format: 'image/png'
>>> >>                                 }
>>> >>                         ]
>>> >>                 }
>>> >>         });
>>> >>
>>> >> Here is my config.yaml.  joker.spiekerpoint.com is my machine, and we
>>> >> run via https:, so that's why it's port 8443:
>>> >>
>>> >> #===========================================================================
>>> >> # allowed DPIs
>>> >>
>>> >> #===========================================================================
>>> >> dpis:
>>> >>   - 254
>>> >>   - 190
>>> >>   - 127
>>> >>   - 56
>>> >>
>>> >>
>>> >> #===========================================================================
>>> >> # the allowed scales
>>> >>
>>> >> #===========================================================================
>>> >> scales:
>>> >>   - 25000
>>> >>   - 50000
>>> >>   - 100000
>>> >>   - 200000
>>> >>   - 500000
>>> >>   - 1000000
>>> >>   - 2000000
>>> >>   - 4000000
>>> >>   - 8000000
>>> >>   - 16000000
>>> >>   - 32000000
>>> >>   - 64000000
>>> >>
>>> >>
>>> >> #===========================================================================
>>> >> # the list of allowed hosts
>>> >>
>>> >> #===========================================================================
>>> >> #  - !ipMatch1
>>> >> #    ip: www.camptocamp.org
>>> >> #  - !dnsMatch
>>> >> #    host: labs.metacarta.com
>>> >> #    port: 80
>>> >> #  - !dnsMatch
>>> >> #    host: demo.mapfish.org
>>> >> #    port: 80
>>> >> hosts:
>>> >>   - !localMatch
>>> >>     dummy: true
>>> >>   - !dnsMatch
>>> >>     host: joker.spiekerpoint.com
>>> >>     port: 8443
>>> >>
>>> >> layouts:
>>> >>
>>> >>   #===========================================================================
>>> >>   A4 portrait:
>>> >>
>>> >>   #===========================================================================
>>> >>     mainPage:
>>> >>       rotation: true
>>> >>       pageSize: A4
>>> >>       header:
>>> >>         height: 50
>>> >>         items:
>>> >>           - !text
>>> >>             font: Helvetica
>>> >>             fontSize: 30
>>> >>             align: right
>>> >>             text: '${mapTitle}'
>>> >>       items:
>>> >>         - !map
>>> >>           spacingAfter: 30
>>> >>           width: 440
>>> >>           height: 483
>>> >>         - !text
>>> >>           text: '${comment}'
>>> >>           spacingAfter: 30
>>> >>         - !scalebar
>>> >>           maxSize: 150
>>> >>       footer:
>>> >>         height: 30
>>> >>         items:
>>> >>           - !columns
>>> >>             items:
>>> >>               - !text
>>> >>                 backgroundColor: #FF0000
>>> >>                 align: left
>>> >>                 text: © 2006-2009 Hour-Zero Crisis Consulting Ltd
>>> >>               - !text
>>> >>                 align: right
>>> >>                 text: 'Page ${pageNum}'
>>> >> ----EOF----
>>> >>
>>> >> Any thoughts on where my problem is?  Is there something I could look
>>> >> at to see why it's not showing the main layer?
>>> >>
>>> >> Thanks for any help.
>>> >> --
>>> >> Mike Totman
>>> >>
>>> >> S P I E K E R   P O I N T   I N C
>>> >> 9675 45 Ave NW Edmonton AB
>>> >> http://www.spiekerpoint.com
>>> >> _______________________________________________
>>> >> Users mailing list
>>> >> Users@...
>>> >> http://www.mapfish.org/cgi-bin/mailman/listinfo/users
>>> >>
>>> >
>>> > --
>>> > Eric Lemoine
>>> >
>>> > Camptocamp France SAS
>>> > Savoie Technolac, BP 352
>>> > 73377 Le Bourget du Lac, Cedex
>>> >
>>> > Tel : 00 33 4 79 44 44 96
>>> > Mail : eric.lemoine@...
>>> > http://www.camptocamp.com
>>> >
>>>
>>>
>>>
>>> --
>>> Mike Totman
>>>
>>> S P I E K E R   P O I N T   I N C
>>> 9675 45 Ave NW Edmonton AB
>>> http://www.spiekerpoint.com
>>
>>
>>
>> --
>> Mike Totman
>>
>> S P I E K E R   P O I N T   I N C
>> 9675 45 Ave NW Edmonton AB
>> http://www.spiekerpoint.com
>
>
>
> --
> Mike Totman
>
> S P I E K E R   P O I N T   I N C
> 9675 45 Ave NW Edmonton AB
> http://www.spiekerpoint.com
>
> _______________________________________________
> Users mailing list
> Users@...
> http://www.mapfish.org/cgi-bin/mailman/listinfo/users
>
>
_______________________________________________
Users mailing list
Users@...
http://www.mapfish.org/cgi-bin/mailman/listinfo/users