{"action":"created","issue":{"url":"https://api.github.com/repos/proj4php/proj4php/issues/9","labels_url":"https://api.github.com/repos/proj4php/proj4php/issues/9/labels{/name}","comments_url":"https://api.github.com/repos/proj4php/proj4php/issues/9/comments","events_url":"https://api.github.com/repos/proj4php/proj4php/issues/9/events","html_url":"https://github.com/proj4php/proj4php/issues/9","id":108308854,"number":9,"title":"Standardise coordinate system conversions","user":{"login":"judgej","id":395934,"avatar_url":"https://avatars.githubusercontent.com/u/395934?v=3","gravatar_id":"","url":"https://api.github.com/users/judgej","html_url":"https://github.com/judgej","followers_url":"https://api.github.com/users/judgej/followers","following_url":"https://api.github.com/users/judgej/following{/other_user}","gists_url":"https://api.github.com/users/judgej/gists{/gist_id}","starred_url":"https://api.github.com/users/judgej/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/judgej/subscriptions","organizations_url":"https://api.github.com/users/judgej/orgs","repos_url":"https://api.github.com/users/judgej/repos","events_url":"https://api.github.com/users/judgej/events{/privacy}","received_events_url":"https://api.github.com/users/judgej/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-09-25T11:38:21Z","updated_at":"2015-09-25T14:12:42Z","closed_at":null,"body":"The `Point` class seems to be used for many things. For example, the projections `forward` and `inverse` methods take the x and y of a point and treat them as latitude and longitude values. That is kind of confusing. If they need a lat/long pair, then there should be an object to provide that.\r\n\r\nThe LongLat class is there, but basically does nothing. I think I need to take a step back to understand the relationships a little better between the coordinate systems, and projections, and the sequence of conversions that are supported, the order in which they happen, and the standard objects that each conversion sequence goes through. Mapping this out will, I believe, highlight a few holes and will help to understand the system overall.\r\n\r\nhttps://github.com/academe/proj4php/tree/master/src/Mgrs"},"comment":{"url":"https://api.github.com/repos/proj4php/proj4php/issues/comments/143234741","html_url":"https://github.com/proj4php/proj4php/issues/9#issuecomment-143234741","issue_url":"https://api.github.com/repos/proj4php/proj4php/issues/9","id":143234741,"user":{"login":"judgej","id":395934,"avatar_url":"https://avatars.githubusercontent.com/u/395934?v=3","gravatar_id":"","url":"https://api.github.com/users/judgej","html_url":"https://github.com/judgej","followers_url":"https://api.github.com/users/judgej/followers","following_url":"https://api.github.com/users/judgej/following{/other_user}","gists_url":"https://api.github.com/users/judgej/gists{/gist_id}","starred_url":"https://api.github.com/users/judgej/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/judgej/subscriptions","organizations_url":"https://api.github.com/users/judgej/orgs","repos_url":"https://api.github.com/users/judgej/repos","events_url":"https://api.github.com/users/judgej/events{/privacy}","received_events_url":"https://api.github.com/users/judgej/received_events","type":"User","site_admin":false},"created_at":"2015-09-25T14:12:42Z","updated_at":"2015-09-25T14:12:42Z","body":"Ah, I think I see what is confusing me so much. The Point class is used for LOTS of different coordinate systems. Just by looking at a Point object, you *cannot* tell anything about what coordinate system it represents - it could be long/lat, x/y/z, or any other coordinate system. That is very wrong IMO - context is everything, and this might as well be a scalar variable, because as an object it offers nothing more useful than $x and $y scalar variables.\r\n\r\nOn top of this, the coordinates in Point objects are converted, so $point passed in with one coordinate system is not the same as $p passed into the projection converter (which is always long/lat) since it has gone through a conversion process related to the defs being used. The from-def defines what coordinate system is used to input. I'm not sure whether the to-def defines the output coordinate type, or it is converted to be the same as the input coordinate system (as proj4js states).\r\n\r\nSo the way forward IMO is to relegate `Point` to an abstract class that all coordinate systems inherit from, then define a new class for each coordinate system and use these classes where they are needed.\r\n\r\nBy doing this, type hinting does the job it is supposed to do - making sure only the correct data types are passed into other classes as appropriate. By making them all objects, they can also self-validate, so you cannot create a point with a set of invalid properties in the first place.\r\n\r\nSo each projection `forward` method will take a LongLat object in the WGS84 datum, and every `inverse` method will return a LongLat object in the WGS84 datum. These two methods will only deal with `LongLat` objects, and not with x/y `Point` data masquerading as Long/Lat. I think this will be a vast improvement over even the original Proj4JS that also uses one `Point` object to hold many different types of coordinates without any context of what they are."}}