Hello,
We're using JavaScript, not Unity, but this is very interesting, I wish it was 
a JS package.
We're kind of using Geojson as our internal coordinate system at the moment, 
but with a few oddities, like allowing 0.0 as the origin, rather than using 
Long lat.
I just built a parser, so we're good.
Thanks,


Brandon Biggs<https://www.ski.org/users/brandon-biggs>
Engineer

Smith-Kettlewell Eye Research Institute
Office: 415-345-2130
Cell: 650-833-9394

________________________________
From: Paul Harwood <rune...@gmail.com>
Sent: Wednesday, December 2, 2020 12:20 PM
To: Brandon Biggs <brandon.bi...@ski.org>
Cc: Andrew C Aitchison <and...@aitchison.me.uk>; gdal-dev@lists.osgeo.org 
<gdal-dev@lists.osgeo.org>
Subject: Re: [gdal-dev] Converting OBJ to Geojson files with ogr2ogr

GeoJSON is very good for many things but I would not convert an .OBJ to GeoJSON 
and then into the VR space local coordinate system. You are going to have 
project the OBJ into 4326 and then project it again into the local coordinate 
system - even if implicitly. Go directly from OBJ to an internal mesh.

If you are building the VR in Unity - you can use this to do it :

https://openupm.com/packages/com.virgis.geometry3sharp/

You really should take a look at what we are doing at 
www.virgis.org<http://www.virgis.org> - we have worked a lot of this out. It is 
in Unity but even if you are not using Unity there could be good learnings.





On Wed, 2 Dec 2020 at 16:02, Brandon Biggs 
<brandon.bi...@ski.org<mailto:brandon.bi...@ski.org>> wrote:
Hello,
It's for a custom coordinate system for VR. Geojson provides a very easy syntax 
for properties and geometries that I like to use with origin at 0,0 bottom left.
I'll probably write my own converter, as OBJ is kind of an important file type 
we need to support.
Thanks,


Brandon Biggs<https://www.ski.org/users/brandon-biggs>
Engineer

Smith-Kettlewell Eye Research Institute
Office: 415-345-2130
Cell: 650-833-9394

________________________________
From: Paul Harwood <rune...@gmail.com<mailto:rune...@gmail.com>>
Sent: Wednesday, December 2, 2020 2:31 AM
To: Andrew C Aitchison <and...@aitchison.me.uk<mailto:and...@aitchison.me.uk>>
Cc: Brandon Biggs <brandon.bi...@ski.org<mailto:brandon.bi...@ski.org>>; 
gdal-dev@lists.osgeo.org<mailto:gdal-dev@lists.osgeo.org> 
<gdal-dev@lists.osgeo.org<mailto:gdal-dev@lists.osgeo.org>>
Subject: Re: [gdal-dev] Converting OBJ to Geojson files with ogr2ogr

.OBJ is a simple object mesh  (or to put it in more traditional terms: TIN) - 
it has shape but no data values and is not geolocated.

I don't think there is any driver for OGR that will read .OBJ.

You are going to problems with geolocation if you write your own. Geojson 
requires that the geometries are geolocated - and in the current version that 
they are in epsg:4326. That is not totally impossible - people have been using 
.dxf files for gis data for decades and that format is also not in theory 
geolocated. It is not a trivial problem though.

I guess I would ask the usual question .. why?

- what are you actually trying to achieve and why a GIS format like GeoJSON?

- If you have to use GeoJSON - I am guessing you are transferring some data to 
something that reads GeoJSON only? In that case - can your source produce .dxf? 
OGR can read .dxf.

- If you only have the source in .OBJ - what other formats can the destination 
read? Although, if you only have the source in .obj, I very much doubt any of 
the GIS tools like GDAL are going to be able to help you. It just is not a 
format used in GIS.

It is a problem we solved in the ViRGiS projec<http://www.virgis.org>t - since 
.obj is used a lot in VR. There we used an existing library to read the .obj 
files - but that is in C# and I doubt that would help you.

On Tue, 1 Dec 2020 at 20:15, Andrew C Aitchison 
<and...@aitchison.me.uk<mailto:and...@aitchison.me.uk>> wrote:
On Tue, 1 Dec 2020, Brandon Biggs wrote:

> Hello,
> I am wondering how to convert an obj file to a geojson file? I am using 
> ogr2ogr with the command:
> Ogr2ogr -f geojson output.geojson input.obj
> But get the error that ogr2ogr does not have an OBJ driver. I looked on:
> the vector drivers page<https://gdal.org/drivers/vector/index.html>
> but am unable to find a simple obj converter. I am wondering if there is such 
> a thing? I am probably going to write my own that does what I want, because 
> OBJ is so simple, I was just wondering if GDAL could already do it.

I've never heard of OBJ, but that doesn't mean much.

If you only want a read-only ogr driver you might want to look at
        https://gdal.org/tutorials/vector_python_driver.html
if you would find a quick-n-dirty python quicker to write than C++.

--
Andrew C. Aitchison                                     Kendal, UK
                        and...@aitchison.me.uk<mailto:and...@aitchison.me.uk>
_______________________________________________
gdal-dev mailing list
gdal-dev@lists.osgeo.org<mailto:gdal-dev@lists.osgeo.org>
https://lists.osgeo.org/mailman/listinfo/gdal-dev
_______________________________________________
gdal-dev mailing list
gdal-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/gdal-dev

Reply via email to