Trouble with Web Map Builder?

GeoDoctor

The GeoDoctor

In this post I’m going to focus on a particular developer issue around the use of our Web Map Builder. Questions have arisen around what you do with the code you get when you press the ‘Collect code’ button in ‘Step 4 – Generate and save code’. You are actually given a fully formed HTML document.

This is fantastic if all you want is a blank page with a map in it.

For that all I would need to do is:

1. Select all the code

2. Copy the code into a text editor, such as Notepad.

3. Save it as <name>.html, such as mymap.html.

4. Put it on my webserver

You will hopefully have something that looks like this: Continue reading “Trouble with Web Map Builder?”

Five geo-predictions for 2011

The GeoDoctor turns his mind to the the coming year

The GeoDoctor turns his mind to the year ahead.

Traditionally, the New Year is a time to reflect on what has passed and what’s on the horizon. So, with the help of my colleagues, I thought this was a good time to take a look at some possible trends in the geospatial industry, and to even to make a few predictions for the year ahead.

I thought I would stay clear of the areas that other bloggers have covered so well, and try and give a little more left-field perspective.

1. A significant open data application.

We’ve seen an increasing amount of open data released in recent years and there has been a huge amount written about it and how it could be used. There have been a number of implementations (dare I mention the ASBOrometer?!) but what I haven’t seen, and please correct me if I’m wrong, is a huge consumer app, or killer app which is commercial and actually makes money.

I think 2011 could be the year it happens.

2. More online geospatial service providers.

I think this area will inevitably grow. Last year we saw the launch of online based GI services from both the traditional vendors as well as new entrants to the market, such as GIS Cloud. Why do I find this an area of interest? I think it’s because the barriers to entry are now so much lower.

Most GI functionality is now available as open source, so hosting and delivering online is considerably cheaper and faster to implement, thanks to cloud infrastructure. Continue reading “Five geo-predictions for 2011″

Top 5 OS OpenSpace questions

In this GeoClinic I thought I would take a look at, and answer, some of the top 5 questions our wonderful Customer Service Center receive. So, thanks to Marie and Kate in the team for helping put these questions together.

GeoDoctor

1. I’ve forgotten (or how do I reset) my OS OpenSpace password?

This can all be easily handled online.
- Go to the OS OpenSpace Forum
- Click on Login (top right-hand box)
- Click on “I forgot my password”
- Follow the instructions

2. My API key is registered to the wrong URL or I wish to add another UR to my API key

Registering a URL in OS OpenSpace links it to the API key sent to you. However, it is often the case that you wish to host the application at another URL or even host your application on two URLs. If this is the case, then simply contact us and we’ll be able to help you with the change you wish to make.

Please note that the tile and lookup limits are assigned to the API key, so if you are using multiple URLs against one API key you’ll be spreading the limits amongst all those URLs.

OS OpenSpace

3. I would like to develop my application before deploying it to the registered URL, will my API key still work?

Your API key will work against your registered URL and localhost, for example http://localhost/myapp.html. This means you can install a webserver on your development/test environment and your application will work perfectly well if you can access it using localhost. Just as it will do when deployed at your registered URL.

4. I get an “HTTP Referrer not Valid” message

This is typically caused by there being a mismatch between your API key and the URL you have registered. Please check that the API key your have entered is the one the registration process sent to you. Otherwise, please get in touch so we can check that the API key and URL you are using are correctly registered. Please include your API key and the URL you are using in any correspondance.

5. I’m interested in upgrading to OS OpenSpace Pro. Please tell me more about it and how I can sign up.

The following link has details about OS OpenSpace Pro. Currently, Pro enhances OS OpenSpace by offering no data volume limits with our charged utility pricing model. If you’re interested in using OS OpenSpace Pro, just let us know.

The GeoClinic

The GeoDoctor prepares his diagnosis

The GeoDoctor prepares his diagnosis

We had a question in my last Clinic from Ben Ratcliffe. He asked:  ”I am trying to upload OS OpenData Streetview to geoserver either as a geotiff or a linked shp file to use as an internal WMS server. I have had no end of problems trying to convert the tiff + world file to geotiff using various tools such as FWtools, lizardtech geoviewer, listgeo and a few more that I have found. I have even tried using OSGB web map tools, this has some success but when I upload to geoserver, it loses the connection to the tiff files and then shows blank squares.”

Obviously it is sometimes a little bit difficult to diagnose a problem remotely, but what I will go through is a remedy which we use and hopefully will solve your issue as well.

I’ll present this as a series of steps, this is for GeoServer 2.0.2, so other versions may vary:

1) Download your OS Street View tiles from the OS OpenData site

2) Put all the .tif and .tfw files together in a new folder in the GeoServer data directory.

3) Add a new store in GeoServer, specify you’ll be using ImageMosaic and include the URL to the appropriate folder.

4) Publish the layer in GeoServer. This creates a number of files in the specified data directory, most notably one named <folderhame>.prj, which defaults to a WGS84 projection.

5) Delete the layer (not the store) in GeoServer

6) Replace the content of the <folderhame>.prj with details for British National Grid in this link

7) Add a layer in GeoServer and you should see the Native SRS set to 27700

