[postgis-users] unique id in QGIS/PostGIS

Margie Roswell mroswell at gmail.com
Sat Apr 6 07:31:56 PDT 2013


Thanks. I went ahead and created the primary key as directed. Still no
luck. I created this mini-screencast so you can see what I'm talking about
http://screencast.com/t/9WMkHN56e

and adding on a few more seconds, here:
http://screencast.com/t/DCjs2OXsew

and a quick screenshot here, showing the data
http://screencast.com/t/fImccBVh

(sorry, I didn't get all that in one pass.)

I should add that the original Maryland Legislative district is here:
http://planning.maryland.gov/PDF/Redistricting/2010zip/Legislative_shape.zip

The PRJ file reads as follows
GEOGCS["GCS_GRS_1980",DATUM["D_GRS_1980",SPHEROID["GRS_1980",6378137,298.2572221]],PRIMEM["Greenwich",0],UNIT["Degree",0.0174532925199433]]


Oddly enough, also, the legislature_final file ALSO doesn't list primary
key, but it displays anyhow. In this case, I've selected the ones with area
> 25, because I thought they'd be more likely to buffer successfully...

Anyhow, maybe with the mini-video screencast, it'll be easier to see what
I'm talking about.

Margie



Margie

--
http://FarmBillPrimer.org
http://www.BaltimoreUrbanAg.org (Please send events; This site is hungry.)
http://www.ExcellentNutrition.org
http://www.packtpub.com/drupal-5-views-recipes/book


On Sat, Apr 6, 2013 at 9:28 AM, Richard Greenwood <
richard.greenwood at gmail.com> wrote:

>
> On Sat, Apr 6, 2013 at 2:18 AM, Margie Roswell <mroswell at gmail.com> wrote:
>
>> I've been googling up a storm, now that I've got a local postgis database
>> with QGIS. But still haven't figured out how to display a newly created
>> table.
>>
>> The query I used to create the table:
>> CREATE TABLE smaller_leg_final AS
>> SELECT ST_Buffer(geom,-500) AS geom, legislative_final.district
>> FROM legislative_final
>> WHERE area > 30;
>>
>> I then discovered that I needed a unique ID, and did the following:
>> ALTER TABLE smaller_leg_final ADD COLUMN id serial not null;
>>
>
>
> Why don't you try making you unique column a primary key?
>
> ALTER TABLE smaller_leg_final
>   ADD CONSTRAINT smaller_leg_final_pk PRIMARY KEY(id);
>
> Rich
>
> _______________________________________________
> 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/20130406/59e47305/attachment.html>


More information about the postgis-users mailing list