Myths on Maps

  • Log in
  • « Day 3: Activity Log
  • Day 2 »

How to get a region's centre

Posted by gregster on 26 Oct 2015 in Documentation

So, you click on a place and get a little Google map. But! the map is all blue. The place is *probably* a region that hasn't been given a centre yet. Here's how to fix it on, say, Macedonia.
Macedonia's entry in PLAC1.xml looks like this:
-----------------------------------------------
<place xml:id="MACE1">
<placeName>Macedonia</placeName>
<geogFeat type="Polygon" role="region">
<geo>40.166281,22.18689 40.782621,21.821594 40.948788,21.654053 41.257162,21.599121 41.428313,22.206116 41.352072,22.793884 41.109365,23.369293 40.73269,23.648071 40.584757,23.571167 40.618122,22.939453 40.636883,22.890015 40.586842,22.854309 40.559461,22.81208 40.565459,22.745132 40.50649,22.726593 40.526848,22.666855 40.471241,22.657585 40.476203,22.601624 40.415587,22.60437 40.381598,22.62291 40.366427,22.657928 40.244419,22.59819 40.149751,22.551842 40.019201,22.598877 40.049694,22.524033 40.094882,22.460175 40.088579,22.209549 40.166281,22.18689</geo>
</geogFeat>
</location>
</place>
-----------------------------------------------

The Google map is generated by using a single set of vertices, and Macedonia doesn't have a single set. So, until a more elegant method is created, we'll add a new location element to provide a 'centre' for the region by adding this:
-----------------------------------------------
<location type="centre"><geogFeat type="Point" role="centre"><geo>40.727,22.624</geo></geogFeat></location>
-----------------------------------------------

I got the centre by using <a href="http://hcmc.uvic.ca/people/greg/maps/vertexer/">the Vertexer</a>. I pasted the content of the polygon's geo tag (above) in to the box on the left of the Vertexer page and clicked the '+' button to add it to the map. Once it is on the map, click the zoom button (middle section of the Vertexer page) to zoom and centre the map. Once centred, the box to the right of the page will provide a 'Map centre' that you can copy and paste in to the new location (as above).

This entry was posted by Greg and filed under Documentation.

Myths on Maps

This project will focus on deploying an interactive map of Europe with overlays for Greek and Roman myths, history, people and events.
SVN instructions for MoM editors
Development URL
HCMC Blogs home
  • Archives
  • Categories

Search

XML Feeds

  • Atom: Posts
  • RSS 2.0: Posts
What is RSS?

This collection ©2023 by admin • Help • CMS + user community