<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic How can I get the  Latitude and longitude coordinates coordinate of element? in Archicad C++ API</title>
    <link>https://community.graphisoft.com/t5/Archicad-C-API/How-can-I-get-the-Latitude-and-longitude-coordinates-coordinate/m-p/264151#M3145</link>
    <description>&lt;DIV class="actalk-migrated-content"&gt;Hi,&lt;BR /&gt;I set the Latitude and longitude coordinates in the project location. &lt;BR /&gt;But when I get the coordinates of the element, the value is the offset by the origin and the unit is meter. How can I get the Latitude and longitude coordinates coordinate of element?&lt;BR /&gt;&lt;BR /&gt;thanks.&lt;/DIV&gt;</description>
    <pubDate>Thu, 29 Sep 2022 08:08:02 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2022-09-29T08:08:02Z</dc:date>
    <item>
      <title>How can I get the  Latitude and longitude coordinates coordinate of element?</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/How-can-I-get-the-Latitude-and-longitude-coordinates-coordinate/m-p/264151#M3145</link>
      <description>&lt;DIV class="actalk-migrated-content"&gt;Hi,&lt;BR /&gt;I set the Latitude and longitude coordinates in the project location. &lt;BR /&gt;But when I get the coordinates of the element, the value is the offset by the origin and the unit is meter. How can I get the Latitude and longitude coordinates coordinate of element?&lt;BR /&gt;&lt;BR /&gt;thanks.&lt;/DIV&gt;</description>
      <pubDate>Thu, 29 Sep 2022 08:08:02 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/How-can-I-get-the-Latitude-and-longitude-coordinates-coordinate/m-p/264151#M3145</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-09-29T08:08:02Z</dc:date>
    </item>
    <item>
      <title>Re: How can I get the  Latitude and longitude coordinates coordinate of element?</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/How-can-I-get-the-Latitude-and-longitude-coordinates-coordinate/m-p/264152#M3146</link>
      <description>Because ArchiCAD stores coordinates information in meters and related to origin. Latitude and Longitude - is additional assigning to project origin of two numbers.&lt;BR /&gt;
There is always limitation of floating point number precision - especially when the number becoming too big (that would happen, if we store information of every element in global world coordinate system). It's know problem in ArchiCAD - called "far from origin". There is recommendation not to place ArchiCAD model far from origin, following national CAD rules, because then a lot of bugs might appear and model can be generated wrong - windows can jump out, panels disappear in curtain wall etc.&lt;BR /&gt;
&lt;BR /&gt;
In your case you need to set additional function, that would recalculate local coordinates into world and convert it into degrees, minutes and seconds.</description>
      <pubDate>Mon, 24 May 2021 11:49:59 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/How-can-I-get-the-Latitude-and-longitude-coordinates-coordinate/m-p/264152#M3146</guid>
      <dc:creator>Podolsky</dc:creator>
      <dc:date>2021-05-24T11:49:59Z</dc:date>
    </item>
    <item>
      <title>Re: How can I get the  Latitude and longitude coordinates coordinate of element?</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/How-can-I-get-the-Latitude-and-longitude-coordinates-coordinate/m-p/264153#M3147</link>
      <description>&lt;BLOCKQUOTE&gt;DevJeer wrote:&lt;BR /&gt;
How can I get the  Latitude and longitude coordinates coordinate of element?
&lt;/BLOCKQUOTE&gt;

