Re: [gdal-dev] Vector Tile Service

2020-05-12 Thread Ari Jolma

rmaddu,

VRT is raster format and MVT is vector format, so they are incompatible 
without raster to vector transformation. So, I think there's something 
missing from your problem statement.


Best,

Ari

rmaddu . kirjoitti 12.5.2020 klo 8.14:
I need some help on usage of GDAL C# bindings to convert VRT to MVT. 
How do I know that, below call is complete? We observed that below 
call is Async (All the code lines are executed and Parent thread is 
waiting until the MVT files/folders are created in disk). Is this 
correct?


I want to create a Vector Tile Service. My goal is to return the tile 
to client once the tiles are generated. For this, whether the call is 
completed or not? Below is the code, written in console app.


var options = new[]
{
    "-f", "MVT",
    "-dsco", "TILE_EXTENSION=pbf",
    "-dsco", "MINZOOM=0",
    "-dsco", "MAXZOOM=10",
    };

string input = @"C:\Temp\vrtfile.vrt";
string output = @"C:\Temp\myMVTtiles";

using (
  Dataset ds = Gdal.OpenEx(input, 4, null, null, null))
{
  var newDs = Gdal.wrapper_GDALVectorTranslateDestName (output, ds, 
gdalOptions, new Gdal.GDALProgressFuncDelegate(ProgressFunc), null);

  newDs.FlushCache();
}
    }


Regards,
Rajesh

___
gdal-dev mailing list
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

Re: [gdal-dev] Vector Tile Service

2020-05-12 Thread rmaddu
Hi,

