[OSM-dev] help with PostGIS and/or PostgreSQL queries?

2017-07-31 Thread Rich Morin
# Background

The Muddy Map Explorer will support text-based exploration and navigation
of map data, making it accessible to blind and visually disabled users.  The
user interface will be patterned after MUDs (Multi-User Domain games), REPLs
(Read, Eval, Print Loops), etc.  It will let users explore a mapped area at
various scales, getting descriptions of streets, amenities, etc.

Using osm2pgsql, I've set up an exploratory database containing pretty much
every possible relation and column, based on Geofabrik data on Texas and
California (where my collaborator and I, respectively, live).  So, I've got
a nice pile of data to play with.  However, I'm still a newbie at this, so
I need help in developing some database queries.


# Finding Nearby Ways

Given a geographic location, it should be possible to find nearby ways, using
only PostGIS and PostgreSQL.  This would help us to get a working set of ways
(and indirectly, nodes) for the user to explore.

I found a few notions that seem tantalizingly close, but no exact matches:

- Find nearest neighbours faster in PostGIS
  
https://gis.stackexchange.com/questions/63667/find-nearest-neighbours-faster-in-postgis

- How Do I Find The N Nearest Things To This Point In PostGis
  https://boundlessgeo.com/2011/09/indexed-nearest-neighbour-search-in-postgis

- PostGIS / OSM: Faster query to find nearest line of points
  
https://gis.stackexchange.com/questions/207592/postgis-osm-faster-query-to-find-nearest-line-of-points

- Spatial Relationships and Measurements
  http://postgis.refractions.net/documentation/manual-svn/ST_DWithin.html

Q: Is there an efficient way to find nearby ways for a location, using just
   PostgreSQL and/or PostGIS?


# Tracking cities, etc.

We'd like to be able to tell the user the current location, in human-friendly
terms.  Although we may know the starting location, traveling even a short
distance could put the user into a different city, county, or country.

We can't pester a geocoding service each time the user moves (and don't want
to install and maintain Nominatim if we don't have to), so we need a local
solution.

A brute-force approach would be to look for nearby nodes that have TIGER
(or equivalent) attributes.  If the current location is "close enough" to a
known address, that may be sufficient to our needs.

Q: Is there an efficient way to get the administrative region for a location,
   using just PostgreSQL and/or PostGIS?

-r

 -- 
http://www.cfcl.com/rdm   Rich Morin   r...@cfcl.com
http://www.cfcl.com/rdm/resumeSan Bruno, CA, USA   +1 650-873-7841

Software system design, development, and documentation



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


[OSM-dev] looking for some spline code to adapt

2017-07-02 Thread Rich Morin
I'm generating sets of tactile maps for a blind friend, as follows:

  OSM export files -(Ruby)-> PostScript -(lpr)-> swell paper

I'm using straight lines for the roads, using the PostScript moveto
and lineto operators.  However, I'd like to use the curveto operator:

  x1 y1 x2 y2 x3 y3 curveto -

  This operator draws a curve from the current point to the point (x3, y3)
  using points (x1, y1) and (x2, y2) as control points. The curve is a
  Bézier cubic curve. In such a curve, the tangent of the curve at the
  current point will be a line segment running from the current point to
  (x1, y1) and the tangent at (x3, y3) is the line running from (x3, y3)
  to (x2, y2).

  -- http://www.tailrecursive.org/postscript/operators.html

I'm not sure what the best starting point would be for this.  I found this
Perl code, but it seems a bit dated:

  http://wiki.openstreetmap.org/wiki/Osmarender/BezierCurves

Clues, comments, and suggestions?

-r

 -- 
http://www.cfcl.com/rdm   Rich Morin   r...@cfcl.com
http://www.cfcl.com/rdm/resumeSan Bruno, CA, USA   +1 650-873-7841

Software system design, development, and documentation



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


Re: [OSM-dev] Application for Google Summer of Code 2016

2016-03-04 Thread Rich Morin
FYI, the Elixir folks have set up a wiki page for back-up mentors:

  The following members of the Elixir community
  are willing and able to help with mentoring:

  -- https://github.com/elixir-lang/elixir/wiki/Mentors

-r

 -- 
http://www.cfcl.com/rdm   Rich Morin   r...@cfcl.com
http://www.cfcl.com/rdm/resumeSan Bruno, CA, USA   +1 650-873-7841

Software system design, development, and documentation



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


[OSM-dev] creating OSM-based tactile maps

2015-12-01 Thread Rich Morin
I'm hoping for some suggestions on how to get from OpenStreetMap
data to tactile maps for use by blind or visually impaired users.
See below for a bit of background information and some qustions.

-r


Background

I'm involved in a project to generate tactile maps for use by blind
or visually impaired users.  Currently, these are being fabricated
by laser engraving from acrylic plastic, but I'm considering other
options for reduced-cost duplication, etc.

As an exploratory exercise, I used SketchUp's Pencil tool to trace
some floor plans of a building, then used its 3D Fonts tool to add
Braille annotations.  I then exported a set of PDF files, imported
them into Adobe Illustrator, and used them to drive the engraver.

This produces reasonable results, but I'd like a more mechanized
approach.  I'd also like to take advantage of OSM's infrastructure
and data, wherever appropriate.  Ideally, I'd like to put together
a mostly automated way to go from OSM's XML-based data format to
engravable images.

FWIW, I have skimmed a couple of books on OpenStreetMap:

  OpenStreetMap: Be your own Cartographer
  Bennett; Packt, 2010

  OpenStreetMap: Using and Enhancing the Free Map of the World
  Ramm, Topf, and Chilton; UIT, 2011

However, as these books are a bit dated, the tools they mention
(eg, Mapnik, Osmarender) may have been supplanted.  So, I'm open
to other suggestions!


Questions

What tool(s) would you suggest for:

  extracting all of the nodes (etc) within a polygon?

  rotating the map data (eg, to make a given street vertical)?

  rendering a map in PDF (eg, for use by Illustrator)?

More generally, are web-based tools (eg, CSS, SVG, XSLT) still
recommended as infrastructure for mechanically processing OSM
data into rendered images?

 -- 
http://www.cfcl.com/rdm   Rich Morin   r...@cfcl.com
http://www.cfcl.com/rdm/resumeSan Bruno, CA, USA   +1 650-873-7841

Software system design, development, and documentation



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