[postgis-users] Simple Line Density

John Callahan john.callahan at udel.edu
Mon Dec 24 06:39:02 PST 2012


I had the same problem.  I ended up using the Quantum GIS function, Sum
Line Lengths.  Input can be your postgis line features.  It adds up the
lengths of the portion of each line that crosses a particular grid cell.
 You need to create a polygon fishnet matching your raster extent and
resolution first, then convert to raster.  This might actually be a better
measure of density then counting lines.

- John


John Callahan
Research Scientist
Delaware Geological Survey
University of Delaware
http://www.dgs.udel.edu
john.callahan at udel.edu



On Sat, Dec 22, 2012 at 9:57 PM, Jeff Adams - NOAA Affiliate <
jeff.adams at noaa.gov> wrote:

> Thanks for the response Stephen.I will have upwards of 150,000 lines
> features that I will want to feed into the density. These are stored in a
> single table (actually will be in a CTE), and many of the lines will
> overlap one another. It is hard to say whether these solutions are viable
> as I am having a hard time visualizing the SQL. You would think that I am
> not the first person who has wanted to do this in PostGIS, but I haven't
> found example one.
>
> On Sat, Dec 22, 2012 at 6:02 PM, Stephen Woodbridge <
> woodbri at swoodbridge.com> wrote:
>
>> On 12/22/2012 3:07 PM, Jeff Adams - NOAA Affiliate wrote:
>>
>>> Hi,
>>>
>>> I was wondering if anybody knew of a way to create a very simple line
>>> density raster. I am not interested in interpolation or clustering,
>>> simply how many line features pass through each pixel in the raster. I
>>> know how to do this with points, but am having difficulty figuring out
>>> how to do it with lines. Any help would be greatly appreciated...
>>>
>>
>> Separate from the SQL, you probably need to have a strategy for doing
>> this. so with a point I assume you just increment the point in the raster
>> for each point. So with a line we want to increment the all the raster
>> points along the line. Some options:
>>
>> 1. render the line into an empty raster then add that raster to your
>> master raster. Where add will increment by one every set  raster point in
>> the rendered line.
>>
>> 2. segmentize the line into segments that are the size of a pixel in your
>> master raster and then add the midpoints of those segments to your master
>> raster.
>>
>> Would one of these work for you?
>>
>> -Steve
>>
>> ______________________________**_________________
>> postgis-users mailing list
>> postgis-users at lists.osgeo.org
>> http://lists.osgeo.org/cgi-**bin/mailman/listinfo/postgis-**users<http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users>
>>
>
>
>
> --
> Jeffrey D. Adams
> Contractor
> OAI, Inc.
> In support of:
> National Marine Fisheries Service
> Office of Protected Resources
> 1315 East West Hwy, Building SSMC3
> Silver Spring, MD 20910-3282
> phone: (301) 427-8434
> fax: (301) 713-0376
> _______________________________________________
> postgis-users mailing list
> postgis-users at lists.osgeo.org
> http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20121224/a5677337/attachment.html>


More information about the postgis-users mailing list