8

I will use com.vividsolutions.jts.geom.Coordinate as my coordinate class. But don't find any document which is the correct order of the coordinate. is it standard?

Here's the java doc link -> http://www.vividsolutions.com/jts/javadoc/com/vividsolutions/jts/geom/Coordinate.html

My question is: What is x? (is it Latitude or Longitude?) What is y? (is it Latitude or Longitude?)

Any guidance is appreciated.

UPDATES1 Let me to add this. I am using GeoTools Java Library. Then, the library is using that Coordinate class. How does GeoTools treat the Coordinate.x and Coordinate.y?

eros
  • 4,946
  • 18
  • 53
  • 78
  • From its javadoc: "A lightweight class used to store coordinates on the 2-dimensional Cartesian plane". So you have a point in the geometrical sense not in the geographical one. So it depends on you how you want to view it (although it's common to see x as the longitude and y as the latitutde). – Calin Nov 24 '11 at 07:50
  • 1
    That class doesn't seem to have anything to do with latitude and longitude, it's just a geometric abstraction. – skaffman Nov 24 '11 at 07:50
  • You are both correct. I have updated my post. How does GeoTools treat Coordinate.x and Coordinate.y? – eros Nov 24 '11 at 07:56

2 Answers2

3

It depends on the projection you are using. Check the EPSG definition and it will list the axis order. For example see http://spatialreference.org/ref/sr-org/6864/prettywkt/. If you are using GeoTools then you probably don't need to be worrying about the JTS internals.

UPDATE

I remembered this document which may help (http://docs.geotools.org/latest/userguide/library/referencing/order.html)

Ian Turton
  • 10,018
  • 1
  • 28
  • 47
  • yes you are right. but I just need to know what is x,y in geotools. if it depends on the projection, I really don't know about projection but I am working with ESRI Shape File then read it using GeoTools. I will accept this as the best answer as it provides example of clear definition of X(EAST),Y(NORTH). – eros Nov 25 '11 at 00:12
  • No you missunderstand my point - there are many projections that define X(North) Y (East) so you have to work out which you are using by querying the CRS object with your datastore. – Ian Turton Nov 25 '11 at 08:27
2

In Cartesian coordinates, x maps left-right and y maps up-down. So, a natural fit oriented in front of a map would be to use x for longitude (east-west) and y for latitude (north-south). There's a z as well, that could be used for altitude.

phatfingers
  • 9,770
  • 3
  • 30
  • 44
  • You are correct. But I need confirmation on how it treats using GeoTools Library. – eros Nov 24 '11 at 08:11
  • 1
    From their docs, it appears they support quite a number of different formats. You get to pick your favorite. http://docs.geotools.org/latest/userguide/library/opengis/cs.html – phatfingers Nov 24 '11 at 08:34
  • I found this statement -> `The formulae for these map projections can be used to convert (latitude, longitude) coordinates from a geographic CRS to planar (x,y) coordinates in a projected CRS.`. What does it mean (Coordinate.x is latitude, Coordinate.y is longitude)? – eros Nov 24 '11 at 09:14