2007-12-30

API Documentation

I created a page to keep the API documentation in one canonical place:

http://www.travellermap.com/api.htm Ω

2007-12-29

Bug Fix: Searching

Minor fix here for an issue I noticed myself - if your search results included a sector, when you clicked it wouldn't be centered or scaled reasonably. A little digging found that when I switched from XML to JSON search result processing I'd dropped some of the logic. Clicking the search results now behaves as it did previously.

I also noticed that I wasn't "stemming" words at all, so I threw in a simple rule to drop 's when indexing - try searching on "trin" and you should get 3 results. Ω

2007-12-27

We're out of beta - we're releasing on time!

I'm calling the credits experiment done, and out of beta. Shipped!

You'll now see metadata in the page footer for the area on which the map is centered - including world data if you're over an occupied parsec. The data shown will include:
  • Sector Name
  • World Hex
  • World Name
  • World UWP
  • Sector Era
  • Author
  • Source
  • Publisher
  • Hyperlink to source of data
Although not present in the beta, I've added in the Era ("circa 1117") if this is known for the particular dataset - corrections welcome!

Another feature that was in beta was a map legend, a new link in the lower left. This launches a popup window (your browser might block it) which uses the current map style to explain the details. (Question: with J-6 and unlimited fuel, how long would it take to get from Regina to Tertius?)

Also, I've added an experimental new API: /SEC.aspx?sector=SECTORNAME - this dumps a standard SEC file for the specified sector. The column widths are undefined - you'll want to use a regular expression to parse it.

Finally, per request on COTI, you will now see UWPs when zoomed in to 128 pixels/parsec. Ω

2007-12-24

Custom Posters

I've added HTTP POST support to the Poster API - including documentation and sample forms.

In English:

If you have a .SEC file you can now upload it and have it rendered for you, including optional XML metadata. However, the sample form is raw - you can't specify rendering options. It should be possible for someone to write a form that exposes all of the rendering options/scale parameters as check-boxes. Ω

2007-12-23

Map API Updates

A bunch of internal cleanup and refactoring, which will hopefully have no noticeable impact on the site, and three subtle changes to the Poster API:
  • Extra-sector worlds no longer rendered - borders and routes will be shown, but the worlds themselves will not be.
  • Added an optional subsector=X argument where X is the A...P index of the subsector. If specified, only that subsector is rendered.
  • If no render options are specified, by default a sector poster elides the sector grid lines and a subsector poster elides the subsector grid lines as well.
This should make it easier to use the site as an API for static navigation. For example, the following image is embedded in the blog via the following markup:

<img src="http://www.travellermap.com/Poster.aspx?sector=Spinward+Marches&subsector=C&options=2928&scale=64" border="4" />



The API documentation in the last post was incomplete, so here's another shot:

/Coordinates.aspx?sector=SECTORNAME[&hex=XXYY]
  • Maps a sector name (and optional hex coordinate) into sector/hex coordinates
  • Results are in XML, or JSON if Accept: application/json is specified
  • example
/Credits.aspx?x=XCOORD&y=YCOORD
  • Looks up the data and credits for a given location, including UWP if available
  • Coordinates are in tile-space coordinates (optimized for tile rendering, not navigation); conversion functions are in the script
  • Results are in XML, or JSON if Accept: application/json is specified
  • example
/MSEC.aspx?sector=SECTORNAME
/Poster.aspx?sector=SECTORNAME[&scale=N][&subsector=X][&options=O]
  • Generate a GIF or JPEG image of the specified sector (or just subsector). Scale (pixels/parsec) and options can be included
  • Image format depends on selected options ("Candy" produces JPEG, otherwise GIF)
  • Options are defined in the script
  • example
/Search.aspx?q=QUERY
  • Perform a free-text search of names for matching sectors, subsectors and worlds
  • Results are in XML, or JSON if Accept: application/json is specified
  • example
/Tile.aspx?x=XCOORD&y=YCOORD&scale=N&options=O[&w=WIDTH&h=HEIGHT]
  • Generate a GIF or JPEG image of the specified region.
  • Coordinates are in tile-space coordinates (optimized for tile rendering, not navigation); conversion functions are in the script
  • Image format depends on selected options ("Candy" produces JPEG, otherwise GIF)
  • Options are defined in the script
  • example
In case it isn't obvious, the map page itself works by calling these APIs from JavaScript (primarily Tile, but also Coordinates and Search depending on user actions; use of Credits is still "in beta")

Please feel free to make use of any of these APIs. If you encounter any issues with them, let me know! Ω

2007-12-07

Nothing to see here (almost)

Well, hopefully no changes. I've done some behind the scenes tweaks recently though:
  • Can now parse other data file formats. This is in anticipation of new data files for T5. Not used yet.
  • The web services now provide either XML or JSON data, depending on the HTTP "Accept" header (specify "application/json" to get JSON data, default is still XML). For the curious, the services are:
    • /Coordinates.aspx?sector=SECTORNAME[&hex=XXYY] example
    • /Credits.aspx?x=XCOORD&y=YCOORD (in internal map coordinates) example
    • /Search.aspx?q=QUERY example
  • The Beta Page now uses JSON instead of XML for smaller queries and faster parsing
  • The Beta Page no has switched from using XML/XSLT to JSON/JSONT and should now work in Safari 1.3 (e.g. MacOS X 10.4)
I've also cleaned up a few label positions around the edges of the Imperium, but nothing special. Ω