I happen to know about this a little bit.&lt;BR /&gt;
&lt;BR /&gt;
Lat/Lon coordinates locate you anywhere on the globe, but because it's MUCH more convenient to think of buildings being built on a flat surface than on a sphere, there exists a multitude of coordinate system transformations that go from a spherical coordinates (lat-lon-hgt) to planar cartesian coordinates (x-y-hgt)&lt;BR /&gt;
&lt;BR /&gt;
Unfortunately, converting from one to the other isn't trivial at all (or at least, it's not a simple C++ function). In fact, because earth isn't a perfect sphere, and because different countries want to define their own standards, there exists a multitude (hundreds) of different coordinate systems to choose from, but essentially, they all take a lat-lon min-max range, and project it on a cartesian grid with min-max range. Look here to understand how a bounded lat-lon area gets converted to a bounded rectilinear area: &lt;BR /&gt;
&lt;A href="https://www.spatialreference.org/ref/epsg/2018/" target="_blank"&gt;https://www.spatialreference.org/ref/epsg/2018/&lt;/A&gt;&lt;BR /&gt;
&lt;BR /&gt;
And FYI, here's a list of all of the coordinate systems supported around the world: &lt;A href="https://www.spatialreference.org/ref/epsg/" target="_blank"&gt;https://www.spatialreference.org/ref/epsg/&lt;/A&gt;&lt;BR /&gt;
&lt;BR /&gt;
So, where does this leave you?&lt;BR /&gt;
&lt;BR /&gt;
Well, first of all, it's not enough to know the lat-lon-height origin of your project. You also need to know which coordinate system you should be using. Do a bit of research to find out which one is most often used in your country/area. You can't just pick any one -- for example it makes no sense to pick an area covering japan if you live in germany.&lt;BR /&gt;
&lt;BR /&gt;
Anyway, to obtain the lat-lon of your coordinates, do the following: &lt;BR /&gt;
&lt;BR /&gt;
1) Select a EPSG coordinate system that is valid for your area.&lt;BR /&gt;
2) Transform your project origin (in lat-lon-height) to the XYH planar coordinate.&lt;BR /&gt;
3) Add the xy coordinate of your point to your project origin in XYZ planar coordinates. (eg: element.line.begC.x + originX;  element.line.begC.y + originY;&lt;BR /&gt;
4) Make sure you store the result of the addition in doubles (not floats) because the project origin can have huge values when represented as XY.&lt;BR /&gt;
5) Transform the added result back to lat-lon using the inverse of the transformation you used at step 2.&lt;BR /&gt;
&lt;BR /&gt;
Of course there are SDKs to help you do this. GDAL is a popular choice for C++ developers. You can look a the tutorials here:&lt;BR /&gt;
&lt;BR /&gt;
&lt;A href="https://gdal.org/tutorials/osr_api_tut.html" target="_blank"&gt;https://gdal.org/tutorials/osr_api_tut.html&lt;/A&gt;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
If you are looking for a quick hack, there is another alternative. But it's really a crappy approximations that doesn't work in the general case. But it might be good enough for you if your area is around 50m x 50m. &lt;BR /&gt;
&lt;BR /&gt;
1) Go here: &lt;A href="https://epsg.io/transform" target="_blank"&gt;https://epsg.io/transform&lt;/A&gt;&lt;BR /&gt;
2) Select your target coordinate system (do some research vs where you live)&lt;BR /&gt;
3) Type in your project origin in lat-lon&lt;BR /&gt;
4) Click Convert.  You now have the XY coordinate of your lat-lon origin.&lt;BR /&gt;
5) Add 1.0 to the X and Y values.&lt;BR /&gt;
6) Convert back to lat-lon.&lt;BR /&gt;
7) Subtract the new lat-lon from the original lat-lon.&lt;BR /&gt;
&lt;IMG src="https://community.graphisoft.com/legacyfs/online/emojis/icon_cool.gif" style="display : inline;" /&gt; You now have a correspondence of (1m, 1m) = (deltaLon, deltaLat)&lt;BR /&gt;
&lt;BR /&gt;
Now, because you have deltaLon/deltaLat increments for 1 meter in each direction, you can easily approximate the lat-lons of any point in your building.&lt;BR /&gt;
&lt;BR /&gt;
But, I repeat, these ratios are only valid for very small surfaces, and for points close to the projected origin. You can't apply the same deltaLat/Lon ratios for anything that's too far -- even something just 1 km away will be wrong. Things become imprecise very quickly.</description>
      <pubDate>Thu, 08 Jul 2021 06:56:49 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/How-can-I-get-the-Latitude-and-longitude-coordinates-coordinate/m-p/264153#M3147</guid>
      <dc:creator>drjustice</dc:creator>
      <dc:date>2021-07-08T06:56:49Z</dc:date>
    </item>
  </channel>
</rss>

