Re: [OSM-dev] Plotting data on an equirectangular map, distorted for sphere projection

2013-07-19 Thread Christopher Stevens
Alright,
Thanks to some great feedback, I've made some good progress on getting
distortions to look better on a sphere. It's not perfect yet, but getting
close. Perhaps I just need to do a little more research on different
projections and more trial and error.

Here's what I've done so far:

#Create mml file with Mollwide projection specifed in Map:

?xml version=1.0 encoding=utf-8?
Map srs=+proj=moll +lon_0=0 +x_0=0 +y_0=0 +ellps=WGS84 +datum=WGS84
+units=m +no_defs
Stylesheet![CDATA[
*
{
map-bgcolor: #69f;
}

#world-borders
{
/*line-width: 1;
line-color: #696;*/
polygon-fill: #6f9;
}

#world-borders NAME
{
text-face-name: DejaVu Sans Book;
text-size: 24;
text-fill: #000;
text-halo-fill: #9ff;
text-halo-radius: 2;
text-placement: point;
text-wrap-width: 50;
text-avoid-edges: true;
}

#world-outline
{
line-width: 10;
line-color: #696;
}
]]/Stylesheet
Layer id=world-outline srs=+proj=merc +a=6378137 +b=6378137
+lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null
+wktext +no_defs +over
Datasource
Parameter name=typeshape/Parameter
Parameter name=filesample_data/world_merc.shp/Parameter
/Datasource
/Layer
Layer id=world-borders srs=+proj=merc +a=6378137 +b=6378137
+lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null
+wktext +no_defs +over
Datasource
Parameter name=typeshape/Parameter
Parameter name=filesample_data/world_merc.shp/Parameter
/Datasource
/Layer
/Map

#create XML
cascadenik-compile.py shapeTest.mml shapeTest.xml

#create Mollwide projection:
nik2img.py shapeTest.xml shapeTest.tif -d 4096 2048 --bbox -180.0 -90.0
180.0 90.0
http://www.flickr.com/photos/8139783@N08/9319568407/

#reproject as EPSG:4326
gdalwarp -s_srs '+proj=moll +lon_0=0 +x_0=0 +y_0=0 +ellps=WGS84
+datum=WGS84 +units=m +no_defs' -t_srs EPSG:4326 -te -180.0 -90.0 180.0
90.0 -ts 4096 2048 -overwrite shapeTest.tif shapeTestOut.tif
http://www.flickr.com/photos/8139783@N08/9319567933/in/photostream/

#3D render previews:
http://www.flickr.com/photos/8139783@N08/9322359900/in/photostream/
http://www.flickr.com/photos/8139783@N08/9322359828/in/photostream/ (lines
and text a touch thicker near the poles, labels a touch skewed? - so close!)

*Update as I write:*
I can guess that the text is getting skewed due to the stretching from one
projection to the other (more stretching towards the right and left edges).
I imagine that I'll need to calculate and place text separately. Science On
a Sphere allows text to be placed via an accompanying dataset text file as
well. Also, if I make the map outlines, inlines, things seem to stay less
stretched near the poles.
http://www.flickr.com/photos/8139783@N08/9323320848/ (lines may appear
deceiving as I thinned them out a bit compared to above links)

Thanks again for the feedback. Any additional ideas are welcome as I
research more.

Best regards,

Chris


