osm2vectortiles / osm2vectortiles

Generating global vector tiles from OSM Planet. Please upgrade to OpenMapTiles.
https://openmaptiles.org/osm2vectortiles/
MIT License
502 stars 149 forks source link

Contour lines vector tiles #408

Open klokan opened 8 years ago

klokan commented 8 years ago

From the OpenSnowMap project author, Yves (@yvecai), we have kindly received the preprocessed raw elevation data and contour lines shapefiles.

It is made of these high-quality open data sources: dem2_m (links to used data sources under https://github.com/openterrain/openterrain/wiki/Terrain-Data)

all made with scripts: https://github.com/yvecai/DEM-scripts/blob/master/2015/merge_dem_hs_and_contour.py see: http://blog.opensnowmap.org/post/2015/10/25/Relief-layer-updated http://blog.opensnowmap.org/post/2015/07/11/New-hillsahding-on-OpenSnowMap.org

The target of this ticket to make the docker container import-contour importing available shapefiles into PostGIS and to create a .tm2source file for the contours.

Vector hillshades and generating of the contour lines from RAW data should be discussed under https://github.com/osm2vectortiles/dem2vectorterrain

klokan commented 8 years ago

The sample Shapefile is available for download at https://goo.gl/nGFLR9

It has contour line every 10m - we may need to assign attributtes to contour lines - for styling every second and for the important lines - modulo 50, 100, etc.

And it is visible (practically unstyled) in the preview at screen shot 2016-08-22 at 11 18 28 Online preview on http://labs.klokantech.com/hillshading/ (zoom into the Zurich area)

romanshuvalov commented 8 years ago

I've created import-contour but designed it for OpenDEM contourlines, in order to test it with more precise OpenSnowMap data I need sample of N53E049 and N53E050 segments, can you share them? (It's my region when I'm testing anything.)

After testing I will create pull request.

klokan commented 8 years ago

@romanshuvalov thanks!

I am now travelling to FOSS4G, on bad Internet connection, and I don't have direct access to the individual segments immediately. Everything is packed in one .tar archive with 270+ GB on Google Drive. Otherwise, I have to download, unpack, select and share with you the relevant segment.

Could you please run the tests on the provided sample?

@lukasmartinelli suggested adding the vector tiles into osm2vectortiles.tm2source. The question is how much size the contours add to the zoom level 14 tiles...

I am in favour of separating these into a different terrain.tm2source and creating a different set of vector tiles in MBTiles. This is to not reach 500K limit on the maxzoom tiles.

The GL JSON styles can load multiple tile sources easily - and TileServer-GL is able to concatenate the vector tiles into one anyway - for saving extra http requests or rendering with Mapnik (Tessara or TileServer-Mapnik).

All of the contours should be probably in the tiles for zoom level 14 in the .tm2source.

What attributes are you going to assign to contours, @romanshuvalov?

romanshuvalov commented 8 years ago

Could you please run the tests on the provided sample?

Okay, but I don't know what region is covered by that sample. Please give me a link to any online map so I will see coordinates. (You said "zoom into the Zurich area" but I can't visually find place where you have taken your preview screenshot).

update My bad, file name "contours_48-8" means N48 E008. Found. Testing.

About assigning attributes. Well, the only attribute we need is elevation. OpenDEM has "elevation" attribute, OpenSnowMap has "height". At this moment I edit it manually at import-sql/layers/contour.sql. Probably it's better to determine attribute name from shapefile but I don't know how to do it so temporary I set it to "height".

And I've chosen ele attribute name for final tiles in order to make them compatible with MapBox styles.

I used osm2vectortiles.tm2source for contours. But separating them to other tile set is probably good idea.

And yes, we need generalization/simplification of geometry for lower zoom levels. I didn't make it yet and honestly I don't know how. (I just start learning PostgreSQL/PostGIS recently.)

hyperknot commented 8 years ago

Wow this dataset looks amazing! I'm happy to contribute towards a high quality terrain rendering in osm2vt.

So are there plans to also include raster hillshading with the vector contours? In my opinion raster hillshading is required for high quality visual style, probably that's why Google is still using them (I kind of remember that about a year or two ago they might have switched to vector hillshading and at that time everything looked super triangulated, but now they are back to raster).

So what kind of source do we have? Both preprocessed DEM files and vector contour lines? How can we serve them to MapboxGL? Combining the contour in the dataset, and serving the hillshades in separate PNGs/JPEGs?

