Nick’s Blog

Archive for April, 2010

Point order in spatial data (or it depends how you look at it)

by Nick on Apr.27, 2010, under GIS

I was battling with a new GIS application and started getting complaints from some people that the points were being ordered wrongly. Now I have always known that the point order in some spatial systems is important. Mostly I rely on the software between me and the storage to correct the order before saving and this time was no different. I am using the products of a relatively small Polish outfit called TatukGIS. They have made quite a nice product and are helpful when things go wrong. Their product is a viewer and middleware that allows many different spatial formats to be read or written to. You can read more on their site

Now as a use of an application I can imagine that as you draw a polygon, that represents the boundary of your garden for example, you are not concerned in which order you draw the points (clockwise or anticlockwise) but in theory it makes a difference. I’ll try and describe the reason as best as I can. There are two ways to explain it, the Oracle way that I learned a while ago and the WKT (well known text) way that I’ve only just read. To be honest both make sense but the WKT way perhaps gives a little more information than the Oracle way.

Firstly Oracle simply says that a polygon exterior is a list of points that must be filled counter clockwise. (See 2.2.4 of the spatial data types and meta data documentation.) Now I was always told that the explanation was you need to imagine yourself walking around the exterior, on your left is the interior. So, in theory, if you specify the points on the other order then everything outside your garden would become garden and only the bit inside would be not garden (nice mistake if you can get the land registry to make it). But Oracle also says that any holes in your garden must be specified clockwise. Well if you think about this for a moment (taking the classical doughnut as an example) it makes perfect sense. You walk around the outside of the doughnut anticlockwise and everything on your left is doughnut, walk around the hole clockwise and again everything on your left is doughnut.

Secondly the WKT way. WKT is a way of formatting geometries in a standard fashion that is supported by many databases and can easily be used within databases that do not natively support spatial information because the format is purely text (there is also a WKB version, a binary format, that is more efficient with the storage but is not human readable). Their documentation (section states “The exterior boundary LinearRing defines the “top” of the surface which is the side of the surface from which the exterior boundary appears to traverse the boundary in a counter clockwise direction.”. Now if you consider this for a moment it sounds like exactly the same thing and really it is. But suppose once again that you look at your garden, draw out the points in a clockwise fashion and then hand the map to someone that does not know your garden. They might conclude that either a) you have made a mistake b) your garden is best viewed from the underside or c) your garden occupies the entire map with the exception of the small bit in the middle.

I would suggest that most people will conclude alternative a) that you have made a mistake. And it seems that this is the alternative that a large number of software packages makes (including Tatuk and GeoMedia). However they are guessing at your mistake and perhaps you really do have a massive garden. Move to three dimensional data and the difference becomes less clear. In three dimensions how can you tell  which side is the top of something, and what does top really mean? Suppose you have a drawing of cube that represents a water tank. What order would you draw the points of the bottom panel of the tank? Does the top of that panel point downwards or upwards? And what about the sides?

If you are wondering about the idea that your garden could occupy the entire globe then imagine a spherical world (a bit like earth perhaps) and draw an island round one of the poles. Now imagine how this island might look if you were to try to draw this map on a flat piece of paper. It would probably look simply like a straight line running along the top of the paper. Now how do you decide which side of the line is land and which is water? Now imagine and island that covers half of the globe. It does not matter which half, you will always need to somehow decide which is inside and which is outside.

I said earlier that I would revisit this and add some information about other file formats. The next file format up is the shapefile from ESRI. According to the ESRI definition of the shapefile (see page 9) the order of the points is opposite to that of the previous two formats that I listed. This does, of course, pose a risk for those developing tools to read from one format and write to another, and that is that they have to reverse the order with each read/write. Not that this is any reflection on ESRI, actually the shapefile format pre-dates  both of the previous two formats.

Microsoft have been fairly slow to recognise the necessity of spatial capabilities in their database but 2008 has finally seen the introduction of two new data types. Geography for storing geodetic (real world) data and geometry for storing planar data. Hopefully their time spent catching up also means they have overtaken some of the now elderly formats and engines.  For the geometry type Microsoft states that the point order does not matter. They go on here to say :-

The OGC Simple Features for SQL Specification does not dictate a ring ordering, and SQL Server does not enforce ring ordering

Which seems at odds with the earlier reference that I gave earlier stating that it does matter. However that was a draft specification so perhaps they later dropped the requirement. I can quite see how a polygon on a planar system is unambiguous but WKT is not solely used for planar systems.  Clearly a little more homework is required.

For the MS SQL Server Geography type the point order is important but the documentation I read did not say what the ordering should be. What they did say is that no geometry using a geography data type may be larger than a hemisphere and that there is effectively no such thing as an inner or and outer ring. This last point might sound like non-sense but actually it makes perfect sense.

Imagine an island that has two lakes. Now make the island so big that it covers nearly the entire planet. Does it really make sense to call one of the exteriors the outer? In other words anything that is not dry land is outside the island. Let us imagine that one of the lakes has an island of its own. And suppose the island has a school. Now you perform a query to find which schools lie on the original outer island, is the school on the island in the lake of the island included. No! Not if you are using the geometry of the main island.

But I can imagine that there are circumstances where this theoretical lack of distinction would get in the way. Suppose I want to know where all the schools are within the territory of the main island. In most other systems I’d load up my polygon, delete any interior holes and then query the database. Only under SQL Server  that will not be possible because I have no idea which is my outer, they are all outers. I might be able to iterate over the outers and find out which is the largest and delete the rest.

