Re: Mapnik2geotools incorrect translation of BuildingSymbolizer.

139 views
Skip to first unread message

David Winslow

unread,
Mar 23, 2012, 9:19:57 AM3/23/12
to Николай Лебедев, Mapnik to GeoTools Style Conversion
Yes this would be an excellent addition to Mapnik2GeoTools.

Does the BuildingSymbolizer height specify height in screen pixels, or in world units?  the <Function name="offset"> works only in world units, but SLD 1.1 has support for screen offsets using another technique.  I don't think this is yet implemented in GeoTools though...

--
David Winslow
OpenGeo - http://opengeo.org/

On Thu, Mar 22, 2012 at 6:26 AM, Николай Лебедев <nleb...@gispro.ru> wrote:
Hi David,

I've noticed, that mn2gt doesn't translate mapnik's BuildingSymbolizer to a PolygonSymbolizer in SLD.
It leaves them intact resulting in invalid SLD.

I guess it should translate "height" parameter to an  <ogc:Function name="offset"> in SLD.

Cheers,
Nick

David Winslow

unread,
Mar 23, 2012, 10:43:44 AM3/23/12
to Николай Лебедев, Mapnik to GeoTools Style Conversion
2012/3/23 Николай Лебедев <nleb...@gispro.ru>
I guess BuildingSymbolizer specifies height in screen pixels.
I've done it with <ogc:Function name="offset">, specifying the same value and the result looks similar.

I also found ot, that converting mapniks 
([render] = '3_inline') and ([stylegroup] = 'railway') and ([type] = 'subway') and ([tunnel] = 1) construction 
results in nested 
  <And>
     <And>
        <And>
SLD tags, when it could be just one <And> tag. Idon't know how much it influences on the rendering speed, but it surely adds some lines of XML to the style.

This probably does not have much impact on performance.  I know SLD file size can be an issue but as I said Mapnik2Geotools is very much an incomplete project.  I am not actively working on it, and if I were then reducing nested filters would be a pretty low priority while there are Mapnik tags that are not supported at all.
 
David, I'm trying to convert OSM Bright mapnik style (http://db.tt/eczllCEr) with mn2gt, and I'm having some hard times with that.
I've managed to get SLD files from mapnik XML and I've created postgis views for them manually, registered every layer in geoserver and created a layer group with this styles.
The result looks somewhat different from what I get with TileMill (I guess I'll get the same in pure Mapnik - haven't tried it out yet).

The basic difference is that the converted styles have only one FeatureSymbolizer per style, so mn2gt basically ignores the drawing order, which is very important for roads/bridges/tunnels outlines and casing. 
So now I have to figure out how to apply a different conversion or edit about 50000 lines of SLD XML.

Are you aware that mn2gt can automatically configure GeoServer with a layergroup in the right order? It should handle multiple featuretypes properly, but I am quite ready to believe there are bugs in the way it's handled.

I'm pretty much sure, that geoserver SLD renderer can draw pretty much everything mapnik can, but there's gotta be an easier way to generate filter-heavy sld's.
  
Geoserver CSS module is quite nice fo that, but it lacks some SASS/LESS features like variables, nesting etc., that TileMill's Carto language has. Maybe Carto styles can be converted directly to SLD somehow?
And Geoserver has a great advantage comparing to TileMill/TileStream in that you don't have to seed tiles to mbtiles storage before publishing them, tiles can be generated/updated on the fly.

Now I'm looking at mapnik + mapproxy solution for serving out a basemap, but I really like geoserver better 'cause it's much more flexible, so maybe I'll try rearranging SLD rules somehow programmatically to get a better result.
What do you think?

Mapnik2GeoTools actually already does some re-ordering - the SLD spec requires a particular ordering of elements within rules so this ensures that they are in the right order.  It might be applicable to your problem as well.


Cheers. 
Nick.

David Winslow

unread,
Mar 23, 2012, 4:06:04 PM3/23/12
to Николай Лебедев, Mapnik to GeoTools Style Conversion
Hi Nic,

I added a few fixes to the repository just now - I haven't tried auto-configuring GeoServer but at least the local conversion runs without errors.  This might help move things along for you - let me know how it goes.

You should be able to "pull" these changes with git - I committed them on the master branch.

--
David Winslow
On Fri, Mar 23, 2012 at 11:36 AM, Николай Лебедев <nleb...@gispro.ru> wrote:

This probably does not have much impact on performance.  I know SLD file size can be an issue but as I said Mapnik2Geotools is very much an incomplete project.  I am not actively working on it, and if I were then reducing nested filters would be a pretty low priority while there are Mapnik tags that are not supported at all.

I agree. Spending time on nested filters can pretty much be a crime:)
I wish I knew scala well enough to make a patch myself.
 

Are you aware that mn2gt can automatically configure GeoServer with a layergroup in the right order? It should handle multiple featuretypes properly, but I am quite ready to believe there are bugs in the way it's handled.

I am aware. But mn2gt didn't finish converting it. 
Scala got stuck creating sql, so I coudn't get an automatically created layers and layergroup.
 

Mapnik2GeoTools actually already does some re-ordering - the SLD spec requires a particular ordering of elements within rules so this ensures that they are in the right order.  It might be applicable to your problem as well.



Nope. I mean splitting rules between different featuretypes to get the right drawing order.
The mn2gt generated sld in most cases are schema-valid - that's true.

Anyway, David, thanks for your comment. I'll continue working with mn2gt and let you know if I find any bugs, etc.

Cheers,
Nick

David Winslow

unread,
Mar 27, 2012, 4:52:53 PM3/27/12
to Николай Лебедев, Mapnik to GeoTools Style Conversion
Sorry, I should have mentioned this.

I modified the build - now the "run" command launches the GUI instead of prompting you which version fo the converter to run.  Perhaps the GUI is appearing off-screen for you for some reason?

If you want to run the batch version, use this syntax instead:

> run-main me.winslow.d.mn2gt.Driver myosm.xml

--
David Winslow


2012/3/27 Николай Лебедев <nleb...@gispro.ru>
Hi, David!

I've rebiult mn2gt.
When I type 
> run myosm.xml
The console freezes and doesn't even ask me to choose between GUI and Driver versions of the script.

Is there a log of what is happening somewhere?

Nick

24 марта 2012 г. 0:06 пользователь David Winslow <dwin...@opengeo.org> написал:



--
--
С уважением,
Лебедев Николай
ЗАО "ГИСпроект"
тел.: 8 (495) 981-60-66
факс: 8 (495) 981-60-66
моб.: 8 (903) 720-23-37
e-mail: nleb...@gispro.ru
www.gispro.ru

Николай Лебедев

unread,
Mar 29, 2012, 5:42:17 AM3/29/12
to David Winslow, Mapnik to GeoTools Style Conversion
Hi David,

Yep, the local conversion goes fine.
When trying to "publish to geoserver" option, the script crashes on endless tries of http authentication with a stack overflow at the end. I've attached my log.

Using a default clean geoserver installation from .war on a Tomcat 7.
Haven't touched any of the security settings - they're all default.

Is it a bug? 
Nick


24 марта 2012 г. 0:06 пользователь David Winslow <dwin...@opengeo.org> написал:
Hi Nic,
sbterrlog.txt
Reply all
Reply to author
Forward
0 new messages