What Google seems to be doing is pre-rendering all the terrain-like data on a separate raster layer and serving them from JPEGs.

For example:

screen shot 2016-08-22 at 12 01 41

uses:

vt

romanshuvalov commented 8 years ago

Success.

contour-sample-test

OpenSnowMap contour sample imported to osm2vectortiles via my import-contour docker container.

I will send pull request today.

klokan commented 8 years ago

Great @romanshuvalov!

For the styling in GL JSON - I am not sure into what extent you can really make "every modulo 100 contour darker/thicker" without having the relevant attributes precalculated in the vector tiles... See: https://www.mapbox.com/mapbox-gl-style-spec/#types-filter I think it is not possible - therefore the attributes with correct values are required.

lukasmartinelli commented 8 years ago

For the styling in GL JSON - I am not sure into what extent you can really make "every modulo 100 contour darker/thicker" without having the relevant attributes precalculated in the vector tiles... See: https://www.mapbox.com/mapbox-gl-style-spec/#types-filter

For a thicker index line every 100m you really would need to create 40+ layers.. if you don't want that data in the vector tiles.

Makes sense to create a field containing this (not much extra space). Invent a good name for this and define nice intervals like mod 100m, mod 1000m.

hannesj commented 8 years ago

You can do data-driven styles with mapbox-gl today using property functions

romanshuvalov commented 8 years ago

But we can't set ele % 100 expression as property. Listing any values from 0 to Everest height is not look as good approach.

romanshuvalov commented 8 years ago

Contour lines is now generalized for lower zoom levels. Enough development for today, now preparing for pull request.

contour_gen_anim

yvecai commented 8 years ago

Happy to see these datasets used and abused! Yves

Le 22 août 2016 15:16:45 GMT+02:00, Roman Shuvalov notifications@github.com a écrit :

Contour lines is now generalized for lower zoom levels. Enough development for today, now preparing for pull request.

contour_gen_anim

You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub: https://github.com/osm2vectortiles/osm2vectortiles/issues/408#issuecomment-241409048

Envoyé de mon appareil Android avec K-9 Mail. Veuillez excuser ma brièveté.

romanshuvalov commented 8 years ago

Created pull request: #409

romanshuvalov commented 8 years ago

@yvecai, thank you for dataset, as I understand this dataset is not available to download publicly. And it can cause potential problems for people who want to fork osm2vectortiles project and work on it. Maybe it's better to share it like OpenDEM did that?

hyperknot commented 8 years ago

@yvecai also, if hosting is a problem, I'd be happy to provide hosting on a small Kimsufi server.

klokan commented 8 years ago

I guess we could put all the individual Shape files on the OSM2VectorTiles download infrastructure, where we put the vector tiles with contours as well...

Are you fine with this @yvecai?

On Monday, 22 August 2016, Zsolt Ero notifications@github.com wrote:

@yvecai https://github.com/yvecai also, if hosting is a problem, I'd be happy to provide hosting on a small Kimsufi server.

yvecai commented 8 years ago

@petr : sure, no problem.

Le 22 août 2016 18:24:57 GMT+02:00, Petr Pridal notifications@github.com a écrit :

I guess we could put all the individual Shape files on the OSM2VectorTiles download infrastructure, where we put the vector tiles with contours as well...

Are you fine with this @yvecai?

On Monday, 22 August 2016, Zsolt Ero notifications@github.com wrote:

@yvecai https://github.com/yvecai also, if hosting is a problem, I'd be happy to provide hosting on a small Kimsufi server.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub

https://github.com/osm2vectortiles/osm2vectortiles/issues/408#issuecomment-241452546, or mute the thread

https://github.com/notifications/unsubscribe-auth/AADnlBlTNCUzr3G0hs54MfGQ-FliCVQ4ks5qicGNgaJpZM4JpqKt .

Petr Pridal, Ph.D. CEO

Klokan Technologies GmbH Hofnerstrasse 98, 6314 Unterageri, Switzerland Tel: +41 (0)41 511 26 12 Email: info@klokantech.com Web: http://www.klokantech.com/

You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub: https://github.com/osm2vectortiles/osm2vectortiles/issues/408#issuecomment-241468401

Envoyé de mon appareil Android avec K-9 Mail. Veuillez excuser ma brièveté.