Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

[Released] GIS Terrain Loader

Discussion in 'Assets and Asset Store' started by UnityGISTech, Aug 12, 2019.

  1. UnityGISTech

    UnityGISTech

    Joined:
    May 6, 2015
    Posts:
    193
    Could you contact me via the discord channel.
     
  2. UnityGISTech

    UnityGISTech

    Joined:
    May 6, 2015
    Posts:
    193
    Hi there,
    Could you show me the terrain Metadata panel please.
     
  3. adsilcott

    adsilcott

    Joined:
    Aug 30, 2014
    Posts:
    55
    Disregard the part about the terrain ContainerSize. It does have a size, in this case (72345, 1957.34, 74900).

    But the problem remains, when I use:

    var position = GeoRefConversion.SetRealWorldPosition(TerrainContainer, latLon, 0, SetElevationMode.OnTheGround);

    With latLon = (35.78703,-105.54655), then I get back position = (0,0).
     

    Attached Files:

  4. adsilcott

    adsilcott

    Joined:
    Aug 30, 2014
    Posts:
    55
    I think I figured out the problem. In the documentation the variable is called LatLon, suggesting the it should be (Latitude, Longitude). But I think those are reversed. I tried with (Longitude, Latitude) and that worked.

    However it only works with SetElevationMode.RelativeToTheGround. if I try SetElevationMode.OnTheGround, then I get this error:

    IndexOutOfRangeException: Index was outside the bounds of the array.
    GISTech.GISTerrainLoader.GISTerrainLoaderFileData.GetElevation (GISTech.GISTerrainLoader.DVector2 LatLon) (at Assets/GIS Tech/GIS Terrain Loader/Scripts/GISTerrainLoaderRuntime/GISTerrainLoaderElevationLoader/GISTerrainLoaderFileData.cs:152)
    GISTech.GISTerrainLoader.GeoRefConversion.SetRealWorldPosition (GISTech.GISTerrainLoader.TerrainContainerObject container, GISTech.GISTerrainLoader.DVector2 LatLonPos, System.Single RWElevationValue, GISTech.GISTerrainLoader.SetElevationMode elevationMode, System.Single Scale) (at Assets/GIS Tech/GIS Terrain Loader/Scripts/GISTerrainLoaderRuntime/GISTerrainLoaderRuntime/GISTerrainLoaderGeoRef/GeoRefConversion.cs:209)
    _Project.Scripts.PrefabSpawner.Spawn () (at Assets/_Project/Scripts/PrefabSpawner.cs:29)
     
  5. romaxl30

    romaxl30

    Joined:
    Aug 16, 2020
    Posts:
    5
    Hi!
    Please tell me - how much I understand in view of this asset it can download real world locality in unity based on terrain files (including TIFF) and this terrain according to its coordinates (latitude and longitude) in the unity fully corresponds to the coordinates of the real world?
    Question - can the coordinate, which are presented in the form of latitude and longitude, can be converted into SK-42 (Gauss-Kruger) that would also correspond to the real one?
    And yes, I immediately ask for forgiveness if something wrote not very true or professionally)
     
  6. UnityGISTech

    UnityGISTech

    Joined:
    May 6, 2015
    Posts:
    193
    Hi there,
    You're alright, you can download a DEM as Tiff file via GIS Data Downloader asset and load that file as terrain in unity via GTL asset.
    The generated terrain is georeferenced in the real world coordinates.
    All DEM's created by GDD are projected in WGS 85 EPSG 4326, but you can convert all that coordinated to another epsg via dotspatial lib which is included in the asset.

    Best regards
     
    romaxl30 likes this.
  7. UnityGISTech

    UnityGISTech

    Joined:
    May 6, 2015
    Posts:
    193
    Hi there,
    you Dvector2 must include lat and lon value where x=lon and y=lat.
    About that error, did you generate that terrain in edit mode or at runtime?
     
  8. adsilcott

    adsilcott

    Joined:
    Aug 30, 2014
    Posts:
    55
    In edit mode.
     
  9. UnityGISTech

    UnityGISTech

    Joined:
    May 6, 2015
    Posts:
    193
    Please check the Get_Set_Position_EditMode Demo scene.
    this issue come when the terrain was generated in edit mode and GTL can not find the right serialized heightmap.
    EX: When you generate your terrain a new file will be created in GIS Tech\GIS Terrain Loader\Resources folder.
    so in Start void you shoud to call tha function:
    container.GetStoredHeightmap("File_Data_Example");
    where the "File_Data_Example" is the name of serialized heightmap accorded to that terrain.
    You can also contact me via the discord channel.
    Best Regards
     
  10. adsilcott

    adsilcott

    Joined:
    Aug 30, 2014
    Posts:
    55
    One thing I keep encountering is needing to get the real world position of points that fall outside of the area of the terrain container. Since the geo-referencing conversion was one of the main selling points for the asset for me, is there a chance of getting this changed to return accurate points outside of the bounds?
     
  11. UnityGISTech

    UnityGISTech

    Joined:
    May 6, 2015
    Posts:
    193
    Hi there,
    Sorry, you can not get a position of a point out side of your terrain because geo-referencing is working according to your terrain bounds.
    there is a simple solution, you can create two terrain the first is very large for example (100x100km) with some invisible material. the second is your main terrain which is inside of your first terrain.
    now, if your object is outside of your main terrain use the large terrain container else use your main terrain container.

    Good Luck
     
  12. UnityGISTech

    UnityGISTech

    Joined:
    May 6, 2015
    Posts:
    193
    Hi there,
    Why are using usb region?
    Best regards
     
  13. enut4LJR

    enut4LJR

    Joined:
    Mar 10, 2023
    Posts:
    1
    thanks for replying
    fortunately, solved the problem
     
  14. UnityGISTech

    UnityGISTech

    Joined:
    May 6, 2015
    Posts:
    193
    Contact me through discord or email if you still have any issue.
     
  15. rezuma

    rezuma

    Joined:
    Jun 23, 2015
    Posts:
    6
    If I do this, then how do I align both of the terrains?
     
  16. rezuma

    rezuma

    Joined:
    Jun 23, 2015
    Posts:
    6
    This isn't working any more. It seems random when it works and when it doesn't now, but it's just not working for the current settings that I want. I can't use ASCI because the terrain that gets generated is way too big. And raw doesn't have any of the location data. I've tried downloading the DEMs from each source. I went back to previous ones that worked, and then tried again. I even tried bringing it into QGis to see if I could fix something in the file.

    This solution seemed kind of hacky before anyway, is there some way to actually fix this bug?
     
  17. UnityGISTech

    UnityGISTech

    Joined:
    May 6, 2015
    Posts:
    193
    Check Your inbox
     
  18. ChiragSindhu2002

    ChiragSindhu2002

    Joined:
    Jan 3, 2019
    Posts:
    2
    Hi there,

    Hope you are well, I am Chirag sindhu. I am developing a prototype for my personal game where I can generate terrain using a .tif file. And I recently came across your plugin.But I am not sure about it. I don't think it will work good for my project because I also want to add my own building and roads upon it like a popular city monument after generating the terrain. In future there will be more work on generating sequences of terrain like If we walk across the generated terrain the second terrain will generate accordly. So, Major Ideas I have in mind, But I am not sure if this plugin will be suitable for my project and my needs. So can you help me to use your asset for testing purposes for around a week. If it works for my needs, I will purchase this asset and may also work with your team for some issue.

    Thank you!
    Chirag Sindhu
    Indie game developer
     
  19. UnityGISTech

    UnityGISTech

    Joined:
    May 6, 2015
    Posts:
    193
    I replayed to your email