[postgis-users] Programmatically generate maps zoomed to extent of shapes?

Martin Davis mbdavis at refractions.net
Fri Sep 24 08:50:55 PDT 2010


  Try looking at Mapnik.  This is what OpenStreetMap uses to generate 
its tiles.  I believe it exposes an API (or at least a cmd-line interface)

On 9/22/2010 8:35 PM, John Poole wrote:
> I'm preparing walk lists for a campaign which contains a table of
> addresses, about 35 to a page on 8.5" x 11" paper.  I have the
> addresses tied into a postgis database with roads and assessor's
> parcels, so for a given page, I can get a handle on the IDs of the
> associated shapes.
>
> What I'm wondering is would it be possible to generate a map in SVG or
> PNG/TIFF that would measure 8" x 10.5" and be zoomed to a level that
> would just include the most opposite parcels.  I gather I could define
> a shape that is all inclusive of the list of shapes for a particular
> page, but can I then take the coordinates or whatever information
> derived and submit it to a renderer which then creates a zoomed image
> of defined dpi (if PNG or TIFF) that would be a representation of a
> view of all parcels.
>
> For example, I have a list of addresses, being 35 representing 3 1/2
> city blocks:
>     200 Main Street
>     204  "       "
>     ...
>     535  "      "
>
> All of the above addresses tie into specific shape IDs in postgis.
>
> I'd like to have a map which would then display a zoomed level so that
> the parcel of 200 is leftmost and parcel 535 is rightmost of the
> image.  This map would be generated on the fly without human
> intervention, in other words generated by script.
>
> I'm getting my feet wet with various renderers,  but have not seen any
> that might be manipulated or controlled programmatically so that mapes
> could be generated by scripting.
>
> What I am envisioning is having a map of the parcels on the back side
> of a previous page representing an view of the current page.  So, if
> page three (3) contains the above addresses, the back side of page two
> (2)would have the map showing all parcels tied to the addresses of
> page three.   That way someone looking at the list on page three could
> hold up the back side of page 2 in a binder and view a map zoomed to
> the right level containing all the parcels referenced on page three.
>   I'd prefer to use my own data from postgis, I think this kind of
> generation would be possible with the Google maps API and possibly
> creating a container shape that bounds all the shapes from the list.
>
> It would be helpful to learn of any renderers, especially ones that
> expose an application interface.
>
> (Hmmm.. now I'm thinking I could generate a large image file of
> certain sectors and if I could tie the pixels, I could use ImageMagick
> to slice and dice what I need.)
>
> Any rate, this is a wild inquiry which might garner some attention and
> generate some responses about renderers, especially ones with exposed
> APIs so they can be manipulated programmatically.
>

-- 
Martin Davis
Senior Technical Architect
Refractions Research, Inc.
(250) 383-3022




More information about the postgis-users mailing list