Nick’s Blog

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 http://www.tatukgis.com/

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 6.1.11.1) 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

Greetings,

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 escalation@evony.com.

Regards,

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 escalation@evony.com.

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
accordingly.

Thank you,
Evony Support

So I was not entirely filled with hope that the issue would ever be resolved and joined the community at bbs.evony.com 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

REGAN MERCANTILE US, LLC MAY SUSPEND, TERMINATE, MODIFY, OR DELETE ACCOUNTS AT ANY TIME FOR ANY REASON OR FOR NO REASON, WITH OR WITHOUT NOTICE TO YOU

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.

http://www.bruceongames.com/2009/08/25/evony-want-to-sue-me-for-telling-the-truth/

http://www.bruceongames.com/page/2/?s=evony

http://ezinearticles.com/?Evony—Game-Free-Forever&id=3720754

http://www.brighthub.com/video-games/mmo/articles/46094.aspx

http://www.articlesbase.com/computers-articles/evony-games-free-forever-1856785.html

http://www.funclub92.com/2010/04/evony-drops-libel-lawsuit-against-uk-blogger.html

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

You know how it is.

by Nick on Mar.14, 2010, under Rants

You are brought up in a Christian school and told of the certainty of God, how he is looking out for us and how kind and good he is. You soon find that there are millions of people around the world that are starving and how the Church is doing good works to try to help these poor people. You might start to wonder why God does not help them but this is explained because God has given us free will. (continue reading…)

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

Dark matter is like God

by Nick on Mar.10, 2010, under Rants

I am not sure this really counts as a rant because I am not in any way angry about it.  I was watching Horizon on the BBC last night. It was asking if everything we think we know about the universe is wrong. They had talked to a theoretical physicist (he looked real to me) and he was saying that the Universe is not behaving in the way that Newtonian physics predicts. So he and many other physicists had come up with the concept of dark matter. This is material that does not interact with the materials that we know and does not absorb, reflect, or scatter light. (continue reading…)

Leave a Comment :, , more...

Nearly one less biker

by Nick on Mar.05, 2010, under On The Road

Actually the title suggests I think that would be a good thing. Not in the least bit but I’m prepared to make an exception in this case. (continue reading…)

Leave a Comment :, , , more...

Big brother is watching you even more closely

by Nick on Feb.01, 2010, under On The Road

In 2012 the Dutch government hopes that all car drivers will be forced to fit a little box to their cars. This GPS equipped box will apparently record every movement that the car makes and report generalised data back to government HQ. At this stage the technical details of this generalised data are rather sketchy but I suppose, in principle, if the spy box is forced to report only that you travelled 40Km in rush hour along an A class road during the month of December then I’d probably be happier. But this does not quite square with the other claims I’ve heard. (continue reading…)

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

My belief in evolution

by Nick on Jan.10, 2010, under Rants

You can call it a faith if you like because without proof you can only believe that something is true. However my belief is that we did indeed climb out of some kind of soup (no not looking like we do today) and evolved from there. What I do not believe is that around 5000 years ago some mystical figure created everything and has been watching our every move ever since.

Now I am prepared to admit that we have no real proof that this did not happen but equally we have no proof that evolution did not happen. However, today, I stumbled across a channel called the family channel. And showing on that channel was a programme aimed at debunking evolution and proving that the only realistic alternative was creationism.

At one point in the programme they pointed out some holes in evolution (I believe Darwin was responsible for making these observations and he left it to future generations to fill in the gaps). Amongst these were things like how statistically unlikely the first proteins were and how there are missing links in the fossil records. They then concluded that because of the lack of proof then it must all be false.

Well if they are going to use that argument then how about using it against their own beliefs. I mean lets face it, they have lack of proof written into the instruction manual. So if lack of proof is what it takes to debunk a theory then perhaps creationism is not true either.

At this point you might be wandering if I am agnostic or atheist. Well the problem is that I believe in scientific principle. And that means you come up with an idea and you work damn hard to prove it true. Atheism is a form of disorganised religion where you firmly believe there is no god. I firmly believe that there is no god and so I am an atheist. However that also makes me a poor scientist because without proof an atheist is simply a believer in nothing. So I am also prepared to allow for other possibilities such as God kick-started the whole life thing and it went from there, or we are all sitting in a giant computer simulation and the operator/designer of that simulation is what the religious people call God. I hold out no hope that these will be proven true and I will not be spending my time trying to get others to believe them. I am still firmly convinced that more and more evidence for evolution will be found and I am convinced that when that proof is found it will be dismissed as irrelevant by those that believe in a god.

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