I am going to have to come back to this topic to make it complete for other databases and file formats.

Leave a Comment :, , , , , , , , more...

I’m an Evony Cheater

by Nick on Apr.09, 2010, under Rants

At least according to Evony I am. They sent me a little email a fews days ago (6 April 2010)

Account Action: Suspension

Reason for Action: Terms of Use Violation


After a thorough investigation, we have found that the account listed above violate the terms of use listed below:

Use cheats, automation software (bots), hacks, mods or any other unauthorized third-party software, databases or scripts designed to modify the Evony experience.

You may not perform any acts that we consider to be damaging to Evony. While we try to be as lenient as possible, and take in consideration many mitigating circumstances, the reoccurring offensive trends listed above have led to the suspension.

This Evony account has been suspended for 3 days by the Account Administration staff based on a review of the account and all related policy violations. Be aware that any additional inappropriate actions may result in the permanent closure of the account.

This action has been taken in accordance with the Terms of Use and our In-Game Policies.

Only the Account Administration department can address disputes or questions you may have about this account action. To learn more about how we are able to assist you, please email to


Account Administration

The Evony Team

IMPORTANT NOTE: Please do not respond to this email. Any email sent as a response to this message will not reach us. Should you have another question or would like to send us additional information, please contact us by emailing

Well what surprised me was that this came shortly after I’d decided to give up on the game and had not logged in for several days. I had two cities and one of them was attacked and taken over. It had taken me so long to build the city that I figured that I really did not have enough time to build it again. But I did not want my attacker to then go on and reap the rewards of taking over my other city (or at least clearing it out) so I proceeded to hold a fire sale. I sold everything for next to nothing. I built a new city near by. Moved everyone into the new city and abandoned the old one. I then teleported my new city away and never logged in again.

A few days later I heard about their new game. It promised a better experience with no bullies. I was curious and created an account on their beta server. I played for a few minutes before realising it was just the same game with a fancy interface and some woman commentating on everything you do. Oh well done my Lord you really are turning out to be a super Evony customer. Realising that it was going to be every bit as dreary as the old game I abandoned that one too and then I received the mail saying I was a cheat and that my account was locked.

So I wrote back to Evony

Hello Account Administration,

Firstly which account listed above? You appear not to have listed any account in the mail. However given that you have sent the mail to this email address I guess you are either talking about the beta account or the live account.

Secondly I can categorically tell you that I have not used any cheats on either account (unless using Firefox counts as cheating). You might well be thinking that they all say that but well really this time it is true. To my knowledge I have not logged in since sometime last week when someone mounted an attack on one of my cities and I decided enough was enough and stopped playing. To be honest I’d already got bored of playing Evony as it seemed that to do anything required endless waiting around. But given that you are accusing me of cheating based on what must be false information (or the possibility that my account has been hacked) you might want to dig a little deeper in case you are falsely accusing other users who might actually give a damn.

Hang on a moment. I did try to flog off all my stock before destroying the city. The logic went like this. Someone clobbered my main city. I then thought they would probably attack my other city next and frankly did not want to give them the satisfaction of getting something for nothing. So I flogged everything for 0.0001 gold. To my surprise I seemed to earn an absolute fortune for doing so. That is not cheating, that is a bug in your sloppily written code. I then abandoned the city, gold and all, and relocated the other city out of reach of the attacker and then never logged in again.

Finally please feel entirely free to delete both accounts (beta and live) that are associated with this mail address and then remove me from all future mailing lists.

and got a standard out of office reply telling me to wait 5 days before complaining that they did not answer.

Dear Customer,

Thank you for contacting the Evony support center.  To better assist
you, we have forwarded your customer service request ticket to a
specialized department that handles issues which you are reporting.

We ask that you be patient while that department reviews and
investigates your customer service request ticket in detail.  As
reviews and investigations can take time for us to replicate your
issue, we might be making contact to you asking specific questions
regarding your ticket if the department feels it cannot replicate or
investigate an outcome based on your report request.

Please do let us know if you feel you have not after 5 business days
received a timely response and we will escalate the ticket

Thank you,
Evony Support

So I was not entirely filled with hope that the issue would ever be resolved and joined the community at and found that, far from being the only one claiming to have been falsely locked out, there seems to be large group of people all saying “Hey I’m innocent”. They all tell the same or similar story. Suddenly they are locked out and Evony refuse to enter into a discussion about it. I never spent money with them but there are players who claim to have done exactly that and then get barred. I really feel sorry for those people.

Well I’m still within the 5 days notice period. My account might be unlocked today but frankly I do not care. I just want to highlight my innocence and then get on with life in the real world. So if you are thinking of starting to play Evony please do a little research. It is a fun game initially but the threat of suspension is hanging over everyone. Here is section 8 of the TOC’s


If you have also been accused of cheating then please feel free to drop me a comment and if you have your own blog I’d be happy to link to it. Please make sure your comments are accurate and not abusive otherwise they will not be posted.

If you are interested in a little more reading about the game here are a few links to get you started.—Game-Free-Forever&id=3720754

1 Comment :, , , , , , , more...

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Founder chanel replica founded the Chanel brand in Paris, France in 1913. replica gucci wide range of products, including clothing, jewelry and accessories, cosmetics, perfume, each product is famous, especially her hermes replica and replica bags . Chanel is a famous brand with more than 80 years of experience. Chanel fashion always has elegant, simple and exquisite style. She is good at breaking through the tradition. She successfully pushed the fake bags of “Five Flowers” to simple and comfortable in the 1940s. This is perhaps the earliest modern casual wear.