The image tiles should now be served up correctly by GeoServer.

Thanks goes out to Tim Martin in answering this question.

Can I mix other mapping APIs with OS OpenSpace?

There are two aspects to this question. Some of you may have seen Tim Martin at AGI 2009 in a joint presentation with Bing. He demonstrated how you can pull in Microsoft Bing Maps into OS OpenSpace. The first point to consider is whether it is permissible between the APIs Terms of Use.

Assuming it is, there is then a significant technical aspect that you have to take into consideration. OS OpenSpace (based on OSGB) and other mapping APIs vary in their projections. That is, it is not possible to overlay the two layers without re-projecting one or the other, often resulting in something which doesn’t look very pretty!

The example that Tim used at AGI 2009 was to switch between the two mapping APIs, they were never displayed together. Of course, this also underlines a significant point that any data that you display on OS OpenSpace must be displayed using the OSGB projection.

How do I add boundaries in OS OpenSpace?

One of the coolest things you can do with OS OpenSpace is to add boundary data to your mash-up. By including boundaries you can display a whole range of different data in a way that is easy interpret and compare. OS OpenSpace includes a boundary lookup service, more details can be found here.

Using boundaries with OS OpenSpace

Using boundaries with OS OpenSpace

These can be used within OS OpenSpace to show customised and styled boundaries in your map, as well as design thematic maps using your own or third party data.

Functions are available within OS OpenSpace to make the inclusion of boundaries as straight forward as possible. The best way to understand how boundaries can be included and used in your maps is through the examples on the OS OpenSpace site:

Creating thematic boundaries and

Adding a single boundary layer with default styling

Feel free to look at our other examples to see other innovative ways of using boundaries.

Welcome to the GeoClinic

Ian Holt is the Geo Doctor

Ian Holt is the GeoDoctor

Welcome to the GeoClinic, my new regular surgery where, as the resident GeoDoctor, I will endeavour to diagnose your Geographic Information related aches, pains and maladies.

So, if GI is giving you a headache, if your TOIDs are causing irritation or if your web map could use a physical, then tell me here on the blog or tweet me or Ordnance Survey, and I will prescribe the solution.

The Doctor is in…

How do I get the Web-Map Builder code into my website also how do I save the code?

Web-Map Builder is an excellent free and easy to use tool for making an OS OpenSpace map. A question I’m often asked is “I’ve made a very nice map, now how do I get it on my web page?”.

First of all you’ll notice that Step 4 allows you to click on a “Collect Code” button. This presents you with the code of a complete web page. You can copy this code into a blank text document, save it with extension .html and upload this directly to your web host and by navigating to that uploaded document in your browser.

However, many people ask “what happens if I already have a web page and wish to put this map inside it?”. Good question.

There are 2 main ways of doing this. I’ll take you through the way I find to be the easiest, but if you have any problems just let me know:

Reference your new map inside an iFrame (The easy way)

First, take the Web-Map Builder code, save it in a blank document as a .html file. Upload the file to your web host.

Now in your existing web page create an iFrame of the same dimensions as your map and put a link to your uploaded html document, as shown by the example below:

  • I copied the web map builder code into notepad.
  • Saved it as examplemap.html.
  • Uploaded it to my web host.
  • In the page I wanted to display the map, at the appropriate point I inserted these lines of code:

<iframe src=”http://www.ianholt.me.uk/examplemap.html” width=”450″ height=”350″ frameborder=””0″ scrolling=””auto”” name=

“”oswebmapframe””></iframe>

Now my map appears nicely in the existing web page, like this!

Can I use GPX files within OS OpenSpace?

What will the GeoDoctor prescribe?

What will the GeoDoctor prescribe?

GPX, a format commonly exported from a GPS device and is one of the formats that OS OpenSpace supports through the Open Layers library. A point to note is that browser security will stop you directly using a GPX from a local file.

What you have to do is upload the GPX file to your web host, like you would a photo (you could offer a simple form to the user to enable them to do this).

Once the file is on your web host, you can then make use of it within your OS OpenSpace application, quite simply by calling the function to add a new GML layer and specifying the format as GPX:

// Add the Layer with GPX Track

var lgpx = new OpenLayers.Layer.GML(“MB Bruderholz”, “mb_bruderholz.GPX”, {

format: OpenLayers.Format.GPX,

style: {strokeColor: “green”, strokeWidth: 5, strokeOpacity: 0.5},

projection: new OpenLayers.Projection(“EPSG:4326″)

});

map.addLayer(lgpx);

You can view the full example here on the OpenStreetMap wiki.

Why doesn’t OS OpenSpace work well with Internet Explorer 8?

Unfortunately, this is an issue which has cropped up. The good news is that in the next OS OpenSpace release we will be upgrading to OpenLayers 2.8 which will solve compatibility issues with IE8. In the meantime, or if you are using a previous version, there is a very easy way to handle this, by including this line of code in the HTML document header:

<meta http-equiv=”X-UA-Compatible” content=”IE=EmulateIE7″/>

I hope my answers are useful, but if anyone has any other questions about using GI, either on the web or in a traditional GIS system, then just let me know and I’ll do my best to answer them in my next clinic.

Until next time!