I strongly agree with Michael Sumner. Mathematical adjustments may work but are heavily discouraged. The right way to work is to create two different spatial objects (I recommend to use the vect function of terra package) and then to reproject one of them in the other reference system or both in a common projection as for example EPSG:4326 or something like that. After that you can merge the two spatial objects in a single one or extract the new spatial coordinates to rewrite a new .csv file to be used outside R
-- Maurizio Marchi, PhD Forest Science - Ecological Modelling Researcher CNR - Institute of Biosciences and BioResources (IBBR), Florence Research Area, Sesto Fiorentino (Italy) SkypeID: maurizioxyz https://scholar.google.com/citations?user=_2X6fu8AAAAJ&hl=en #####------##### EUFGIS National Focal Point for Italy (www.eufgis.org<http://www.eufgis.org/>) Scopus Author ID: 57188626512 ResearcherID: T-3813-2019 https://ibbr.cnr.it/climate-dt/ Il giorno 7 ago 2023, alle ore 12:02, r-sig-geo-requ...@r-project.org ha scritto: Send R-sig-Geo mailing list submissions to r-sig-geo@r-project.org To subscribe or unsubscribe via the World Wide Web, visit https://stat.ethz.ch/mailman/listinfo/r-sig-geo or, via email, send a message with subject or body 'help' to r-sig-geo-requ...@r-project.org You can reach the person managing the list at r-sig-geo-ow...@r-project.org When replying, please edit your Subject line so it is more specific than "Re: Contents of R-sig-Geo digest..." Today's Topics: 1. Did I correctly convert my data from UTM zone 12 to 11? (Jason Edelkind) 2. Re: Did I correctly convert my data from UTM zone 12 to 11? (Michael Sumner) ---------------------------------------------------------------------- Message: 1 Date: Sun, 6 Aug 2023 15:23:08 -0500 From: Jason Edelkind <jasonedelk...@aol.com> To: r-sig-geo@r-project.org Subject: [R-sig-Geo] Did I correctly convert my data from UTM zone 12 to 11? Message-ID: <00383000-0c7b-47b4-ab3b-9a2dfafa9...@aol.com> Content-Type: text/plain; charset="utf-8" hello, first time user here and aspiring grad student. I have a set of location data that I’ve been trying to import into google earth engine from R as a CSV file. The problem is that about half of my data is from utm zone 12, and the other half is from utm zone 11. When I import my original data into google earth engine, the zone 11 data is shifted over to the right because I use utm zone 12 as the crs in R. After some reading into the definition of a utm zone, I tried to just subtract 6 from the zone 11 latitude values after first converting them to a lon/lat format. This appears to have worked as on first glance all of the zone 11 points are where they should be, however it feels like too easy a fix for me after struggling with this for several days. So my question is, is this an acceptable way to convert my data, or am I doing something wrong that could result in inaccurate location data? Thanks! ------------------------------ Message: 2 Date: Mon, 7 Aug 2023 09:26:32 +1000 From: Michael Sumner <mdsum...@gmail.com> To: Jason Edelkind <jasonedelk...@aol.com> Cc: r-sig-geo@r-project.org Subject: Re: [R-sig-Geo] Did I correctly convert my data from UTM zone 12 to 11? Message-ID: <caacgz99ucv1awymhg3km+sa0nl-ccjg5bogaizr2ycuuwhj...@mail.gmail.com> Content-Type: text/plain; charset="utf-8" You should treat the different sets of coordinates (from Zone 11 and Zone 12) completely separately. You cannot have mixed crs (of projected coordinates) in a dataset. When you plot in R (generally, even with popular spatial formats) there is no account taken of crs, the graphics doesn't know that you plot Zone 11 and then (say) add coordinates from Zone 12, they will be "shifted" as you say. (There are exceptions to this plotting rule but apart from ggplot2::coord_sf they are in dusty corners not front and centre of plotting code in R). Some level of coordinate hackery (arithmetic shifting) *can work* in limited circumstances, but I would highly recommend against that. Separate your coordinates into two objects, set the source crs appropriately of the zone for each, transform each to a common crs. (UTM is generally a bad idea but comes with a very popular usage culture which is a shame, there's no single right choice but you always need to put thought into the overall region of your data, the properties of the coordinate space that make sense for your work, and whether you will need smaller or larger regions in the future for related work ... I would advise a common crs that is *not UTM* but advice there really depends on the details of your situation). It's hard to be more specific without details of your flow, e.g. code examples. HTH, Mike On Mon, Aug 7, 2023 at 6:23 AM Jason Edelkind via R-sig-Geo < r-sig-geo@r-project.org> wrote: hello, first time user here and aspiring grad student. I have a set of location data that I’ve been trying to import into google earth engine from R as a CSV file. The problem is that about half of my data is from utm zone 12, and the other half is from utm zone 11. When I import my original data into google earth engine, the zone 11 data is shifted over to the right because I use utm zone 12 as the crs in R. After some reading into the definition of a utm zone, I tried to just subtract 6 from the zone 11 latitude values after first converting them to a lon/lat format. This appears to have worked as on first glance all of the zone 11 points are where they should be, however it feels like too easy a fix for me after struggling with this for several days. So my question is, is this an acceptable way to convert my data, or am I doing something wrong that could result in inaccurate location data? Thanks! _______________________________________________ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo -- Michael Sumner Software and Database Engineer Australian Antarctic Division Hobart, Australia e-mail: mdsum...@gmail.com [[alternative HTML version deleted]] ------------------------------ Subject: Digest Footer _______________________________________________ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo ------------------------------ End of R-sig-Geo Digest, Vol 240, Issue 1 ***************************************** [[alternative HTML version deleted]] _______________________________________________ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo