In postgis, I use geography type, it support many geographic calculation, like st_dwithin(geography1, geography2, distance). What I need to do is just giving some points coordinates (lng, lat pair), on need to care about coord system. Now I want to use java to achieve those functions. I found this useful answer geotools-linestring-distance, @iant point out CoordinateReferenceSystem auto = CRS.decode("AUTO:42001,13.45,52.3");, after convert crs, I can get a correct distance. But what "AUTO:42001" means? how can I choose a better target system? Is there any documents or blogs to explain?


The OGC WMS standard describes a number of "automatic" projections that are centred on the points provided as part of the name. This allows a user to request a map that has an optimal projection for the area they are working in. GeoTools implements these projections (mostly for the benefit of GeoServer) so it is convenient to use them when calculating distances between close objects that could be located anywhere in the world without the program knowing beforehand the area of interest.

They take the form of


From the GeoServer manual we get the following list of auto_crs_ids:

ID      Projection
42001   Universal Transverse Mercator
42002   Transverse Mercator
42003   Orthographic
42004   Equirectangular
42005   Mollweide (not supported in GeoServer 2.8.x)

GeoServer also supports some non-standard coordinate reference systems. These are

ID      Projection
97001   Gnomonic
97002   Stereographic

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.