Introduction to the OpenGeo Suite
Publishing map widgets¶
In this section, we’ll use GeoExplorer’s Export Map tool to publish our composed layout as a custom map application that can be embedded on a web page.
Export Map tool¶
|Export Map||Initiates the workflow to export your current map layout to a custom web-map widget.|
Export Your Saved Map¶
Exporting your map to a web page is a quick process. However, first we need a web page to export our map to. Thankfully, there is a template HTML file in our <workshop>\html directory.
The unadorned template looks a little like this:
Now let’s have a quick look at the code.
Open the GNN.html file in your text editor.
Now back to publishing our map. Continuing the previous exercise, you should be logged in to GeoExplorer. Open the map layout you saved previously.
Click the Export Map button to trigger the publishing process.
The Export Map dialog opens, presenting a list of tools that can be added to the toolbar in your exported map. By default, all of the tool options are enabled.
Adjust the selection of tools if desired.
Once you’ve selected the tools to include your published map’s toolbar, click the Next button to proceed.
This screen provides you with a code snippet to embed your map application into a web-page template. Copy the code in the <iframe>...</iframe> block to your clipboard.
Return to your text editor and scroll down to around line 32. Replace the comment shown below with GeoExplorer’s HTML block.
<!--Insert your exported HTML code from GeoExplorer here!-->
Your HTML file should now look something like this:
Save your HTML file, and return to your browser.
Refresh the page.
Congratulations, you have published your first map!
How’s the map performance? A little slow? In an upcoming section, we’ll look at how to accelerate map delivery using GeoWebCache.
Other publishing options¶
We have a few other options when publishing our maps.
At any time we can click the Preview button to get a glimpse of what our published map application will look like.
Click the Preview button.
A preview of our mapping application pops-up in a new panel.
Close the preview pop-up.
In the second step, we have controls to specify the dimensions of our map.
The Map Size drop-down lists several common map height/width pairs.
Alternately, you can enter values in the Height and Width fields directly. Change these values to 750 and 650, respectively.
Make sure to tab or click out of the Width field when you’re done, otherwise the change won’t take effect.
Changing these values updates the code in the <iframe> block with the new map size.
Change any of the map options. Use the Back and Next buttons to move between the toolbar and dimension option screens.
Republish these changes into your HTML page, and confirm your changes.
Table Of Contents
Boundless provides commercial open source software for internet mapping and geospatial application development. We are dedicated to the growth and support of open source software.
This work is licensed under a Creative Non Commercial-Commons Attribution-Share Alike 3.0 United States License. Feel free to use this material, but we ask that you please retain the Boundless branding, logos and style.