Re: [OSM-dev] Plotting data on an equirectangular map, distorted for sphere projection
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
[OSM-dev] Plotting data on an equirectangular map, distorted for sphere projection
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
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
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
Re: [OSM-dev] troubles importing osm data via osm2pgsql: skipping table creation, no function match, permission issue?
This item has been resolved. I switched to from Mac OSX 10.6 to ubuntu for improved success, following directions with minor improv at: http://trac.mapnik.org/wiki/UbuntuInstallation ___ dev mailing list dev@openstreetmap.org http://lists.openstreetmap.org/listinfo/dev
[OSM-dev] troubles importing osm data via osm2pgsql: skipping table creation, no function match, permission issue?
OS: Mac OSX 10.6 Terminal output: $ time /usr/local/bin/osm2pgsql --slim -d gis /users/chris/Desktop/coloradoOSM/colorado.osm.highway osm2pgsql SVN version 0.69-exported Using projection SRS 900913 (Spherical Mercator) Setting up table: planet_osm_point NOTICE: table planet_osm_point does not exist, skipping NOTICE: table planet_osm_point_tmp does not exist, skipping SELECT AddGeometryColumn('planet_osm_point', 'way', 900913, 'POINT', 2 ); failed: ERROR: function addgeometrycolumn(unknown, unknown, integer, unknown, integer) does not exist LINE 1: SELECT AddGeometryColumn('planet_osm_point', 'way', 900913, ... ^ HINT: No function matches the given name and argument types. You might need to add explicit type casts. Error occurred, cleaning up real 0m0.190s user 0m0.004s sys 0m0.007s Initial research suggested that my mac user didn't have proper privileges. I ran this when setting up my user: $ psql #reeived an error as I didn't specify a database (FATAL: database chris does not exist), no biggie I think $ createuser --superuser chris -U postgres Then created the database: $ createdb gis Here's the list of databases and who owns them: $ psql -l List of databases Name| Owner | Encoding ---+--+-- gis | chris| UTF8 gisdata | chris| UTF8 postgres | postgres | UTF8 template0 | postgres | UTF8 template1 | postgres | UTF8 (5 rows) I even tried importing data after the following: sudo su - postgres No luck. Maybe it's not a permission issue, or I'm missing a step? Let me know what you think. I appreciate the feedback. Chris ___ dev mailing list dev@openstreetmap.org http://lists.openstreetmap.org/listinfo/dev
Re: [OSM-dev] troubles importing osm data via osm2pgsql: skipping table creation, no function match, permission issue?
[*] postgis.sql for PostGIS 1.4 and later I believe. I'm using postgis-1.5, installed using homebrew There's two files named lwpostgis.sql* and spatial_ref_sys.sql which are in your PostGIS package somewhere. You need to run them on your database after you have done the createdb and the createlang plpgsql. The following resulted in some oddness. I'm wondering if I need to re-install with macports, or one of the KyngChaos releases.. or I'm just missing something. I appreciate thoughts. Chris = $ psql -d gis -f /usr/local/pgsql/share/contrib/postgis-1.5/postgis.sql SET BEGIN psql:/usr/local/pgsql/share/contrib/postgis-1.5/postgis.sql:59: ERROR: could not access file $libdir/postgis-1.5: No such file or directory psql:/usr/local/pgsql/share/contrib/postgis-1.5/postgis.sql:65: ERROR: current transaction is aborted, commands ignored until end of transaction block psql:/usr/local/pgsql/share/contrib/postgis-1.5/postgis.sql:70: ERROR: current transaction is aborted, commands ignored until end of transaction block ... ... ... ROLLBACK psql:/usr/local/pgsql/share/contrib/postgis-1.5/postgis.sql:7746: ERROR: type geometry does not exist psql:/usr/local/pgsql/share/contrib/postgis-1.5/postgis.sql:7747: ERROR: type geometry does not exist ... psql:/usr/local/pgsql/share/contrib/postgis-1.5/postgis.sql:7752: ERROR: type box2d does not exist ... DROP FUNCTION DROP FUNCTION psql:/usr/local/pgsql/share/contrib/postgis-1.5/postgis.sql:7775: ERROR: type geometry does not exist = ___ dev mailing list dev@openstreetmap.org http://lists.openstreetmap.org/listinfo/dev
Re: [OSM-dev] troubles installing osm2pgsql on Mac OS X 10.6: make fail
Installing Homebrew, uninstalling macports, deleting and reinstalling geos, proj, and osm2pgsql was a success. This item has been resolved. ___ dev mailing list dev@openstreetmap.org http://lists.openstreetmap.org/listinfo/dev
[OSM-dev] troubles installing osm2pgsql on Mac OS X 10.6: make fail
Hello gurus, While getting far into the installation process, I'm hung up when running the make command for osm2pgsql on Mac OS X10.6. My initial guess is that I have a library somewhere that's not being found or is not installed. I have no idea where to start. Here are the commands I'm running in terminal. All are great until make: == svn co http://svn.openstreetmap.org/applications/utils/export/osm2pgsql/ cd osm2pgsql ./autogen.sh ./configure #(I was running into other errors before adding the following where pg_config command could not be found) export PATH=/usr/local/pgsql/bin/pg_config:$PATH PATH=$PATH:/Library/Frameworks/GEOS.framework/unix/bin/ CFLAGS=-I/Library/Frameworks/PROJ.framework/unix/include LDFLAGS=-L/Library/Frameworks/PROJ.framework/unix/lib/ make == That last bit (with or without the extra flags and such) prints out a whole bunch of lines, ending with: == ... ld: symbol(s) not found collect2: ld returned 1 exit status make: *** [osm2pgsql] Error 1 == Other lines of interest: == ... ld: warning: in /opt/local/lib/libxml2.dylib, file is not of required architecture ld: warning: in /opt/local/lib/libz.dylib, file is not of required architecture ld: warning: in /opt/local/lib/libiconv.dylib, file is not of required architecture ld: warning: in /opt/local/lib/libgeos.dylib, file is not of required architecture ld: warning: in /opt/local/lib/libbz2.dylib, file is not of required architecture Undefined symbols: ___cxa_call_unexpected, referenced from: std::auto_ptrgeos::geom::Geometry::operator=(std::auto_ptr_refgeos::geom::Geometry)in build_geometry.o std::auto_ptrgeos::geom::CoordinateSequence::operator=(std::auto_ptr_refgeos::geom::CoordinateSequence)in build_geometry.o std::basic_stringchar, std::char_traitschar, std::allocatorchar ::basic_string(std::basic_stringchar, std::char_traitschar, std::allocatorchar const), referenced from: __gnu_cxx::new_allocatorstd::basic_stringchar, std::char_traitschar, std::allocatorchar ::construct(std::basic_stringchar, std::char_traitschar, std::allocatorchar *, std::basic_stringchar, std::char_traitschar, std::allocatorchar const)in build_geometry.o void std::_Constructstd::basic_stringchar, std::char_traitschar, std::allocatorchar , std::basic_stringchar, std::char_traitschar, std::allocatorchar (std::basic_stringchar, std::char_traitschar, std::allocatorchar *, std::basic_stringchar, std::char_traitschar, std::allocatorchar const)in build_geometry.o std::vectorstd::basic_stringchar, std::char_traitschar, std::allocatorchar , std::allocatorstd::basic_stringchar, std::char_traitschar, std::allocatorchar ::_M_insert_aux(__gnu_cxx::__normal_iteratorstd::basic_stringchar, std::char_traitschar, std::allocatorchar *, std::vectorstd::basic_stringchar, std::char_traitschar, std::allocatorchar , std::allocatorstd::basic_stringchar, std::char_traitschar, std::allocatorchar, std::basic_stringchar, std::char_traitschar, std::allocatorchar const)in build_geometry.o geos::io::WKTReader::WKTReader(geos::geom::GeometryFactory const*), referenced from: _parse_wkt in build_geometry.o geos::geom::GeometryFactory::createLinearRing(geos::geom::CoordinateSequence*) const, referenced from: _build_geometry in build_geometry.o _build_geometry in build_geometry.o _get_wkt_split in build_geometry.o _get_wkt_simple in build_geometry.o std::basic_stringchar, std::char_traitschar, std::allocatorchar ::length() const, referenced from: _get_wkt in build_geometry.o _get_wkt in build_geometry.o operator delete(void*), referenced from: __gnu_cxx::new_allocatordouble::deallocate(double*, unsigned long)in build_geometry.o __gnu_cxx::new_allocatorstd::basic_stringchar, std::char_traitschar, std::allocatorchar ::deallocate(std::basic_stringchar, std::char_traitschar, std::allocatorchar *, unsigned long)in build_geometry.o __gnu_cxx::new_allocatorgeos::geom::Geometry*::deallocate(geos::geom::Geometry**, unsigned long)in build_geometry.o __gnu_cxx::new_allocatorgeos::geom::LineString*::deallocate(geos::geom::LineString**, unsigned long)in build_geometry.o std::auto_ptrstd::vectorgeos::geom::LineString*, std::allocatorgeos::geom::LineString* ::~auto_ptr()in build_geometry.o std::auto_ptrstd::vectorgeos::geom::Geometry*, std::allocatorgeos::geom::Geometry* ::~auto_ptr()in build_geometry.o std::allocatorchar::~allocator(), referenced from: _parse_wkt in build_geometry.o _parse_wkt in build_geometry.o _xmlCleanupParser, referenced from: _main in osm2pgsql.o geos::geom::GeometryFactory::~GeometryFactory(), referenced from: _build_geometry in build_geometry.o _build_geometry in build_geometry.o _parse_wkt in build_geometry.o _parse_wkt in build_geometry.o _get_wkt_split in build_geometry.o _get_wkt_split in build_geometry.o