[Geoserver-users] Display maps in Java Applets

Hi,

How can I display a map inside a Java Applet?

The WMS request is:

http://localhost:8080/geoserver/wms?bbox=643601,7584725,689743,7615486&styles=poligono,matas2&Format=image/png&request=GetMap&layers=topp:setores,topp:jf_matas&width=600&height=400&srs=EPSG:4326

But I want to display it inside a Java Applet instead of a browser.

Thanks,

Daniel

On 5/25/06, Daniel Ferreira <danielvbf@anonymised.com> wrote:

Hi,

How can I display a map inside a Java Applet?

The WMS request is:

http://localhost:8080/geoserver/wms?bbox=643601,7584725,689743,7615486&styles=poligono,matas2&Format=image/png&request=GetMap&layers=topp:setores,topp:jf_matas&width=600&height=400&srs=EPSG:4326

But I want to display it inside a Java Applet instead of a browser.

You need to create an image from the url above and then dispaly that inside your applet. Then you need to build some code to allow users zoom in/out and pan the map. This is just a case of manipluating the bounding box and rebuilding the image from the new url.

Hope that helps

Ian

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

Free, but not open source WMS applet

http://map.itek.norut.no/public/wmsapplet.html

cheers
Joern

On Friday 26 May 2006 03:03, Ian Turton wrote:

On 5/25/06, Daniel Ferreira <danielvbf@anonymised.com> wrote:
> Hi,
>
> How can I display a map inside a Java Applet?
>
> The WMS request is:
>
> http://localhost:8080/geoserver/wms?bbox=643601,7584725,689743,7615486&st
>yles=poligono,matas2&Format=image/png&request=GetMap&layers=topp:setores,t
>opp:jf_matas&width=600&height=400&srs=EPSG:4326
>
>
> But I want to display it inside a Java Applet instead of a browser.

You need to create an image from the url above and then dispaly that inside
your applet. Then you need to build some code to allow users zoom in/out
and pan the map. This is just a case of manipluating the bounding box and
rebuilding the image from the new url.

Hope that helps

Ian

Take a look at MyMaps (on sourceforge). While this is
a very young project, there are components which make
it possible to display the results of WMS queries in a
Swing app. All the zooming, panning, etc., is already
there. You'll see that what Ian is suggesting is not
all that hard.

Because MyMaps is open source, you can see how it
works (if it doesn't work the way you want) and modify
it for your needs (we'd love to have you contribute
your changes back to the project). On the downside,
like most new open source projects, there's more code
than documentation - feel free to email me if you need
help navigating the source tree!

Todd

--- Ian Turton <ijturton@anonymised.com> wrote:

On 5/25/06, Daniel Ferreira <danielvbf@anonymised.com>
wrote:
>
> Hi,
>
> How can I display a map inside a Java Applet?
>
> The WMS request is:
>
>

http://localhost:8080/geoserver/wms?bbox=643601,7584725,689743,7615486&styles=poligono,matas2&Format=image/png&request=GetMap&layers=topp:setores,topp:jf_matas&width=600&height=400&srs=EPSG:4326

>
>
> But I want to display it inside a Java Applet
instead of a browser.
>

You need to create an image from the url above and
then dispaly that inside
your applet. Then you need to build some code to
allow users zoom in/out and
pan the map. This is just a case of manipluating the
bounding box and
rebuilding the image from the new url.

Hope that helps

Ian

--

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

The only "dumb question" is the one you were too afraid to ask.
________________________________________
Check out RouteRuler - Free software for runners, cyclists, walkers, etc.
http://routeruler.sourceforge.net
________________________________________
Get a handle on your data with "pocOLAP", the "little" OLAP project
http://pocolap.sourceforge.net
________________________________________

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

On 5/26/06, Daniel Ferreira <danielvbf@anonymised.com> wrote:

Ok, but what is the Java code I need to use to get the map image from the url above?

Image image = getToolkit().getImage(url);

Ian

--

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

Cool, just added a link to: http://docs.codehaus.org/display/GEOSDOC/MyMaps

If you want to write more on it feel free to. Especially with specific instructions to connect to GeoServer.

Chris

todd runstein wrote:

Take a look at MyMaps (on sourceforge). While this is
a very young project, there are components which make
it possible to display the results of WMS queries in a
Swing app. All the zooming, panning, etc., is already
there. You'll see that what Ian is suggesting is not
all that hard.

Because MyMaps is open source, you can see how it
works (if it doesn't work the way you want) and modify
it for your needs (we'd love to have you contribute
your changes back to the project). On the downside,
like most new open source projects, there's more code
than documentation - feel free to email me if you need
help navigating the source tree!

Todd

--- Ian Turton <ijturton@anonymised.com> wrote:

On 5/25/06, Daniel Ferreira <danielvbf@anonymised.com>
wrote:

Hi,

How can I display a map inside a Java Applet?

The WMS request is:

http://localhost:8080/geoserver/wms?bbox=643601,7584725,689743,7615486&styles=poligono,matas2&Format=image/png&request=GetMap&layers=topp:setores,topp:jf_matas&width=600&height=400&srs=EPSG:4326

But I want to display it inside a Java Applet

instead of a browser.

You need to create an image from the url above and
then dispaly that inside
your applet. Then you need to build some code to
allow users zoom in/out and
pan the map. This is just a case of manipluating the
bounding box and
rebuilding the image from the new url.

Hope that helps

Ian

--

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

The only "dumb question" is the one you were too afraid to ask.
________________________________________
Check out RouteRuler - Free software for runners, cyclists, walkers, etc.
http://routeruler.sourceforge.net
________________________________________
Get a handle on your data with "pocOLAP", the "little" OLAP project
http://pocolap.sourceforge.net
________________________________________

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com

-------------------------------------------------------
All the advantages of Linux Managed Hosting--Without the Cost and Risk!
Fully trained technicians. The highest number of Red Hat certifications in
the hosting industry. Fanatical Support. Click to learn more
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

--
Chris Holmes
The Open Planning Project
http://topp.openplans.org