[Marble-devel] Using marble to render PostGIS data in different Projections

tackat at t-online.de tackat at t-online.de
Mon Feb 10 12:49:31 UTC 2014


Well, if you should run into problems just let us know. Marble's framework is quite capable and there are lots of people who have used it for different purposes. So if you run into a problem there is likely somebody on this mailing list who knows how to tackle it. :) And Ander is surely the guy who probably has most experience with large data sets and PostGIS use with Marble (I have almost zero practical experience with PostGIS itself - but I would like to see it well-supported).

When you were talking about projections initially - were you talking about "source projections"/geodetic reference systems or the ones displayed on the screen? For the geodetic reference system we have no means of conversion inside Marble. Therefore we ship all our data using WGS84 and suggest to do the same. As for "output projections" we currently have support for Mercator, Equirectangular and the Spherical projection. Adding more should be doable as well, as the projection code is also completely modular and it should be relatively easy to add further projections since it just requires reimplementing a single projection class and adding code to the texture renderer.

Torsten 




-----Original-Nachricht-----
Betreff: Re: [Marble-devel] Using marble to render PostGIS data in different Projections
Datum: Mon, 10 Feb 2014 13:31:44 +0100
Von: Knut Krause <knut.krause at lagom.de>
An: "marble-devel at kde.org" <marble-devel at kde.org>

Well I'm actually less interested in rendering than in somehow generating the 
raster inout for my algorithm. Rendering would be a nice benefit later though.

Of course I could do some sort of tiling magic. A single raster would be a lot 
easier though ;-)

plain PostGIS seems to be WKB. It can return the geometries as KML text 
though. I think it won't be that hard to convert this to a GeoLineRing or 
whatever.

I just hope I can work in my desired data dimension. Let me have a try.


Knut

