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

    Get latLong of origin?

    Scheduled Pinned Locked Moved Developers' Forum
    7 Posts 4 Posters 939 Views 4 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.
    • TomPendergrassT Offline
      TomPendergrass
      last edited by

      Greetings, users!

      I'm trying to find the point where a photo was taken in relation to a sketchup scene. The scene has been geolocated and has buildings constructed in their proper locations. I have the EXIF data of the photo: lat long, altitude, etc. Is there a way to plug this information into a ruby script and find the point?

      My approach was to get the lat long of the scene's origin and finding the point by calculating distance and direction between the two locations.

      Thank you ahead of time for any insight into my predicament!

      1 Reply Last reply Reply Quote 0
      • S Offline
        slbaumgartner
        last edited by

        @tompendergrass said:

        Greetings, users!

        I'm trying to find the point where a photo was taken in relation to a sketchup scene. The scene has been geolocated and has buildings constructed in their proper locations. I have the EXIF data of the photo: lat long, altitude, etc. Is there a way to plug this information into a ruby script and find the point?

        My approach was to get the lat long of the scene's origin and finding the point by calculating distance and direction between the two locations.

        Thank you ahead of time for any insight into my predicament!

        This snippet example from the API documentation creates a construction point at the specified lat, lon:

        
         # Draw a point in Boulder, Colorado (40.0170N, 105.2830W)
         lnglat_array = [-105.28300, 40.01700]
         model = Sketchup.active_model
         point = model.latlong_to_point lnglat_array
         model.entities.add_cpoint(point)
        
        

        presumably you could set the z (blue) component of the point to your altitude.

        Steve

        1 Reply Last reply Reply Quote 0
        • Dan RathbunD Offline
          Dan Rathbun
          last edited by

          IF there is no bugs re: this in your SU version.

          Verify he page shado_info is ON:
          page.use_shadow_info= true

          Then get the lon & lat:
          lon = page.shadow_info["Longitude"] lat = page.shadow_info["Latitude"]

          You can create an API Geom::LatLong object:
          llo = Geom::LatLong::new( [lat,lon ] )

          There is also a Geom::UTM class in the API.

          πŸ’­

          I'm not here much anymore.

          1 Reply Last reply Reply Quote 0
          • Dan RathbunD Offline
            Dan Rathbun
            last edited by

            Also some SketchUp functionality (Google Earth, etc.) creates AttributeDictionary objects that have Lat and Long attributes.

            I think I published an example code snippet here.
            Check the Code Snippets Index (It's a sticky post at the top of this forum.)

            Edit: It is [ Code ] GE "GeoLocation" AttributeDictionary v1.1.0

            πŸ’­

            I'm not here much anymore.

            1 Reply Last reply Reply Quote 0
            • tt_suT Offline
              tt_su
              last edited by

              Yes, model.latlong_to_point should work. Though, for the altitude, I'm not sure if SketchUp takes that into account when it geo-locates models. I'd have to dig around to see if you can get the altitude of the geolocated model - so you can get the height right.

              1 Reply Last reply Reply Quote 0
              • Dan RathbunD Offline
                Dan Rathbun
                last edited by

                The "onOceanFloor" attribute of the "GeoLocation" dictionary is supposed to set the base (zero line,) for the altitude (IF exporting for Google Earth.)

                The Ocean Modeling extension by "The SketchUp Team" adds a menu item to toggle add or delete the attribute. (If you are not modeling ocean floor shipwrecks, then you do not need the extension.)

                I'm not here much anymore.

                1 Reply Last reply Reply Quote 0
                • TomPendergrassT Offline
                  TomPendergrass
                  last edited by

                  Thank you for your help! Turns out the camera that the photos were taken off of had some weird GPS offset, which is why my photos were imported yet placed kilometers away. I solved my problem by using a 'reference point'. I have the user import one photo and place that photo where they believe it was taken. I use that photo's lat and long to modify the rest of the photos that were imported. Success πŸ˜„

                  1 Reply Last reply Reply Quote 0
                  • 1 / 1
                  • First post
                    Last post
                  Buy SketchPlus
                  Buy SUbD
                  Buy WrapR
                  Buy eBook
                  Buy Modelur
                  Buy Vertex Tools
                  Buy SketchCuisine
                  Buy FormFonts

                  Advertisement