Convert Lat/Lon sexagesimal degrees to UTM coordinates

I'm using proj4.js to convert geographic coordinates (degrees, minutes and seconds) to UTM coordinates (ETRS89 Zone 30). When I get my coordinates result of the transformation I'm checking them with several web coordinates converters and I never get the same result (I mean really different coordinates) so I don't know if I'm doing something wrong or what.

To make the conversion, I first transform the coordinates from degrees, minutes, seconds to decimal degrees and then make the conversion like this:

``````var firstProjection = "+proj=longlat +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +no_defs";
this.secondProjection = "+proj=utm +zone=30 +ellps=GRS80 +units=m +no_defs";
var longLat = this.toDecimalsDegrees(); //Array with coordinates in decimal degrees

var result = proj4(firstProjection, this.secondProjection, [longLat[0], longLat[1]]);
``````

Finally, it is correct the longitude coordinate first and latitude then?

The coordinates I'm using are:

Longitude: 6º 2' 32.929'' Latitude: 37º 21' 41.131''

And once I have converted them to decimal degrees:

Longitude: 6.042480466276646 Latitude: 37.361425499749146

The result of the reprojection that I get with the code mentiones above is:

X: 1301616.242 Y: 4173536.779

Meanwhile in other web conversors the rresult is:

X: 761940.319 Y: 4139140.14

• Providing details of the different results would help. As far as your question goes, it would be a matter of a few seconds' work to reverse the lat and lon coordinates and see how the result changes: did you try that? What were the results? Another possibility is an error in conversion from DMS to DD, but again you need to post the details. Dec 22, 2017 at 17:10
• @whuber thanks for answer I've updated the info in order to make it more clear to check it. Dec 27, 2017 at 9:14
• You might be missing a minus sign or you are in the wrong utm zone. The Zone 30 goes between -6º and 0º. Dec 29, 2017 at 13:07
• It was indeed because of the minus sign...I didn't realize. Thank you! Jan 3, 2018 at 12:18