Getting back in touch

by Nick on Dec.03, 2009, under Blogging

Many, many years ago I worked in the UK for a company in Birmingham. I was only there for around eight months but I still have great memories of the time and especially how friendly my colleagues were. A good example was on the first day when another colleague accidentally walked off with my coat and keys to the car making driving home impossible. Possibly this is the reason that to this day I never leave my coat on a shared coat stand. (continue reading…)

Leave a Comment more...

Big brother is watching us

by Nick on Dec.03, 2009, under On The Road

Every morning I travel along the A4 to work and every evening back again. I try to travel really early (before 7am) to avoid the rush hour. A few days ago we received a letter at home saying they had been monitoring the road and could I fill in a form asking about my journey. My reaction to this is scepticism, on the face of this it is just a survey to find out when and why people are travelling. But frankly my problem with this is as follows.

There are two ways to ease congestion, one is to make sure the roads are wide enough to cope with everyone that wants to use the road. If this is the case then you do not need to know why someone is travelling, all you need to do is look at the road and get an idea of how much traffic is using the road and how much more room will be needed to allow the traffic to flow freely. Of course if you make a road wider then more people will be inclined to use it and often that will mean widening again.

The other way to reduce congestion is to tax people off the road so that only those with deep pockets or a desperate need can use the roads. Schemes in the UK have shown that this works nicely and if the money were ploughed into the infrastructure of public transport then I think I’d be OK with this. The government here in the Netherlands are now introducing something called rekeningrijden. What it means is you pay for every kilometre you travel and then you pay extra round some of the bigger cities to travel in the rush hour.

A way to look at this is that those with the ability to pay will have the roads cleared of troublesome poor people so they can get to work more quickly. Well I have another idea, perhaps you could have a tariff that is directly proportional to the environmental impact of the vehicle.  The more polluting vehicles will pay more while the smaller cleaner vehicles will perhaps even go free. This alone would clear out some of the larger polluters (the ones most people want to see off the road) but I’d go further. Buying your access to the road would be in the form of a smart card that gives you so much credit. You are not allowed to top up the card beyond a certain limit.  For a small clean vehicle this limit might be enough to do a months travel round town but for larger vehicle it might mean topping up two or three times a week. So for those that travel huge distances in large vehicles they might even find themselves having to stop in while filling up with petrol to top up the card. Naturally there might have to be some exceptions such as for buses and goods vehicles but not for lease cars.

So back to my survey. Why do they need to know the purpose of my journey? Well I’m guessing that they are wanting to know if the morning rush hour has started. How would you define that? Well if everyone (or the majority of people) travelling at a particular time are doing so for work then it must be the rush hour yes? This would then allow the government to say “Ha, Mr Askew, you were travelling in the rush hour so come on pay up.”. It will not matter when I travel, the fact that I am travelling for work means as long as enough other people are then it is the rush hour. So frankly what business is it of the government why I am travelling. There job is to provide an infrastructure that allows us to live and not simply impose another scheme that hands to those that have at the expense of the have nots.

Leave a Comment more...

Zwarte Piet (beloved characature or symbol of racism)

by Nick on Nov.18, 2009, under Blogging

Much of what I’m writing here is based on the article in Wikipedia (http://en.wikipedia.org/wiki/Zwarte_Piet).

In the mid 1990’s my wife and I moved to the Netherlands. It was late in the year and it was not long before we encountered Sinterklaas and his helpers Zwarte Piet. For those not familiar with the story here is a very short summary. In mid November Sinterklaas arrives on a steam boat from Spain bringing toys and helpers. Over the coming weeks these toys are distributed to the children by the helpers as the children leave shoes, carrots (for Sinterklaas’ horse), and drawings.

The arrival of Sinterklaas is televised and much is made of his presence in the land over the following weeks until finally on the 5th of December big presents are shared during a family evening. Over the weeks there are often parades and Piet can be seen handing out sweets to the children and often being a little mischievous. (continue reading…)

Leave a 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!