[GRASS-user] Reproject a large number of maps + converting to GeoJSON files

Hello everybody,

Which is the prefered method of reprojecting a large number of maps and converting them to e.g. GeoJSON files?

I think that there are two options:

  1. (According to the wiki), you should create a new location with the export projection you want to export, import the maps using {v,r}.proj and then export the maps (e.g. using v.out.ogr/r.out.gdal.

  2. Export the maps directly using v.out.ogr/r.out.gdal and then reproject them using GDAL/OGR.

So,

  1. So are there any significant differences between the two methods? AFAIK the underlying algorithms should be the same.

The first method seems to have higher disk space requirements, while the second one seems to be easier to implement.

  1. How can I handle vertex densification in the second approach?

  2. Are there any other caveats that I need to be aware of?

best regards,
Panos

Panagiotis Mavrogiorgos a écrit:

Which is the prefered method of reprojecting a large number of maps and
converting them to e.g. GeoJSON files?

If only a (re-)projection/conversion task, you may rely on gdal/ogr utilities.

I think that there are two options:

1. (According to the wiki
<https://grasswiki.osgeo.org/wiki/Map_Reprojection&gt;\), you should create a
new location with the export projection you want to export, import the maps
using {v,r}.proj and then export the maps (e.g. using v.out.ogr/r.out.gdal.

Perhaps it is possible to skip the import part. Using, instead, [rv].external ...?

2. Export the maps directly using v.out.ogr/r.out.gdal and then reproject
them using GDAL/OGR.

So,

1. So are there any significant differences between the two methods? AFAIK
the underlying algorithms should be the same.

The first method seems to have higher disk space requirements, while the
second one seems to be easier to implement.

2. How can I handle vertex densification in the second approach?

Reminds of a v.clean related processing. You mean "simplification"?

Not sure if there is an related OGR tool too.

Nikos

3. Are there any other caveats that I need to be aware of?

On Fri, Jan 29, 2016 at 12:29 PM, Nikos Alexandris <nik@nikosalexandris.net>
wrote:

> 2. How can I handle vertex densification in the second approach?

Reminds of a v.clean related processing. You mean "simplification"?

Not sure if there is an related OGR tool too.

No, I am referring to this:
https://grasswiki.osgeo.org/wiki/Map_Reprojection#Vector_data:_have_enough_vertices_in_your_vector_data

Panagiotis Mavrogiorgos a écrit :

> > 2. How can I handle vertex densification in the second approach?

Nikos Alexandris wrote:

> Reminds of a v.clean related processing. You mean "simplification"?
> Not sure if there is an related OGR tool too.

No, I am referring to this:
https://grasswiki.osgeo.org/wiki/Map_Reprojection#Vector_data:_have_enough_vertices_in_your_vector_data

Reportedly, v.proj does this now (==grass 7) automatically. Then, use it (?).

Nikos

On Fri, Jan 29, 2016 at 2:15 PM, Nikos Alexandris <nik@nikosalexandris.net>
wrote:

Panagiotis Mavrogiorgos a écrit :

> > > 2. How can I handle vertex densification in the second approach?

Nikos Alexandris wrote:

> > Reminds of a v.clean related processing. You mean "simplification"?
> > Not sure if there is an related OGR tool too.

> No, I am referring to this:
>
https://grasswiki.osgeo.org/wiki/Map_Reprojection#Vector_data:_have_enough_vertices_in_your_vector_data

Reportedly, v.proj does this now (==grass 7) automatically. Then, use it
(?).

Well obviously that's one way to go, but the original question was how to

handle vertex densification when directly using GDAL/OGR.

Panagiotis Mavrogiorgos a écrit :

> > > > 2. How can I handle vertex densification in the second approach?

Nikos Alexandris wrote:

> > > Reminds of a v.clean related processing. You mean "simplification"?
> > > Not sure if there is an related OGR tool too.

> > No, I am referring to this:
> > https://grasswiki.osgeo.org/wiki/Map_Reprojection#Vector_data:_have_enough_vertices_in_your_vector_data

> Reportedly, v.proj does this now (==grass 7) automatically. Then, use it
> (?).

Well obviously that's one way to go, but the original question was how to
handle vertex densification when directly using GDAL/OGR.

Right! I just scanned the web for relevant stuff, see below:

Here something interesting (?):

* https://grasswiki.osgeo.org/wiki/Vector_add_multiple_vertices

Perhaps there is a quick way to access the "right" tool in/via
GDAL/OGR's (Python) API, and script it?

I found a couple of interesting threads...

* http://osgeo-org.1560.x6.nabble.com/GDAL-C-Api-create-new-line-segments-from-point-layer-td5195061.html
* http://gis.stackexchange.com/q/8144/5256
* http://gis.stackexchange.com/a/29579/5256 (PostGIS related)
* http://geoinformaticstutorial.blogspot.ch/2012/10/accessing-vertices-from-polygon-with.html
* https://pcjericks.github.io/py-gdalogr-cookbook/

Maybe Markus Metz could enlighten!

Cheers, Nikos