Am Montag, 10. Februar 2014, 13:18:36 schrieb tackat at t-online.de:
> It scales quite well. Actually in Marble master we render the whole "Atlas"
> default map theme using that approach - it has thousands of polygons with
> millions of nodes from the 50m Natural Earth vector data set. And it
> renders that on the fly for every single frame. If you render tenthousands
> of polygons then you will surely have to adjust for that: Couldn't you then
> do the PostGIS database queries dynamically depending on the current
> viewBoundingBox and fill the model dynamically? You would only query a few
> dozens/hundreds polygons for the visible area then. And then unload those
> later and add new ones. If that doesn't work you could have a look at
> Anders' project which rendered OSM vector tiles.
> 
> Oh and another incentive: If you use this approach you can benefit from
> features such as the file view that is available in Marble master and that
> you can see at the bottom left of this screenshot:
> 
> http://byte.kde.org/~tackat/marble_file_view.png
> 
> Of course we are also happy about all patches that improve these features
> further ;-)
> 
> Best Regards,
> Torsten
> 
> 
> -----Original-Nachricht-----
> Betreff: Re: [Marble-devel] Using marble to render PostGIS data in different
> Projections Datum: Mon, 10 Feb 2014 12:54:25 +0100
> Von: Knut Krause <knut.krause at lagom.de>
> An: "tackat at t-online.de" <tackat at t-online.de>, marble-devel at kde.org
> 
> 
> Sure sure.
> 
> btw I should have mentioned, that I plan to use my approach to cover huge
> spaces … like half germany or something like that.
> 
> I hope your suggested approach doesn't run into performance issues too fast
> since that is a fundamental issue here.
> 
> I think I'll render a couple hundred thousand to millions polygons into one
> raster …
> 
> 
> Knut
> 
> Am Montag, 10. Februar 2014, 12:51:26 schrieb tackat at t-online.de:
> > Well I just reread Anders' mail and only now realized that he suggested to
> > export to json and then use the json runner. That would be the lazy
> > approach ;-) (and would probably be less flexible). The beer and pizza
> > invitation is only offered for actually writing the PostGIS runner (where
> > you could borrow code from the existing runners such as the JSON, KML,
> > SHP,
> > and OSM runner).
> > 
> > As a "first shot" you could maybe also have a look at the gpsbabel runner:
> > That one uses the gpsbabel commandline tool - if installed - to convert
> > different file formats to KML and then feeds it to Marble's KML runner.
> > Maybe you could do something similar with the PostGIS database as a source
> > and feed it to the JSON runner. But again that might be less flexible that
> > creating a "full-blown" dedicated "PostGIS" runner.
> > 
> > Oh and in order to test your code (in order to verify your
> > beer-and-pizza-claims ;-))))) ) we need a tutorial on how to use your code
> > - preferably you create a small tutorial at
> > http://techbase.kde.org/Projects/Marble just along the existing ones.
> > 
> > Best Regards,
> > Torsten
> > 
> > 
> > 
> > -----Original-Nachricht-----
> > Betreff: Re: [Marble-devel] Using marble to render PostGIS data in
> > different Projections Datum: Mon, 10 Feb 2014 12:39:20 +0100
> > Von: Knut Krause <knut.krause at lagom.de>
> > An: marble-devel at kde.org
> > 
> > Woah, thanks for your brilliant suggestions.
> > 
> > I'll have a look at the runner and will see how I could use them. If this
> > works for me maybe you'll have to pay for pizza and beer really soon :-P
> > 
> > Knut
> > 
> > Am Montag, 10. Februar 2014, 12:31:06 schrieb tackat at t-online.de:
> > > Hi Knut,
> > > 
> > > I had always wondered why nobody had done this earlier. It should be
> > > relatively straightforward. Ideally you would do it differently though:
> > > Nowadays the GeoPainter approach is too lowlevel. These days we rather
> > > discourage to use GeoPainter directly - although there is nothing bad
> > > about
> > > GeoPainter itself.These days we rather encourage the "object-oriented"
> > > approach. The "object-oriented" approach has lots of benefits and it
> > > should go extremely well with PostGIS:
> > > 
> > > Nowadays Marble imports all files into a single data model: No matter
> > > whether it's KML, GPX, SHP (ShapeFiles) or OSM vector data - all files
> > > get
> > > imported into a single "GeoDataDocument"-document model (we informally
> > > call
> > > that "The GeoData way" since the related classes have the prefix
> > > "GeoData"). The rendering of that model is then done automatically by
> > > GeoPainter behind the scenes. So you don't have to mess with GeoPainter
> > > directly and you don't have to care about the rendering part! This is an
> > > advantage since this is much more convenient for you and also since
> > > GeoPainter might get replaced by an OpenGL-based painter/renderer at one
> > > point. So if you go "the GeoData way" your code will stay future-proof
> > > :-)
> > > 
> > > For importing the PostGIS data into the model you should probably have a
> > > look at the file-import plugins. Yes, each fileformat in Marble is
> > > converted to that single data model via a dedicated plugin. Have a look
> > > inside the source code here:
> > > 
> > > src/plugins/runner
> > > 
> > > In that directory you will find lots of "runners" which create
> > > GeoDataDocuments for various purposes. You probably want to have a look
> > > at
> > > the runners which import the files. Those are inside the subdirectories
> > > kml, gpx, shp, osm. My guess is that the SHP-file is probably most close
> > > to
> > > the PostGIS case. So you can borrow lots of ideas from there. The KML
> > > case
> > > is also very interesting - especially since the structure of our central
> > > universal data-model is inspired by KML. So if you know KML then you
> > > will
> > > get immediately fluent with the GeoData classes since they are named
> > > structured the same way as KML (although they can hold GPX, OSM, SHP and
> > > PostGIS data - the challenge is just to map the information correctly).
> > > You
> > > can probably fully ignore the OSM runner, since the vector OSM
> > > fileformat
> > > has a pretty "weird" structure.
> > > 
> > > For learning more about the GeoDataDocument structure you can have a
> > > look
> > > at these this tutorial:
> > > 
> > > http://techbase.kde.org/Projects/Marble/Runners/DisplayGeoDataPlacemark
> > > 
> > > and these:
> > > 
> > > http://techbase.kde.org/Projects/Marble/Runners/Parse
> > > http://techbase.kde.org/Projects/Marble/Runners/LoadingOSM
> > > 
> > > So I suggest that you create a "postgis runner" plugin which would act
> > > as
> > > an interface between the PostGIS database and Marble's GeoDataDocument
> > > document model. Oh and yes of course this approach would allow for
> > > reversing the whole process. In the future you could allow users to edit
> > > polygons inside Marble and have the GeoDataPolygons get written back to
> > > the PostGIS database.
> > > 
> > > So if you look at the (relatively small) file parsing plugins you should
> > > see that this should all be doable. Additional incentive: If you
> > > implement this PostGIS runner and contribute it back to Marble then I
> > > owe
> > > you a beer and a pizza ;-)
> > > 
> > > Does that sound good to you? ;)
> > > 
> > > Best Regards,
> > > Torsten
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > -----Original-Nachricht-----
> > > Betreff: [Marble-devel] Using marble to render PostGIS data in different
> > > Projections Datum: Mon, 10 Feb 2014 11:45:05 +0100
> > > Von: Knut Krause <knut.krause at lagom.de>
> > > An: marble-devel at kde.org
> > > 
> > > Hi,
> > > 
> > > I have a PostGIS database with geometries. Now I'd like to do some
> > > computation on them. For my core algorithm I need the polygons in raster
> > > format. So I would be great if I could somehow use marble to draw my
> > > geometries on a flat surface like QImage. To show the result of my
> > > algorithm though I'd like to render a path on a plain marble widget.
> > > 
> > > Is it possible to use marble for that? Right now I use GDAL to transform
> > > the geometry from WKB to QPolygonF but that involeves a lot of number
> > > crunching myself to get the positions right and I fear I'm not smart
> > > enough to cope with projections correctly.
> > > 
> > > I thought something like
> > > 
> > > PostGIS -> <magic> -> GeoPainter -> QImage
> > > 
> > > would be great to render a set of geometries on an image as big as the
> > > bounding box of the geometries. Anyone here an idea if this works?
> > > 
> > > 
> > > Knut
> > > _______________________________________________
> > > Marble-devel mailing list
> > > Marble-devel at kde.org
> > > https://mail.kde.org/mailman/listinfo/marble-devel
> > 
> > _______________________________________________
> > Marble-devel mailing list
> > Marble-devel at kde.org
> > https://mail.kde.org/mailman/listinfo/marble-devel
> 
> _______________________________________________
> Marble-devel mailing list
> Marble-devel at kde.org
> https://mail.kde.org/mailman/listinfo/marble-devel

_______________________________________________
Marble-devel mailing list
Marble-devel at kde.org
https://mail.kde.org/mailman/listinfo/marble-devel







More information about the Marble-devel mailing list