2

I'd like to use Proj(4j) to convert between UTM and Lat/Long coordinates.

I used to use JScience for UTM <-> LatLong conversions like this:

UTM.latLongToUtm(latlong, ReferenceEllipsoid.WGS84);
UTM.utmToLatLong(coordinate, ReferenceEllipsoid.WGS84);

But I would like to accomplish this using Proj4j. So I'm currently having set up two CoordinateReferenceSystems:

CRS_FACTORY.createFromParameters("EPSG:4326", "+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs");
CRS_FACTORY.createFromParameters("?", "+proj=utm +? +zone=?);

Where I don't know how to fill up the ? gaps.

Why do I have to specify a zone-parameter? Is there a way to accomplish the same above in JScience using proj4j?

3

If you're using WGS84, for a northern hemisphere zone, concatenate 326 + zone number. For a southern hemisphere zone, concatenate 327 + zone number. The 326 comes from 4326, the code for a 2D WGS84.

So for zone 30N, 32630.

There are a few other drop-first-integer-and-concatenate-zone-number, but none as complete as WGS84. Others, like NAD83, the first zones added follow the same convention but later ones do not.

I should have made this a comment on simplexio's answer--vote for that answer!

  • Thanks a lot, I'd like to upvote both of you, but unfortunately I don't have enough reputation. – implicit_knowledge Sep 13 '12 at 12:39
1

Search for "Named Projections" in this web page:

http://proj4js.org/

Basically, you should use the strings defined in Proj4js lib folder:

Proj4js comes with a lib/defs folder that contains predefined projections, which can be included in your javascript. If your desired projection is not there, go to http://spatialreference.org/, search for your projection and choose to display the proj4js definition string. This can be pasted into your application.

Hope it helps.

0

Newer used JScience, but in PostGIS/FME/Proj4 enviroment it works something like this...

See UTM zones http://en.wikipedia.org/wiki/Universal_Transverse_Mercator_coordinate_system and http://www.dmap.co.uk/utmworld.htm

You select UTM zone depending which area you want to be moust accurate. For an example if you you zone 35 with data from Asia you will have lot of distortion.

first ? can be EPSG code http://spatialreference.org/ref/epsg/?search=UTM second ? no idea third is zone

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.