On Thu, Jul 18, 2013 at 2:12 AM, Martin Raifer tyr@gmail.com wrote:

 Hi!

 Just a wild guess (didn't try), but what if you rendered your map in an
 equal area projection (e.g. Mollweide) and reprojected the resulting raster
 image - in a second step - to equirectangular (for example using GDAL)?
 That could result in something more towards your objective...

 Cheers,
 Martin


___
dev mailing list
dev@openstreetmap.org
http://lists.openstreetmap.org/listinfo/dev


Re: [OSM-dev] Plotting data on an equirectangular map, distorted for sphere projection

2013-07-18 Thread Martin Raifer

Hi!

Just a wild guess (didn't try), but what if you rendered your map in an  
equal area projection (e.g. Mollweide) and reprojected the resulting  
raster image - in a second step - to equirectangular (for example using  
GDAL)? That could result in something more towards your objective...


Cheers,
Martin


Christopher Stevens ch...@christopherstevens.cc:


Hello Dane,
Thanks for taking a look. So far I can produce an EPSG:4326 image nicely,
your comment boosted that setup (thanks!). This one is quick and ugly,  
but

should work for illustration purposes:
http://www.flickr.com/photos/8139783@N08/9309514743/

Now to add some basic large labels:
http://www.flickr.com/photos/8139783@N08/9309518499/in/photostream/

If I then project this on a sphere (virtual one in this example, but  
looks
the same in real projection), the geography placement looks great and  
lines

up well with other datasets. The styling gets odd with labels and lines
getting thinner horizontally.
http://www.flickr.com/photos/8139783@N08/9309514621/in/photostream/ -  
side

view
http://www.flickr.com/photos/8139783@N08/9309514685/in/photostream/ -  
pole

view, the presenter often turns the globe this way for audience

Let me know if that helps illustrate the challenge better.

Thanks again,

Chris


On Wed, Jul 17, 2013 at 11:41 AM, Dane Springmeyer d...@dbsgeo.com  
wrote:



Chris,

It would be helpful to explain what you've tried already. Mapnik  
supports

proj4 and proj4 understands quite a few projections. I'm no expert in
equirectangular projections but
https://en.wikipedia.org/wiki/Equirectangular_projection states that  
this

is basically a term for the well know set of lon/lat based geographic
coordinate systems.

So, can you try simply changing your Mapnik Map `srs` value to EPSG:4326
or a specific Equidistant cylindrical projection like
http://spatialreference.org/ref/epsg/3786/

The specific Mapnik Map XML syntax can be found by following the link  
for

Mapnik XML like:

http://spatialreference.org/ref/epsg/3786/mapnik/


Dane


On Jul 17, 2013, at 9:41 AM, Christopher Stevens 
ch...@christopherstevens.cc wrote:

Hello gurus,
I'm thinking that I may need to find some alternative data visualization
software to make this work, but I love mapnik and thought it would be  
good

to start here first.

I'm hoping to create a basic themed map of different types of data and
plot it on a full-Earth image (I can figure this part out, starter  
examples
cover this as well). The challenge is that I'm then projecting this on  
Science
On a  
Spherehttp://www.spacefoundation.org/visit/northrop-grumman-science-center-featuring-science-sphere/science-sphere%C2%AE,
which requires equirectangular images that distort more towards the  
poles.
Here's a quick example of something I made in a 3D program to show  
latitude
and longitude lines (note how the lines and labels get fuzzy and  
stretched

near the poles).


http://www.flickr.com/photos/8139783@N08/9305646391/

Is there a way to add this type of distortion in mapnik? I'm guessing  
not
as mapnik is optimized for other uses (but who knows). I'm guessing  
that it

would work as is, but labels would get distorted (there are
work-arounds), and lines would get very thin near the poles.

Thanks for the feedback in advance. Let me know if I can answer any
questions.

Best regards,

Chris


___
dev mailing list
dev@openstreetmap.org
http://lists.openstreetmap.org/listinfo/dev


[OSM-dev] Plotting data on an equirectangular map, distorted for sphere projection

2013-07-17 Thread Christopher Stevens
Hello gurus,
I'm thinking that I may need to find some alternative data visualization
software to make this work, but I love mapnik and thought it would be good
to start here first.

I'm hoping to create a basic themed map of different types of data and plot
it on a full-Earth image (I can figure this part out, starter examples
cover this as well). The challenge is that I'm then projecting this on Science
On a 
Spherehttp://www.spacefoundation.org/visit/northrop-grumman-science-center-featuring-science-sphere/science-sphere%C2%AE,
which requires equirectangular images that distort more towards the poles.
Here's a quick example of something I made in a 3D program to show latitude
and longitude lines (note how the lines and labels get fuzzy and stretched
near the poles).

http://www.flickr.com/photos/8139783@N08/9305646391/

Is there a way to add this type of distortion in mapnik? I'm guessing not
as mapnik is optimized for other uses (but who knows). I'm guessing that it
would work as is, but labels would get distorted (there are
work-arounds), and lines would get very thin near the poles.

Thanks for the feedback in advance. Let me know if I can answer any
questions.

Best regards,

Chris
___
dev mailing list
dev@openstreetmap.org
http://lists.openstreetmap.org/listinfo/dev


Re: [OSM-dev] Plotting data on an equirectangular map, distorted for sphere projection

2013-07-17 Thread Peter Körner
Hi

Am 17.07.2013 15:41, schrieb Christopher Stevens:
 Hello gurus,
 I'm thinking that I may need to find some alternative data visualization
 software to make this work, but I love mapnik and thought it would be
 good to start here first.
Mapnik is capable of rendering data in nearly any possible projection -
and it can be done with osm-data, too.

On http://polar.openstreetmap.de/ we do a rendering in EPSG:3031
Antarctic Polar Stereographic projection.

Code and documentaztion can be found here:
https://github.com/MaZderMind/mapnik-stylesheets-polar

However those projections are applied to the geometries *before*
rendering out a planar, rectangular image.

 I'm hoping to create a basic themed map of different types of data and
 plot it on a full-Earth image (I can figure this part out, starter
 examples cover this as well). The challenge is that I'm then projecting
 this on Science On a Sphere
 http://www.spacefoundation.org/visit/northrop-grumman-science-center-featuring-science-sphere/science-sphere%C2%AE,
 which requires equirectangular images that distort more towards the
 poles. Here's a quick example of something I made in a 3D program to
 show latitude and longitude lines (note how the lines and labels get
 fuzzy and stretched near the poles).
 
 http://www.flickr.com/photos/8139783@N08/9305646391/
This however looks like an post-render distortion, so I'd guess you'd
have to apply some filter to the rendered mapnik images.


 Is there a way to add this type of distortion in mapnik? I'm guessing
 not as mapnik is optimized for other uses (but who knows). I'm guessing
 that it would work as is, but labels would get distorted (there are
 work-arounds), and lines would get very thin near the poles.
I'd bet that it would be better to use sth. like graphicsmagick or a
custom program with libpng to do the pixel-transformations after the
rendering finished.

Peter


___
dev mailing list
dev@openstreetmap.org
http://lists.openstreetmap.org/listinfo/dev


Re: [OSM-dev] Plotting data on an equirectangular map, distorted for sphere projection

2013-07-17 Thread Christopher Stevens
Peter,
Thanks for the helpful info! It's much appreciated (and I just realized I
posted to OSM list instead of mapnik, helpful anyway!).

I'll look deeper into post-render distortion.

Kind regards,

Chris


On Wed, Jul 17, 2013 at 8:40 AM, Peter Körner osm-li...@mazdermind.dewrote:

 Hi

 Am 17.07.2013 15:41, schrieb Christopher Stevens:
  Hello gurus,
  I'm thinking that I may need to find some alternative data visualization
  software to make this work, but I love mapnik and thought it would be
  good to start here first.
 Mapnik is capable of rendering data in nearly any possible projection -
 and it can be done with osm-data, too.

 On http://polar.openstreetmap.de/ we do a rendering in EPSG:3031
 Antarctic Polar Stereographic projection.

 Code and documentaztion can be found here:
 https://github.com/MaZderMind/mapnik-stylesheets-polar

 However those projections are applied to the geometries *before*
 rendering out a planar, rectangular image.

  I'm hoping to create a basic themed map of different types of data and
  plot it on a full-Earth image (I can figure this part out, starter
  examples cover this as well). The challenge is that I'm then projecting
  this on Science On a Sphere
  
 http://www.spacefoundation.org/visit/northrop-grumman-science-center-featuring-science-sphere/science-sphere%C2%AE
 ,
  which requires equirectangular images that distort more towards the
  poles. Here's a quick example of something I made in a 3D program to
  show latitude and longitude lines (note how the lines and labels get
  fuzzy and stretched near the poles).
 
  http://www.flickr.com/photos/8139783@N08/9305646391/
 This however looks like an post-render distortion, so I'd guess you'd
 have to apply some filter to the rendered mapnik images.


  Is there a way to add this type of distortion in mapnik? I'm guessing
  not as mapnik is optimized for other uses (but who knows). I'm guessing
  that it would work as is, but labels would get distorted (there are
  work-arounds), and lines would get very thin near the poles.
 I'd bet that it would be better to use sth. like graphicsmagick or a
 custom program with libpng to do the pixel-transformations after the
 rendering finished.

 Peter


 ___
 dev mailing list
 dev@openstreetmap.org
 http://lists.openstreetmap.org/listinfo/dev




-- 
Christopher Stevens
303.929.7863 cell
www.christopherstevens.cc
___
dev mailing list
dev@openstreetmap.org
http://lists.openstreetmap.org/listinfo/dev


Re: [OSM-dev] Plotting data on an equirectangular map, distorted for sphere projection

2013-07-17 Thread Dane Springmeyer
Chris,

It would be helpful to explain what you've tried already. Mapnik supports proj4 
and proj4 understands quite a few projections. I'm no expert in equirectangular 
projections but https://en.wikipedia.org/wiki/Equirectangular_projection states 
that this is basically a term for the well know set of lon/lat based geographic 
coordinate systems.

So, can you try simply changing your Mapnik Map `srs` value to EPSG:4326 or a 
specific Equidistant cylindrical projection like 
http://spatialreference.org/ref/epsg/3786/

The specific Mapnik Map XML syntax can be found by following the link for 
Mapnik XML like:

http://spatialreference.org/ref/epsg/3786/mapnik/


Dane


On Jul 17, 2013, at 9:41 AM, Christopher Stevens ch...@christopherstevens.cc 
wrote:

 Hello gurus,
 I'm thinking that I may need to find some alternative data visualization 
 software to make this work, but I love mapnik and thought it would be good to 
 start here first.
 
 I'm hoping to create a basic themed map of different types of data and plot 
 it on a full-Earth image (I can figure this part out, starter examples cover 
 this as well). The challenge is that I'm then projecting this on Science On a 
 Sphere, which requires equirectangular images that distort more towards the 
 poles. Here's a quick example of something I made in a 3D program to show 
 latitude and longitude lines (note how the lines and labels get fuzzy and 
 stretched near the poles).
 
 http://www.flickr.com/photos/8139783@N08/9305646391/
 
 Is there a way to add this type of distortion in mapnik? I'm guessing not as 
 mapnik is optimized for other uses (but who knows). I'm guessing that it 
 would work as is, but labels would get distorted (there are work-arounds), 
 and lines would get very thin near the poles.
 
 Thanks for the feedback in advance. Let me know if I can answer any questions.
 
 Best regards,
 
 Chris
 ___
 dev mailing list
 dev@openstreetmap.org
 http://lists.openstreetmap.org/listinfo/dev

___
dev mailing list
dev@openstreetmap.org
http://lists.openstreetmap.org/listinfo/dev


Re: [OSM-dev] Plotting data on an equirectangular map, distorted for sphere projection

2013-07-17 Thread Eugene Alvin Villar
On Thu, Jul 18, 2013 at 1:41 AM, Dane Springmeyer d...@dbsgeo.com wrote:

 Chris,

 It would be helpful to explain what you've tried already. Mapnik supports
 proj4 and proj4 understands quite a few projections. I'm no expert in
 equirectangular projections but
 https://en.wikipedia.org/wiki/Equirectangular_projection states that this
 is basically a term for the well know set of lon/lat based geographic
 coordinate systems.

 So, can you try simply changing your Mapnik Map `srs` value to EPSG:4326
 or a specific Equidistant cylindrical projection like
 http://spatialreference.org/ref/epsg/3786/

 The specific Mapnik Map XML syntax can be found by following the link for
 Mapnik XML like:

 http://spatialreference.org/ref/epsg/3786/mapnik/


I don't think Chris' problem is setting the appropriate projection in
Mapnik.

What he needs is a way to distort the elements on the map (like text) such
that if the map is used as a bitmap texture for a spherical 3D model, the
map elements don't look distorted.
___
dev mailing list
dev@openstreetmap.org
http://lists.openstreetmap.org/listinfo/dev


Re: [OSM-dev] Plotting data on an equirectangular map, distorted for sphere projection

2013-07-17 Thread Christopher Stevens
Hello Dane,
Thanks for taking a look. So far I can produce an EPSG:4326 image nicely,
your comment boosted that setup (thanks!). This one is quick and ugly, but
should work for illustration purposes:
http://www.flickr.com/photos/8139783@N08/9309514743/

Now to add some basic large labels:
http://www.flickr.com/photos/8139783@N08/9309518499/in/photostream/

If I then project this on a sphere (virtual one in this example, but looks
the same in real projection), the geography placement looks great and lines
up well with other datasets. The styling gets odd with labels and lines
getting thinner horizontally.
http://www.flickr.com/photos/8139783@N08/9309514621/in/photostream/ - side
view
http://www.flickr.com/photos/8139783@N08/9309514685/in/photostream/ - pole
view, the presenter often turns the globe this way for audience

Let me know if that helps illustrate the challenge better.

Thanks again,

Chris


On Wed, Jul 17, 2013 at 11:41 AM, Dane Springmeyer d...@dbsgeo.com wrote:

 Chris,

 It would be helpful to explain what you've tried already. Mapnik supports
 proj4 and proj4 understands quite a few projections. I'm no expert in
 equirectangular projections but
 https://en.wikipedia.org/wiki/Equirectangular_projection states that this
 is basically a term for the well know set of lon/lat based geographic
 coordinate systems.

 So, can you try simply changing your Mapnik Map `srs` value to EPSG:4326
 or a specific Equidistant cylindrical projection like
 http://spatialreference.org/ref/epsg/3786/

 The specific Mapnik Map XML syntax can be found by following the link for
 Mapnik XML like:

 http://spatialreference.org/ref/epsg/3786/mapnik/


 Dane


 On Jul 17, 2013, at 9:41 AM, Christopher Stevens 
 ch...@christopherstevens.cc wrote:

 Hello gurus,
 I'm thinking that I may need to find some alternative data visualization
 software to make this work, but I love mapnik and thought it would be good
 to start here first.

 I'm hoping to create a basic themed map of different types of data and
 plot it on a full-Earth image (I can figure this part out, starter examples
 cover this as well). The challenge is that I'm then projecting this on Science
 On a 
 Spherehttp://www.spacefoundation.org/visit/northrop-grumman-science-center-featuring-science-sphere/science-sphere%C2%AE,
 which requires equirectangular images that distort more towards the poles.
 Here's a quick example of something I made in a 3D program to show latitude
 and longitude lines (note how the lines and labels get fuzzy and stretched
 near the poles).


 http://www.flickr.com/photos/8139783@N08/9305646391/

 Is there a way to add this type of distortion in mapnik? I'm guessing not
 as mapnik is optimized for other uses (but who knows). I'm guessing that it
 would work as is, but labels would get distorted (there are
 work-arounds), and lines would get very thin near the poles.

 Thanks for the feedback in advance. Let me know if I can answer any
 questions.

 Best regards,

 Chris
 ___
 dev mailing list
 dev@openstreetmap.org
 http://lists.openstreetmap.org/listinfo/dev





-- 
Christopher Stevens
303.929.7863 cell
www.christopherstevens.cc
___
dev mailing list
dev@openstreetmap.org
http://lists.openstreetmap.org/listinfo/dev