We have "VRT - Virtual format" for Vectors also
(https://gdal.org/drivers/vector/vrt.html).

Using this format and with C# bindings, presently I am able to generate the
vector tiles in disk. My problem here is -

Presently I have written code in console, whenever I open this console
application and after few seconds tiles are generated in disk and console
window is closed. Manually I am waiting till the console close and checking
for my required tile. 

My server side requirement is, we will get multiple tile requests from
client. We have to write mutiple calls
"Gdal.wrapper_GDALVectorTranslateDestName" at a time. Question here is how
to track these threads. How do I know, particular thread is completed so
that I will check for a tile and return to client.

Please provide the suggestions. 

Regards,
Rajesh



--
Sent from: http://osgeo-org.1560.x6.nabble.com/GDAL-Dev-f3742093.html
___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/gdal-dev

Re: [gdal-dev] Vector Tile Service

2020-05-12 Thread Ari Jolma
I don't know about C#. In JavaScript I have a use case where I combine 
several single theme vector tiles into one multi theme tile each in its 
own thread async and then combine them before sending. I use the 
async.series method for that.


Ari

rmaddu kirjoitti 12.5.2020 klo 13.28:

Hi,

We have "VRT - Virtual format" for Vectors also
(https://gdal.org/drivers/vector/vrt.html).

Using this format and with C# bindings, presently I am able to generate the
vector tiles in disk. My problem here is -

Presently I have written code in console, whenever I open this console
application and after few seconds tiles are generated in disk and console
window is closed. Manually I am waiting till the console close and checking
for my required tile.

My server side requirement is, we will get multiple tile requests from
client. We have to write mutiple calls
"Gdal.wrapper_GDALVectorTranslateDestName" at a time. Question here is how
to track these threads. How do I know, particular thread is completed so
that I will check for a tile and return to client.

Please provide the suggestions.

Regards,
Rajesh



--
Sent from: http://osgeo-org.1560.x6.nabble.com/GDAL-Dev-f3742093.html
___
gdal-dev mailing list
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

Re: [gdal-dev] Vector Tile Service

2020-05-12 Thread rmaddu
Hi,

Are you using GDAL binaries for vector tiles generation? Can you please
share the sample code?

Regards,
Rajesh



--
Sent from: http://osgeo-org.1560.x6.nabble.com/GDAL-Dev-f3742093.html
___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/gdal-dev

Re: [gdal-dev] Vector Tile Service

2020-05-12 Thread Ari Jolma
Sorry, no. I'm using PostGIS via tilestrata-postgismvt. The code that 
combines the single-theme tiles it makes is mine, though. The 
tilestrata-postgismvt works under tilestrata, which works under express.


Ari

rmaddu kirjoitti 12.5.2020 klo 14.33:

Hi,

Are you using GDAL binaries for vector tiles generation? Can you please
share the sample code?

Regards,
Rajesh



--
Sent from: http://osgeo-org.1560.x6.nabble.com/GDAL-Dev-f3742093.html
___
gdal-dev mailing list
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

[gdal-dev] Results of gdalwarp from UTM32 to EPSG:4326 are not aligned?

2020-05-12 Thread Pham Huu Bang
Hello,

I've a Sentinel 2 UTM32 scene (JPEG2000 format).

What I want to do is:

+ Warp this scene from UTM32 to EPSG:4326 by gdalwarp
gdalwarp T32UQD_20200421T102021_TCI_60m.jp2 -t_srs EPSG:4326 full_warp.tif

+ Clip a small subset of this file by gdal_translate
gdal_translate -projwin 798326.68347 5795956.80269 799609.577326
5794397.95642 T32UQD_20200421T102021_TCI_60m.jp2 crop.tif

Then warp this small subset also from UTM32 to EPSG:4326 by gdalwarp:

gdalwarp crop.tif -t_srs EPSG:4326 small_warp.tif -dstnodata 0

However, when I overlay the small_warp.tif on the full_warp.tif by
QGIS 2.14.9, I see the small file is not aligned on the big one.

Illustration: https://i.stack.imgur.com/U5Vql.png

What can be the reason for it?

More details given on this link:
https://gis.stackexchange.com/questions/361410/results-of-gdalwarp-from-utm32-to-epsg4326-are-not-aligned

Thanks,
___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/gdal-dev

Re: [gdal-dev] Removal of API_PROXY mechanism: objections?

2020-05-12 Thread Even Rouault
On jeudi 7 mai 2020 20:53:15 CEST Even Rouault wrote:
> Hi,
> 
> https://github.com/OSGeo/gdal/pull/2489 kills the API_PROXY 
mechanism,
> which removes 7820 lines of code. Anyone objects ?

Hearing no objection, this PR has been merged

Even

-- 
Spatialys - Geospatial professional services
http://www.spatialys.com
___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/gdal-dev

Re: [gdal-dev] Results of gdalwarp from UTM32 to EPSG:4326 are not aligned?

2020-05-12 Thread Even Rouault
On mardi 12 mai 2020 16:19:43 CEST Pham Huu Bang wrote:
> Hello,
> 
> I've a Sentinel 2 UTM32 scene (JPEG2000 format).
> 
> What I want to do is:
> 
> + Warp this scene from UTM32 to EPSG:4326 by gdalwarp
> gdalwarp T32UQD_20200421T102021_TCI_60m.jp2 -t_srs EPSG:4326 full_warp.tif
> 
> + Clip a small subset of this file by gdal_translate
> gdal_translate -projwin 798326.68347 5795956.80269 799609.577326
> 5794397.95642 T32UQD_20200421T102021_TCI_60m.jp2 crop.tif
> 
> Then warp this small subset also from UTM32 to EPSG:4326 by gdalwarp:
> 
> gdalwarp crop.tif -t_srs EPSG:4326 small_warp.tif -dstnodata 0
> 
> However, when I overlay the small_warp.tif on the full_warp.tif by
> QGIS 2.14.9, I see the small file is not aligned on the big one.
> 
> Illustration: https://i.stack.imgur.com/U5Vql.png
> 
> What can be the reason for it?

When you don't specify any target extent or resolution, gdalwarp guesses them 
from the 
input raster georeferencing and target SRS. It doesn't try to align on any 
particular resolution

You may want to use the -tr and -tap switches to specify a target resolution, 
and constraint 
the extents to be aligned on it.

Another reason for the misalignment is that you use the default nearest 
resampling. Using -r 
cubic could likely improve things

To get perfectly overlapping images, you may also need to specify -et 0

Even

-- 
Spatialys - Geospatial professional services
http://www.spatialys.com
___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/gdal-dev

Re: [gdal-dev] Results of gdalwarp from UTM32 to EPSG:4326 are not aligned?

2020-05-12 Thread Pham Huu Bang
Thanks Even,

I managed to make them aligned (illustration:
https://i.imgur.com/1TwmVMN.png) from your valuable suggestion with these 2
commands (-tr are used same for both gdapwarp and -tap option is the
critical):

gdalwarp -tr 0.0007161230037719291 -0.0007161230037719291
T32UQD_20200421T102021_TCI_60m.jp2 full_warp.tif -t_srs EPSG:4326
-dstnodata 0 -tap

gdalwarp -tr 0.0007161230037719291 -0.0007161230037719291 crop.tif
small_warp.tif -t_srs EPSG:4326 -dstnodata 0 -tap




On Tue, 12 May 2020 at 18:12, Even Rouault 
wrote:

> On mardi 12 mai 2020 16:19:43 CEST Pham Huu Bang wrote:
>
> > Hello,
>
> >
>
> > I've a Sentinel 2 UTM32 scene (JPEG2000 format).
>
> >
>
> > What I want to do is:
>
> >
>
> > + Warp this scene from UTM32 to EPSG:4326 by gdalwarp
>
> > gdalwarp T32UQD_20200421T102021_TCI_60m.jp2 -t_srs EPSG:4326
> full_warp.tif
>
> >
>
> > + Clip a small subset of this file by gdal_translate
>
> > gdal_translate -projwin 798326.68347 5795956.80269 799609.577326
>
> > 5794397.95642 T32UQD_20200421T102021_TCI_60m.jp2 crop.tif
>
> >
>
> > Then warp this small subset also from UTM32 to EPSG:4326 by gdalwarp:
>
> >
>
> > gdalwarp crop.tif -t_srs EPSG:4326 small_warp.tif -dstnodata 0
>
> >
>
> > However, when I overlay the small_warp.tif on the full_warp.tif by
>
> > QGIS 2.14.9, I see the small file is not aligned on the big one.
>
> >
>
> > Illustration: https://i.stack.imgur.com/U5Vql.png
>
> >
>
> > What can be the reason for it?
>
>
>
> When you don't specify any target extent or resolution, gdalwarp guesses
> them from the input raster georeferencing and target SRS. It doesn't try to
> align on any particular resolution
>
>
>
> You may want to use the -tr and -tap switches to specify a target
> resolution, and constraint the extents to be aligned on it.
>
>
>
> Another reason for the misalignment is that you use the default nearest
> resampling. Using -r cubic could likely improve things
>
>
>
> To get perfectly overlapping images, you may also need to specify -et 0
>
>
>
> Even
>
>
>
> --
>
> Spatialys - Geospatial professional services
>
> http://www.spatialys.com
>


-- 

*Bang Pham Huu *
*-*
*Master of Science - Research Assistant at Field Monitoring Center - 4 F,
E3 BuildingViet Nam - Ha Noi National University - University of
Engineering and Technology*
*Email: a09...@gmail.com  - Tel: +84 164.6339.217*

*“Life is like riding a bicycle. To keep your balance, you must keep
moving.”― Albert Einstein*
___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/gdal-dev

Re: [gdal-dev] Appending to a single feature class in a gdb via ogr2ogr

2020-05-12 Thread Eli Adam
Hi Maggie,

On Mon, Apr 27, 2020 at 9:03 AM Maggie Wooten  wrote:
>
> First, I apologize if I am using this mailing list improperly. This is my 
> first time here.

Asking questions is an appropriate use of the list.

>
> I am trying to iterate over some shapefiles (109 shapefiles to be exact) and 
> append them to a *single* feature class in an output geodatabase, but the 
> resulting output geodatabase is one with 100 feature classes that looks like 
> this:
>

Do all the shapefiles have (exactly) the same fields?  If not, it
probably won't work.

> INFO: Open of `output.gdb' using driver `FileGDB' successful.
> 1: output (Multi Polygon)
> 2: output_1 (Multi Polygon)
> 3: output_1_2 (Multi Polygon)
> 4: output_1_2_3 (Multi Polygon)
> 5: output_1_2_3_4 (Multi Polygon)
> .
> 99: 
> output_1_2_3_4_5_6_7_8_9_10_11_12_13_14_15_16_17_18_19_20_21_22_23_24_25_26_27_28_29_30_31_32_33_34_35_36_37_38_39_40_41_42_43_44_45_98
>  (Multi Polygon)
> 100: 
> output_1_2_3_4_5_6_7_8_9_10_11_12_13_14_15_16_17_18_19_20_21_22_23_24_25_26_27_28_29_30_31_32_33_34_35_36_37_38_39_40_41_42_43_44_45_99
>  (Multi Polygon)
>
>
> These are the commands I'm running in the iteration:
>
> if i == 0: "ogr2ogr -nln output -a_srs EPSG:4326 -t_srs EPSG:4326 -f 
> "FileGDB" output.gdb input1.shp"
>
> else: "ogr2ogr -nln output -a_srs EPSG:4326 -t_srs EPSG:4326 -update -append 
> -f "FileGDB" output.gdb inputX.shp"
>
>
> What am I doing wrong here? How can I get the desired result? I tried a bunch 
> of different things and flags and still could not get it all to append to one 
> feature class. Any advice would be greatly appreciated and I'd be happy to 
> provide whatever information may be necessary.
>
I'm not quite sure what is going wrong there.  I didn't try with an
output of FileGDB but did something similar all with shapefiles.  The
final resulting combined shapefile could probably be manually
ogr2ogr'ed into a FileGDB.

I did this on Ubuntu using Bash.  If you're using a different shell,
you will need different command syntax.  Specifically variables,
filenames without extensions, quoting, escape characters and other
things all need adjustment.  Complicated filenames with spaces or
other symbols can make this more difficult too.

mkdir merged

This is to make an "empty" shapefile with the correct fields and types
and an additional field named s_file to put the source file name in
later:
ogr2ogr -sql "select *, '' as s_file from
Surveys_Invalid_ManualFix_7of7 where SURVEYID='fake'"
merged/surveys_v1.shp Surveys_Invalid_ManualFix_7of7.shp -nln
surveys_v1

This is to check that my empty shapefile turned out okay:
ogrinfo merged/surveys_v1.shp -al

(I worked in a directory where I was selecting ALL the shapefiles, all
of which have the same fields):
FILES=*.shp

for f in $FILES; do g=${f%%.*}; ogr2ogr -sql "select *, '$g' as s_file
from $g" -update -append merged/surveys_v1.shp $f -nln surveys_v1;
done

This is to check that my shapefile is no longer empty and turned out okay:
ogrinfo merged/surveys_v1.shp -al

If you are using DOS on windows, here is a note (untested) from some
previous work.  I don't have windows readily available to test it (the
% might need to be %%):

for %f in (*.shp) do ogr2ogr -sql "select *, '%~nf' as s_file from
%~nf" -update -append merged\output.shp %f -nln output


Hope that helps.

Best regards, Eli

> Thank you!
> Ma
> ___
> gdal-dev mailing list
> 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

Re: [gdal-dev] Appending to a single feature class in a gdb via ogr2ogr

2020-05-12 Thread Even Rouault
On lundi 27 avril 2020 12:02:57 CEST Maggie Wooten wrote:
> First, I apologize if I am using this mailing list improperly. This is my
> first time here.
> 
> I am trying to iterate over some shapefiles (109 shapefiles to be exact)
> and append them to a *single* feature class in an output geodatabase, but
> the resulting output geodatabase is one with 100 feature classes that looks
> like this:
> 
> INFO: Open of `output.gdb' using driver `FileGDB' successful.
> 1: output (Multi Polygon)
> 2: output_1 (Multi Polygon)
> 3: output_1_2 (Multi Polygon)
> 4: output_1_2_3 (Multi Polygon)
> 5: output_1_2_3_4 (Multi Polygon)
> .
> 99:
> output_1_2_3_4_5_6_7_8_9_10_11_12_13_14_15_16_17_18_19_20_21_22_23_24_25_26_
> 27_28_29_30_31_32_33_34_35_36_37_38_39_40_41_42_43_44_45_98 (Multi Polygon)
> 100:
> output_1_2_3_4_5_6_7_8_9_10_11_12_13_14_15_16_17_18_19_20_21_22_23_24_25_26_
> 27_28_29_30_31_32_33_34_35_36_37_38_39_40_41_42_43_44_45_99 (Multi Polygon)
> 
> 
> These are the commands I'm running in the iteration:
> 
> if i == 0: "ogr2ogr -nln output -a_srs EPSG:4326 -t_srs EPSG:4326 -f
> "FileGDB" output.gdb input1.shp"
> 
> else: "ogr2ogr -nln output -a_srs EPSG:4326 -t_srs EPSG:4326 -update
> -append -f "FileGDB" output.gdb inputX.shp"
> 
> 
> What am I doing wrong here?

I'm not sure. I've just tried to replicate your issue with:

ogr2ogr -nln output -a_srs EPSG:4326 -t_srs EPSG:4326 -f "FileGDB" output.gdb  
poly1.shp
ogr2ogr -nln output -a_srs EPSG:4326 -t_srs EPSG:4326 -update -append -f 
"FileGDB" 
output.gdb poly2.shp

and I get a single 'output' layer in the GDB with the features of the 2 input 
layers 
concatenated. This is with GDAL 3.1/master and FileGDB SDK 1.5.1

Looking at the driver code, I can see a layer renaming strategy, but that 
shouldn't normally be 
triggered with the -update -output flag of ogr2ogr. And my understanding of 
that renaming 
strategy is that it should rather result in names like output, output_1, 
output_2, etc. 

-- 
Spatialys - Geospatial professional services
http://www.spatialys.com
___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/gdal-dev

[gdal-dev] OAPIF and apikey

2020-05-12 Thread Rahkonen Jukka (MML)
Hi,

I wonder how I could deal with an OGC API Features service that requires to use 
apikey as an extra parameter in each request. First step is easy because I can 
just add the apikey parameter to the URL of the landing page 
(?api-key=xxxyyyzzzkkk) but the link to collections in the document that is 
returned comes without the apikey and ogrinfo and og2ogr are using the link as 
is. Result is a "HTTP 401 not authorized".

OAPIF supports USERPWD and I found that various vsi systems have service 
specific configuration options https://gdal.org/user/virtual_file_systems.html. 
WFS driver https://gdal.org/drivers/vector/wfs.html supports UserPwd and 
COOKIE. WMS driver supports also UserPwd but I did not find any example of 
concatenating base URLs with extra parameters.

I think that the WMS driver could also benefit from extra parameters which 
would be added to GetMaps because WMS servers support quite nice features with 
their own vendor options.

-Jukka Rahkonen-
___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/gdal-dev

Re: [gdal-dev] OAPIF and apikey

2020-05-12 Thread Even Rouault
On mardi 12 mai 2020 21:21:30 CEST Rahkonen Jukka (MML) wrote:
> Hi,
> 
> I wonder how I could deal with an OGC API Features service that requires to
> use apikey as an extra parameter in each request. First step is easy
> because I can just add the apikey parameter to the URL of the landing page
> (?api-key=xxxyyyzzzkkk) but the link to collections in the document that is
> returned comes without the apikey and ogrinfo and og2ogr are using the link
> as is. Result is a "HTTP 401 not authorized".

Hum, normally there's code to handle that in the driver. And even a test 
(against a 
stub server).
Are you using GDAL 3.1 / master ? If so, how can I replicate that ?

-- 
Spatialys - Geospatial professional services
http://www.spatialys.com
___
gdal-dev mailing list
gdal-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/gdal-dev