[Geoserver-users] Java JXMapViewer class and Geoserver

— On Tue, 6/24/08, Roman Isitua romanisitua@anonymised.com wrote:

From: Roman Isitua romanisitua@anonymised.com
Subject: JXMapViewer and Geoserver
To: “geoserver users” geoserver-users@lists.sourceforge.net
Date: Tuesday, June 24, 2008, 12:32 AM

Hi everyone,

I would like to ask if anyone has used the Java JXMapViewer class developed by swing labs with geoserver. I was told it is a Map viewer and it has support for fetching maps from a wms server and map viewing capabilities. What are your experiences ?

Thanks,

Roman

Roman Isitua ha scritto:

--- On *Tue, 6/24/08, Roman Isitua /<romanisitua@anonymised.com>/* wrote:

    From: Roman Isitua <romanisitua@anonymised.com>
    Subject: JXMapViewer and Geoserver
    To: "geoserver users" <geoserver-users@lists.sourceforge.net>
    Date: Tuesday, June 24, 2008, 12:32 AM

    Hi everyone,

    I would like to ask if anyone has used the Java JXMapViewer class
    developed by swing labs with geoserver. I was told it is a Map
    viewer and it has support for fetching maps from a wms server and
    map viewing capabilities. What are your experiences ?

I don't know anyone of us who tried to use JXMapViewer. I'm just
answering so that you don't feel totally ignored, sorry I don't have
any experience to share :slight_smile:

Cheers
Andrea

On Wed, Jun 25, 2008 at 3:22 AM, Roman Isitua <romanisitua@anonymised.com> wrote:

I would like to ask if anyone has used the Java JXMapViewer class developed
by swing labs with geoserver. I was told it is a Map viewer and it has
support for fetching maps from a wms server and map viewing capabilities.
What are your experiences ?

It seems to work out of the box, all I did was add these two lines to
JXMapKit (lines 623)
                WMSService wms = new
WMSService("http://localhost:8080/geoserver/wms?&quot;,&quot;topp:states&quot;\);
        tf = new WMSTileFactory(wms );

and it all worked, obviously for best results you'll want to look into
using a tiled cache such as GeoTileCache.

Ian



Hi,




Thanks for your mail, tried what you said but the topp:states map does not display in JXMapViewer. When i look at the tomcat console, geoserver displays the wms request sent by JXMapViewer as







" http://localhost:8080/geoserver/wms?version=1.1.1&request=GetMap&layers=topp:states&format=image/jpeg&BBOX=-0.002,-0.002,0.0,0.0&width=500&height=500&SRS=EPSG:4326&Styles= "







I believe the problems lies with the BBOX parameter that JXMapViewer class generates (i don’t know why it specifies BBOX = -0.002, -0.002, 0.0, 0.0 as the bounding box values to be used in the wms query. Even on a web browser this query will not retrun any result because the bounds are wrong. I used exactly the same code as you specified.







Any ideas as regards this strange problem ? and by the way what is GeoTileCache ?







thanks,







Roman
















— On Sun, 6/29/08, Ian Turton ijturton@anonymised.com wrote:




> From: Ian Turton ijturton@anonymised.com
> Subject: Re: [Geoserver-users] Java JXMapViewer class and Geoserver
> To: romanisitua@anonymised.com
> Cc: “geoserver users” geoserver-users@lists.sourceforge.net
> Date: Sunday, June 29, 2008, 1:11 PM
>
> <br>> On Wed, Jun 25, 2008 at 3:22 AM, Roman Isitua <romanisitua@anonymised.com><br>> wrote:<br>> ><br>> ><br>> > I would like to ask if anyone has used the Java JXMapViewer class<br>> developed<br>> > by swing labs with geoserver. I was told it is a Map viewer and it has<br>> > support for fetching maps from a wms server and map viewing capabilities.<br>> > What are your experiences ?<br>> ><br>> <br>> It seems to work out of the box, all I did was add these two lines to<br>> JXMapKit (lines 623)<br>> WMSService wms = new<br>> WMSService("http://localhost:8080/geoserver/wms?","topp:states");<br>> tf = new WMSTileFactory(wms );<br>> <br>> and it all worked, obviously for best results you'll want to look into<br>> using a tiled cache such as GeoTileCache.<br>> <br>> Ian<br>>

On Mon, Jun 30, 2008 at 11:54 AM, Roman Isitua <romanisitua@anonymised.com> wrote:

Hi,

Thanks for your mail, tried what you said but the topp:states map does not
display in JXMapViewer. When i look at the tomcat console, geoserver
displays the wms request sent by JXMapViewer as

"
http://localhost:8080/geoserver/wms?version=1.1.1&request=GetMap&layers=topp:states&format=image/jpeg&BBOX=-0.002,-0.002,0.0,0.0&width=500&height=500&SRS=EPSG:4326&Styles=
"

I believe the problems lies with the BBOX parameter that JXMapViewer class
generates (i don't know why it specifies BBOX = -0.002, -0.002, 0.0, 0.0 as
the bounding box values to be used in the wms query. Even on a web browser
this query will not retrun any result because the bounds are wrong. I used
exactly the same code as you specified.

Try zooming out in the viewer, your zoomed into where the equator
crosses the Greenwich meridian so there are no US States to see. So
zoom out and pan left to see some map.

Any ideas as regards this strange problem ? and by the way what is
GeoTileCache ?

Its a piece of software that sits between geoserver and tiled clients
(like JXMapViewer) and saves (or caches) the tiles as they are
requested to speed up subsequent requests and to save load on the
server which other wise has to draw each tile each time. See
http://geowebcache.org/trac and
http://blog.geoserver.org/2007/02/26/tilecache-tutorial/ for more
details

Ian
--

Ian Turton
http://www.geotools.org
http://pennspace.blogspot.com/







When i run the program the map is already zoomed out i.e. at the first zoom level. But isn’t JXMapViewer supposed to determine the appropriate bounds for the topp:states map (automatically) and specify it in the wms request ? or is there a method to set the bounds of each wms request JXMapViewer makes ?







To me it will be a stressful exercise to zoom to the appropriate map bounds each time JXMapViewer makes a wms request.







thanks,







Roman







Roman

— On Mon, 6/30/08, Ian Turton ijturton@anonymised.com wrote:




> From: Ian Turton ijturton@anonymised.com
> Subject: Re: [Geoserver-users] Java JXMapViewer and Geoserver (wms) problem
> To: romanisitua@anonymised.com
> Cc: geoserver-users@lists.sourceforge.net
> Date: Monday, June 30, 2008, 9:05 AM
>
> <br>> On Mon, Jun 30, 2008 at 11:54 AM, Roman Isitua <romanisitua@anonymised.com><br>> wrote:<br>> > Hi,<br>> ><br>> > Thanks for your mail, tried what you said but the topp:states map does not<br>> > display in JXMapViewer. When i look at the tomcat console, geoserver<br>> > displays the wms request sent by JXMapViewer as<br>> ><br>> ><br>> ><br>> > "<br>> ><br>> http://localhost:8080/geoserver/wms?version=1.1.1&request=GetMap&layers=topp:states&format=image/jpeg&BBOX=-0.002,-0.002,0.0,0.0&width=500&height=500&SRS=EPSG:4326&Styles=<br>> > "<br>> ><br>> ><br>> ><br>> > I believe the problems lies with the BBOX parameter that JXMapViewer class<br>> > generates (i don't know why it specifies BBOX = -0.002, -0.002, 0.0,<br>> 0.0 as<br>> > the bounding box values to be used in the wms query. Even on a web browser<br>> > this query will not retrun any result because the bounds are wrong. I used<br>> > exactly the same code as you specified.<br>> ><br>> <br>> Try zooming out in the viewer, your zoomed into where the equator<br>> crosses the Greenwich meridian so there are no US States to see. So<br>> zoom out and pan left to see some map.<br>> <br>> ><br>> ><br>> > Any ideas as regards this strange problem ? and by the way what is<br>> > GeoTileCache ?<br>> <br>> Its a piece of software that sits between geoserver and tiled clients<br>> (like JXMapViewer) and saves (or caches) the tiles as they are<br>> requested to speed up subsequent requests and to save load on the<br>> server which other wise has to draw each tile each time. See<br>> http://geowebcache.org/trac and<br>> http://blog.geoserver.org/2007/02/26/tilecache-tutorial/ for more<br>> details<br>> <br>> Ian<br>> -- <br>> <br>> Ian Turton<br>> http://www.geotools.org<br>> http://pennspace.blogspot.com/<br>>

On Tue, Jul 1, 2008 at 10:41 AM, Roman Isitua <romanisitua@anonymised.com> wrote:

When i run the program the map is already zoomed out i.e. at the first zoom
level. But isn't JXMapViewer supposed to determine the appropriate bounds
for the topp:states map (automatically) and specify it in the wms request ?
or is there a method to set the bounds of each wms request JXMapViewer makes
?

To me it will be a stressful exercise to zoom to the appropriate map bounds
each time JXMapViewer makes a wms request

JXMapViewer doesn't know or care about what is being displayed, the
key lines you'll need to change are

                kit.setZoom(14);
                kit.setAddressLocation(new GeoPosition(51.5,0));

which seem to set the zoom level and the centre of the map (Some where
near London UK in this case).

Ian