sketchucation logo sketchucation
    • Login
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    [Plugin] Coords Text Tag from Datum

    Scheduled Pinned Locked Moved Plugins
    148 Posts 26 Posters 98.6k Views 26 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • TIGT Offline
      TIG Moderator
      last edited by

      It's here http://forums.sketchucation.com/viewtopic.php?p=298614#p298614
      exportvertices2csv.rb .............

      TIG

      1 Reply Last reply Reply Quote 0
      • GeorgeG Offline
        George
        last edited by

        Hello TIG,

        I’m working with Coords Text Tag from Datum v1.6 20101120

        Gaieus suggested the plugin as a means of creating guide points at specified locations in a geo-located model using Latitude and Longitude as input data via ‘Add Coord by Dialog’.

        The plugin works as expected with length units ... inches, feet, meters and so on.
        However, entering LL data via ‘Add Coord by Dialog’ yields odd results.

        These are the settings:

        http://lh6.ggpht.com/_pI3lDYnW_xk/TTnrapV6vDI/AAAAAAAAD6U/nSAVx1Q6Ysg/ScreenShot101.jpg

        This is the location of the model:

        http://lh6.ggpht.com/_pI3lDYnW_xk/TTnrbF4QuOI/AAAAAAAAD6Y/F1R9aRAaUX8/ScreenShot102.jpg

        When I click the Add Coords-Tag tool on the Origin, the coord-tag is correct:

        http://lh6.ggpht.com/_pI3lDYnW_xk/TTnrbbjHM5I/AAAAAAAAD6c/A9fvdljRD-M/ScreenShot103.jpg

        Then I try entering the exact model location in ‘Add Coord by Dialog’:

        http://lh3.ggpht.com/_pI3lDYnW_xk/TTnrcAfxaAI/AAAAAAAAD6g/k3EkdvhYVpg/ScreenShot104.jpg

        The result is consistently a coord-tag with Latitude way off to the south, near the Equator:

        http://lh4.ggpht.com/_pI3lDYnW_xk/TTnrcvIo1fI/AAAAAAAAD6k/-FtWZ6F9AtM/ScreenShot105.jpg

        I tried unloading all plugins and the extensions in the Preferences-Extensions panel so this was the only plugin loaded when SU starts.
        The results were the same.

        I'm at a loss to figure out what's wrong.
        Am I entering the data improperly?

        Thanks,

        -Geo

        "Everyone is entitled to his own opinions, but not to his own facts." ~Patrick Moynihan

        1 Reply Last reply Reply Quote 0
        • TIGT Offline
          TIG Moderator
          last edited by

          I just tried exactly what you did and it worked fine for me ???
          Try with LL+Z ?
          Can you post your exact steps to get to the problem............... 😕

          TIG

          1 Reply Last reply Reply Quote 0
          • GeorgeG Offline
            George
            last edited by

            Hello TIG,

            Here’s what I’m doing, step by step.

            1. Open a new SU8 Pro file.

            2. Click … Window > Model Info > Geolocation > Set Manual Location

            3. 2x click the cursor in the Latitude field and then type 46.0N

            4. 2x click the cursor in the Longitude field and then type 90.0W

            5. 2x click the cursor in the Location field and then type Northern Wisconsin

            6. Click … OK to close the Set Manual Geo-Location dialog box

            The Model Info-Geo-location panel then appears like this:

            http://lh6.ggpht.com/_pI3lDYnW_xk/TTnrbF4QuOI/AAAAAAAAD6Y/F1R9aRAaUX8/ScreenShot102.jpg

            1. Select and delete Susan

            2. Click … Window > Model Info > Statistics > Purge Unused

            3. Click … Window > Components and place the Simple House component at the *origin.
              *Drawing Axes are confirmed to be in default position.

            4. Click … File > Save, type in the name, Test Model 1, and then click Save
              The Save as Type: field is set to save as the current version, SketchUp Models (*.skp)

            5. In the Model Info-Units panel:
              Length Units are set to decimal inches at 0.000” precision
              Enable Length Snapping is OFF.
              Display Units Format is ON.
              Enable Angle Snapping is ON at 15° and Precision at 0.0°

            6. Click … Plugins > Coords-Tag > Settings, then Add
              The Select tool cursor becomes a white arrow.
              Set XY-Units to Latitude_Longitude
              Set Z-Units to <None> (I tried all the other settings for Z as well, without success.)
              Set Units?: to Yes
              All other settings remain untouched.

            The Coords-Tag Settings dialog now looks like this:

            http://lh4.ggpht.com/_pI3lDYnW_xk/TTotXAqJJsI/AAAAAAAAD7A/3T8afz4yhSg/ScreenShot106.jpg

            1. Click … OK to close the Coords-Tag Settings dialog box
              The cursor returns to being the Select tool.

            2. Click … Plugins > Coords-Tag > Add Coords-Tag by Dialog
              Nothing happens.
              The dialog does not appear.
              The Cursor remains the Select tool.

            3. Click … Plugins > Coords-Tag > Add Coords-Tag
              The cursor becomes a white arrow tool.
              It offers no inferencing dots or tool tips while hovering over the origin or endpoints.
              L-Clicking or R-Clicking on geometry or on the ground plane does nothing.

            All the tools work perfectly if I return to the Coords-Tag Settings dialog box and set XY-Units to ANY other unit besides Latitude_Longitude.

            If I create a few tags with the XY-Units set to Feet or Meters and then return to the Coords-Tag Settings dialog and change XY-Units to Latitude_Longitude, the existing tags convert correctly to L. Lo. coordinates, after which, the tool remains active. I’m then able to inference and a L-click places another LL Tag and another and another.

            With the LL tags thus functioning, I then go to Plugins > Coords-Tag > Add Coords-Tag by Dialog and enter the model coordinates, L 46N Lo 90E
            Like so:

            http://lh3.ggpht.com/_pI3lDYnW_xk/TTnrcAfxaAI/AAAAAAAAD6g/k3EkdvhYVpg/ScreenShot104.jpg

            The LL tag appears at L 0.018N Lo 87.000W
            No matter what I try, it returns the same value every time.

            Sorry this is so long.
            Does my opus give you some clue as to what the problem is?

            Thanks,

            -Geo

            "Everyone is entitled to his own opinions, but not to his own facts." ~Patrick Moynihan

            1 Reply Last reply Reply Quote 0
            • TIGT Offline
              TIG Moderator
              last edited by

              Thanks for the detailed response!

              Can you try the last few steps with the Ruby Console open... Any errors ?

              When I repeat the steps I get a good result 😕

              EDIT:
              Having thought about it...
              You must set the X/Y values as your long/lat values in the main dialog OR you can initially use NOT use long/lat but say meters and place one Tag at the origin... THEN change to Long/Lat and it should work... as the one at the origin changes to your Model's long/lat...
              I'll have another think about this 'logic'...

              TIG

              1 Reply Last reply Reply Quote 0
              • GeorgeG Offline
                George
                last edited by

                Hello TIG,

                I opened 'Test Model 1' and did the following:

                Window > Ruby Console
                Plugins > Coords-Tag > Settings, then Add

                The Settings, then Add dialog was as I last left it.
                Like this:

                http://lh4.ggpht.com/_pI3lDYnW_xk/TTotXAqJJsI/AAAAAAAAD7A/3T8afz4yhSg/ScreenShot106.jpg

                When I click OK to close the Settings, then Add dialog:

                This error appears in the Ruby Console

                http://lh4.ggpht.com/_pI3lDYnW_xk/TTsUhreuDSI/AAAAAAAAD7c/_6GQ7-MThSY/ScreenShot107.jpg

                If I then click … Plugins > Coords-Tag > Add Coords-Tag:

                This error appears in the Ruby Console

                http://lh3.ggpht.com/_pI3lDYnW_xk/TTsZjTxmgLI/AAAAAAAAD7k/oRS36W11RYM/ScreenShot108.jpg

                I close the model without saving changes and then reopen the model.

                Window > Ruby Console
                Plugins > Coords-Tag > Add Coords-Tag by Dialog

                This error appears in the Ruby Console

                http://lh5.ggpht.com/_pI3lDYnW_xk/TTsk-kjTmjI/AAAAAAAAD74/FzhQF98vMfs/ScreenShot109.jpg

                I hope this helps.

                -Geo

                Btw, this all started with a discussion in the SketchUp Help forum.
                http://www.google.com/support/forum/p/sketchup/thread?tid=11ef233d3545c5f0&hl=en

                The ability to create Cpoints directly from L. Lo. coordinates is a most welcome asset. 👍

                Thank you, TIG

                "Everyone is entitled to his own opinions, but not to his own facts." ~Patrick Moynihan

                1 Reply Last reply Reply Quote 0
                • TIGT Offline
                  TIG Moderator
                  last edited by

                  By PM I've asked Gaieus to step in and help us - as I wrote the tool principally for him !

                  Either he'll explain how to use it without problems OR at least find out what is wrong so I can fix it............. 😒

                  TIG

                  1 Reply Last reply Reply Quote 0
                  • GeorgeG Offline
                    George
                    last edited by

                    @tig said:

                    EDIT:
                    Having thought about it...
                    You must set the X/Y values as your long/lat values in the main dialog OR you can initially use NOT use long/lat but say meters and place one Tag at the origin... THEN change to Long/Lat and it should work... as the one at the origin changes to your Model's long/lat...
                    I'll have another think about this 'logic'...

                    Yes, I found that works for enabling the LL function of the Add Coords-Tag tool.

                    If I start with XY-Units set to any unit besides Latitude_Longitude, all the tools work fine.

                    As you suggest …
                    I can start by creating one ‘Length-Units’ Tag in the model, say, at the Origin, and then switch the Settings dialog to XY-Units = Latitude_Longitude.

                    Thereupon the existing length-units tag updates to LL and from there on the Add Coords-Tag tool places a correct LL tag wherever one clicks. All is good.

                    The dysfunction occurs when one then goes to the plugin menu and selects; Add Coords-Tag by Dialog.
                    My little Test Model 1 is geo-located at 46°N 90°W
                    I enter those coordinates in the dialog as shown below
                    The LL tag that results is located ~ 46° (some 2700 nautical miles) to the south and 3° east at:
                    0.018412N 87.000000W
                    When I close SU, open and repeat the process, the same errant LL value occurs.

                    http://lh5.ggpht.com/_pI3lDYnW_xk/TTtFITa0YNI/AAAAAAAAD8M/e0RjFM5_f24/ScreenShot110.jpg

                    The Add Coords-Tag by Dialog and Import Coords-Tag from CSV (in LL units) are the elusive gems.

                    -Geo

                    "Everyone is entitled to his own opinions, but not to his own facts." ~Patrick Moynihan

                    1 Reply Last reply Reply Quote 0
                    • GaieusG Offline
                      Gaieus
                      last edited by

                      I think I got it, guys. Please, confirm that in the input dialog, the Lat and Log lines are changed. What you enter as longitude, should be latitude and vice versa. Try to enter into the Longitude line what you'd enter into the Latitude line and vice versa. See also attached screenshot. My SU window is floating above my GE window so bot co-ordinates can be seen.

                      By the way, Geo, if you really want to geolocate your model in SU 8, never use the map but the manual location field. Only then "add imagery". It's a couple of metres off otherwise (I know it would not be needed in the particular case you are after just mentioning).


                      coord-tag.jpg

                      Gai...

                      1 Reply Last reply Reply Quote 0
                      • TIGT Offline
                        TIG Moderator
                        last edited by

                        So.... is it 'broken' ?
                        And if it is what do I [we] need to do to fix it ?? 😕

                        TIG

                        1 Reply Last reply Reply Quote 0
                        • GeorgeG Offline
                          George
                          last edited by

                          Hello TIG & Gaieus,

                          I just got back to see Gaieus’ post.
                          Let me try Gaieus’ solution and post how it works for me.

                          -Geo

                          "Everyone is entitled to his own opinions, but not to his own facts." ~Patrick Moynihan

                          1 Reply Last reply Reply Quote 0
                          • GaieusG Offline
                            Gaieus
                            last edited by

                            @tig said:

                            So.... is it 'broken' ?
                            And if it is what do I [we] need to do to fix it ?? 😕

                            No, it works perfectly. Just swap the Longitude and Latitude texts in the dialog. This way it is misleading because we need to enter the values swapped.

                            This (line 799-803):

                            <span class="syntaxdefault">    if xyunits</span><span class="syntaxkeyword">==</span><span class="syntaxstring">"Latitude_Longitude"<br /></span><span class="syntaxdefault">      p0</span><span class="syntaxkeyword">=</span><span class="syntaxstring">"Longitude; "<br /></span><span class="syntaxdefault">      p1</span><span class="syntaxkeyword">=</span><span class="syntaxstring">"Latitiude; "<br /></span><span class="syntaxdefault">      xyus</span><span class="syntaxkeyword">=</span><span class="syntaxstring">"LL"<br /></span><span class="syntaxdefault">    else<br /> </span>
                            

                            should be

                            <span class="syntaxdefault">    if xyunits</span><span class="syntaxkeyword">==</span><span class="syntaxstring">"Latitude_Longitude"<br /></span><span class="syntaxdefault">      p0</span><span class="syntaxkeyword">=</span><span class="syntaxstring">"Latitude; "<br /></span><span class="syntaxdefault">      p1</span><span class="syntaxkeyword">=</span><span class="syntaxstring">"Longitude; "<br /></span><span class="syntaxdefault">      xyus</span><span class="syntaxkeyword">=</span><span class="syntaxstring">"LL"<br /></span><span class="syntaxdefault">    else<br /> </span>
                            

                            "Latit iude" is misspelt there anyway (good it was not in the code - although then it would have turned out at least - and I could hardly find it as I did not notice the misspell first and was also searching for "Latitude" in NP++) so it could bear an update.
                            😉

                            Gai...

                            1 Reply Last reply Reply Quote 0
                            • GeorgeG Offline
                              George
                              last edited by

                              That solved that problem, Gaieus. 😍

                              Now to try this on the ‘Import Coords-Tags from CSV’ tool.

                              Note the coordinates entered in the dialog are the reverse of those in Model Info-Location
                              Yet, the LL-Tag it creates is correct.

                              http://lh3.ggpht.com/_pI3lDYnW_xk/TTt43VeSnEI/AAAAAAAAD8g/r2plRMUotD4/ScreenShot111.jpg

                              -Geo

                              "Everyone is entitled to his own opinions, but not to his own facts." ~Patrick Moynihan

                              1 Reply Last reply Reply Quote 0
                              • GaieusG Offline
                                Gaieus
                                last edited by

                                Oh, I am really glad. When I was torturing TIG along this whole topic until we got where the plugin is, I mainly concentrated on the other aspects of it (custom, ortho-co-ordinates) as Didier by then had come out with his LatLong tool and in this plugin here it was just an "extra" for me (but of course, important one) so did not notice this little glitch.

                                Anyway, I hope you enjoy it as much as I do (and of course, many thanks to TIG again)
                                👍


                                I think in that Help Forum topic I overcomplicated the thing with the PhotoMatch thing as the guy does not seem to need it as accurately.

                                Gai...

                                1 Reply Last reply Reply Quote 0
                                • GaieusG Offline
                                  Gaieus
                                  last edited by

                                  OK, so I went along and did the changes in the code I wrote above and success; it works perfectly!

                                  Gai...

                                  1 Reply Last reply Reply Quote 0
                                  • TIGT Offline
                                    TIG Moderator
                                    last edited by

                                    Here's an update http://forums.sketchucation.com/viewtopic.php?p=284829#p284829
                                    It should now work ! as Gaieus explained the prompts were wrong 😒 .
                                    At least I've got him to delve into the bowels of a script AND fix it himself!!
                                    We'll make a scripter of you yet Csaba!!!

                                    I fixed the typo in the 'Add' dialog prompts' text.
                                    I've also add +/- clues in them to avoid users West of Greenwich getting confused by Longitude!
                                    Also now the 'Add' dialog's values of the Lat/Long start off with the model's origin Lat/Long and thereafter use the last used values...

                                    TIG

                                    1 Reply Last reply Reply Quote 0
                                    • TIGT Offline
                                      TIG Moderator
                                      last edited by

                                      @george said:

                                      @gaieus said:

                                      OK, so I went along and did the changes in the code I wrote above and success; it works perfectly!

                                      OK. I’ll change the code and report back.

                                      Perhaps that is also what is causing the problem with ‘Import Coords-Tags from CSV’. ❓
                                      The script will export LL-tags to CSV file perfectly.
                                      Nothing happens when I try to import a CSV file in LL units.

                                      I’ve tried importing CSVs I created and I’ve tried importing one of the CSVs the script exported.
                                      Neither CSV will work. I also tried reversing Latitude and Longitude in the CSV file. Niente. 😞

                                      ‘Import Coords-Tags from CSV’ does work if I specify length units and not LL

                                      -Geo

                                      Geo - no need to change the code - get v1.7, it's fixed!!!

                                      'Import Coords-Tags from CSV'
                                      This imports all of the 'Coords-Tags' into the Model from a CSV file in
                                      to format X,Y,Z or LAT,LONG,Z - the values must be comma separated and
                                      consist of numerals only with '.' as the decimal separator, one point
                                      per line.
                                      A dialog then requests the 'units' used in the CSV file for XY and Z,
                                      and if you want to add Cpoints [defaults are 'm' and 'Yes'].
                                      If the CSV file has a 'header' line etc it is ignored.
                                      Is this what you are doing ?

                                      TIG

                                      1 Reply Last reply Reply Quote 0
                                      • GeorgeG Offline
                                        George
                                        last edited by

                                        @gaieus said:

                                        OK, so I went along and did the changes in the code I wrote above and success; it works perfectly!

                                        OK. I’ll change the code and report back.

                                        Perhaps that is also what is causing the problem with ‘Import Coords-Tags from CSV’. ❓
                                        The script will export LL-tags to CSV file perfectly.
                                        Nothing happens when I try to import a CSV file in LL units.

                                        I’ve tried importing CSVs I created and I’ve tried importing one of the CSVs the script exported.
                                        Neither CSV will work. I also tried reversing Latitude and Longitude in the CSV file. Niente. 😞

                                        ‘Import Coords-Tags from CSV’ does work if I specify length units and not LL

                                        -Geo

                                        UPDATE

                                        @unknownuser said:

                                        I’ll change the code and report back.

                                        I'll load the new version and report back. 😉

                                        "Everyone is entitled to his own opinions, but not to his own facts." ~Patrick Moynihan

                                        1 Reply Last reply Reply Quote 0
                                        • GaieusG Offline
                                          Gaieus
                                          last edited by

                                          Well, I am really glad we could iron this out. I am still thinking on some possible, extra features but enough for today (and this week-end).

                                          TIG: if the error had been in the codeitself, I would've never been able to find it so let's just forget that scripter apprenticeship! This was just a lucky trial and error (and I got suspicious because one regularly needs to add the Lat datum first and the Lon datum second although this is merely a convention of course)
                                          😄

                                          Gai...

                                          1 Reply Last reply Reply Quote 0
                                          • GeorgeG Offline
                                            George
                                            last edited by

                                            @tig said:

                                            Geo - no need to change the code - get v1.7, it's fixed!!!

                                            Got it. 👍

                                            Success!!!
                                            The 'Add Coords-Tag by Dialog' tool now places LL-Tags perfectly.

                                            @tig said:

                                            'Import Coords-Tags from CSV'
                                            This imports all of the 'Coords-Tags' into the Model from a CSV file in
                                            to format X,Y,Z or LAT,LONG,Z - the values must be comma separated and
                                            consist of numerals only with '.' as the decimal separator, one point
                                            per line.
                                            A dialog then requests the 'units' used in the CSV file for XY and Z,
                                            and if you want to add Cpoints [defaults are 'm' and 'Yes'].
                                            If the CSV file has a 'header' line etc it is ignored.
                                            Is this what you are doing ?

                                            Yes.
                                            Still, no success with v1.7 when I try importing a CSV in LL/Z units.

                                            And …

                                            Only partial success importing a CSV in XYZ length units.
                                            I’m testing 'Import Coords-Tags from CSV' in XYZ length units with a simple CSV file.
                                            I shared the CSV file at Google Docs:

                                            https://spreadsheets.google.com/ccc?key=0AqR273kvdPGOdGhhWnJ6cTAyUDNZRExWYnc1YXk2emc&hl=en&authkey=CMLQqZYD

                                            In the image below: Only 7 tags were created from the CSV file containing 49 points.
                                            The 8th cords-tag you see in the image (at the origin) was placed prior to CSV import.

                                            http://lh5.ggpht.com/_pI3lDYnW_xk/TTxYx-GVdPI/AAAAAAAAD80/65FlXWz5zBk/ScreenShot112.jpg

                                            I’m fairly certain there is no problem is with the CSV file as I can import the file with the version of ‘Import Points Cloud’ script I’m running and all 49 points appear as in the image below.

                                            The points in the CSV file describe the vertices of a cylinder with 24 segments (48 points)
                                            The 49th point in the CSV file is at the origin [0,0,0]

                                            http://lh3.ggpht.com/_pI3lDYnW_xk/TTxYyKHaoWI/AAAAAAAAD84/pZjMRqUHWkQ/ScreenShot113.jpg

                                            I’ve been methodically trying different combinations of settings in the script settings dialog, to no avail.

                                            Perhaps if we (or is it just me who's fouled up) manage 'Import Coords-Tags from CSV' in simple XYZ length units to work, then we’ll (I'll) be able to figure out the process using XY=LL/Z=Feet. 😕

                                            Many thanks for your efforts, TIG.

                                            -Geo

                                            "Everyone is entitled to his own opinions, but not to his own facts." ~Patrick Moynihan

                                            1 Reply Last reply Reply Quote 0
                                            • 1
                                            • 2
                                            • 3
                                            • 4
                                            • 5
                                            • 6
                                            • 7
                                            • 8
                                            • 3 / 8
                                            • First post
                                              Last post
                                            Buy SketchPlus
                                            Buy SUbD
                                            Buy WrapR
                                            Buy eBook
                                            Buy Modelur
                                            Buy Vertex Tools
                                            Buy SketchCuisine
                                            Buy FormFonts

                                            Advertisement