[postgis-users] Kyng chaos Postgis -- "PostGIS requires PostgreSQL 9.0."

2010-12-12 Thread fork
Hi all,

Not sure where else to ask -- I just installed Postgresql 9.0.1 from
the Kyngesbury site, now trying to install postgis, and I get this
error:

"PostGIS requires PostgreSQL 9.0."

Anyone have any ideas?  Does this mean "I can't find any postgres"? or
"I can't find the right version" or ???

Thanks!

-- 
Asking a question on a newsgroup?  Read this first:
http://www.catb.org/~esr/faqs/smart-questions.html
___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] Kyng chaos Postgis -- "PostGIS requires PostgreSQL 9.0."

2010-12-13 Thread fork
> That looks like it's straight from my OS X installer, so PostGIS itself 
> hasn't tried to run yet.
>
> The installer checks for the existence of 
> /usr/local/pgsql-9.0/lib/libpq.5.3.dylib.  Are you sure the Postgres install 
> finished and succeeded?

Yes, but it installs as an app, not in that directory

> Is this a new install or upgrade of Postgres/PostGIS?

New, and I *think* i used your binary.

> -
> William Kyngesburye 
> http://www.kyngchaos.com/
>
> "Those people who most want to rule people are, ipso-facto, those least 
> suited to do it."
>
> - A rule of the universe, from the HitchHiker's Guide to the Galaxy
>
>
>



-- 
Asking a question on a newsgroup?  Read this first:
http://www.catb.org/~esr/faqs/smart-questions.html
___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


[postgis-users] Geography type: centroids and distance?

2011-03-11 Thread fork
I have successfully loaded all the PUMA geographies in the US, and would like to
calculate their distance matrix.  Since st_distance on a polygon of these sizes
is sort of a nightmare, I thought I would calculate the centroid and then get
the distances between those.  However, st_centroid(geography, geography) is not
available  

So, is there a better way?  Should I reproject to 4326 and use
st_distance_sphere?  Or ???

Thanks to all the folks that have made such a cool thing as PostGIS happen!

___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] Geography type: centroids and distance?

2011-03-12 Thread fork
Sandro Santilli  keybit.net> writes:

> 
> > st_centroid(geography, geography) is not available  
> 
> You meant st_centroid(geography) I guess ?

Duh, yes.  st_distance(geography, geography) is avail just fine.  It was late...



___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


[postgis-users] Geocoder questions (PG 9.0/ Posgis 2.0 SVN)

2011-03-22 Thread fork
Hi all,

I am trying to install the geocoder on a windows machine (blech), using the
included batch file (yay).  I have a few questions One piece of background:
 I am running postgis within its own schema and setting search_path
appropriately; this usually works just fine, but it might be part of the problem
here.

Sorry for the generality of this post, but I can give more specifics/
cut-and-pastes later.

1.  I am getting an error to the effect that geometry type is not found in a
database, but I am able to find it with \dT and I have successfully installed
postgis in its own schema with search_path.  Any ideas?

2.  Is there a reason the install *.sql functions aren't wrapped in BEGIN/ END? 

3.  There are a couple of (other) typos and outdated things -- is there a place/
person to send a patch?

4.  Is this code now sort of officially in the PostGIS trunk?

Thanks again to all for the hard work!

___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] Geocoder questions (PG 9.0/ Posgis 2.0 SVN)

2011-03-22 Thread fork
fork  gmail.com> writes:

> 1.  I am getting an error to the effect that
> geometry type is not found in a
> database, but I am able to find it with \dT 
>and I have successfully installed
> postgis in its own schema with search_path.  Any ideas?

Well, I added the following to all the *.sql files 
cited in create_geocode.bat:

BEGIN;
SET search_path TO tiger,public,postgis;
\set ON_ERROR_STOP 1

... original file here ...

COMMIT;

And it seems to work, though I am currently loading 
a couple of states to play with.

Great job!  

___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


[postgis-users] geocoder loading

2011-03-22 Thread fork
When I run my batch file by double clicking, the dos prompt window disappears --
is this normal behavior for reaching the end of the file?

I am going to try it with my mingw git shell, and see if I get better behavior.

Thanks again!

___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] geocoder loading

2011-03-22 Thread fork
fork  gmail.com> writes:

> 
> When I run my batch file by double clicking, the dos prompt 
window disappears --
> is this normal behavior for reaching the end of the file?
> 
> I am going to try it with my mingw git shell, 

Seems like there are a few missing double quotes, which sort of wreaks havoc.  I
will try to edit and try again...

> Thanks again!
> 




___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


[postgis-users] "Linux" geocoder script ?

2011-03-22 Thread fork
I have got the geocoder loaded (thanks Regina), but I am a little bit baffled by
the output of the "Linux" script.

Is it supposed to be bash or sh?  Really there is no linux script...

Also, there is an error on the documentation page, unless I am mistaken:

TMPDIR="/gisdata/temp/

should be 

TMPDIR="/gisdata/temp/"

There are similar mistakes in the generated code...

I am missing something, or does this part of the geocoder need some love?  Is
anybody working on it already?

THanks to all for great stuff!

___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] "Linux" geocoder script ?

2011-03-22 Thread fork
Daniel Ball  gmail.com> writes:

> I had the same problem on my Linux install last week. Basically, I had
> to edit the bash script line-by-line to get it to work on my Fedora
> box. I plan on submitting my corrections/improvements when I find the
> time this week.

Cool, in the sense that I am not crazy

I will keep an eye out for your changes.

I wonder if it wouldn't be easier to track state-by-state loader scripts as
text; I tried looking at the sql functions and data to make this and my eyes
crossed just because of the quotes of quotes of quotes...  With bash/ sh there
are a lot of standard ENVARS that could be used (like TMP, HOME, etc), plus any
of the standard Postgres ENVARS.

> I'm impressed with the functionality of the geocoder and appreciate
> all the work that's gone into the geocoder, but to answer your
> question: yes, I think the loader needs some love :)

Heck yes -- Postgis + geocoder + raster is one of the poster children of the new
era.  I just want to do my little part

___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] "Linux" geocoder script ?

2011-03-22 Thread fork
Paragon Corporation  pcorp.us> writes:

> 
> Fork,
> 
> Haven't had a chance to test on Linux yet.  That's on my todo to fix the
> Linux, but sadly haven't gotten to it. 

It's all good!

I would think about the loader script pretty hard ... it is pretty far from
usable.  I would definitely call it "sh" not "linux" (don't want to piss off the
 BSD'ers or the SUN ^H^H Oracle folks).  Also, it looks like someone started to 
convert the bat file and then just stopped midstream (e.g. "%%z" for expanding 
the variable z -- that should be $Z in shell).  

If a big rework is in the pipeline, I would generate a header dynamically with
lots of variable assignments (UNZIPTOOL='blah.exe'), and keep the calls to
shp2pgsql, etc in a body that isn't changed at all but accesses everything with
variables.

Daniel -- could you post your edited script so we could take a look?  I promise
to do mine.

I have all sorts of additional issues, but some of them are due to the fact I am
trying to pretend my (work-issued) windows machine is a real operating system,
but it has the idiotic pathnames with spaces, etc.




___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] "Linux" geocoder script ?

2011-03-22 Thread fork
Paragon Corporation  pcorp.us> writes:

> 
> It shouldn't be too much of a rework.  Most of those things are in variables
> in the respective tiger tables.  

Yeah, storing the necessary pieces seems well thought out and straightforward. 
However, the code just isn't shell at all and there are a fair number of errors
(missing closing quotes especially, probably from the difficulty of juggling
quotes in the PL/PGSQL func, but also for loops are written in the MS DOS batch
style etc).

> I just haven't documented that piece well.
> So all the shp2pgsql calls are pretty generic and used for any of the
> scripts whether windows or sh.

I am not sure we would want to compensate for odd paths generally, but I know I
have postgres and postgis in nonstandard places and either have to fiddle with a
path variable or use full paths.  Right now I am leaning toward replacing psql
with "$PSQL" and assigning it at the top (need quotes to deal with "Documents
and Settings" in a path).

> But of course you know my little secret, I was born a windows
> administrator..  I use mostly windows :).  

Oh, but otherwise you're perfect ;)

If it is useful (maybe even if not), I will send my edited script to the list
once I am finished. 




___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] "Linux" geocoder script ?

2011-03-23 Thread fork
Paragon Corporation  pcorp.us> writes:

> One of these days hopefully soon, I'll dust off my OpenSUSE VM  and build
> PostGIS 2.0 and test Tiger geocoder on it.

I am going to try building this at home on a Unix machine at home, but between
the recent shp2pgsql bug, mingw, and the missing quotes, it just doesn't seem
worth forcing the issue on a windows box.

http://trac.osgeo.org/postgis/ticket/748


___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] "Linux" geocoder script ?

2011-03-25 Thread fork
fork  gmail.com> writes:

> 
> Paragon Corporation  pcorp.us> writes:
> 
> > One of these days hopefully soon, I'll dust off my OpenSUSE VM  and build
> > PostGIS 2.0 and test Tiger geocoder on it.

fork  gmail.com> writes:

> > One of these days hopefully soon, I'll dust off my OpenSUSE VM  and build
> > PostGIS 2.0 and test Tiger geocoder on it.

If anyone is interested, I have been working on an alternative script to import
Tiger, based on the output from the function that generates a script.  Its a
"gist" on github.

I have only tested it piecemeal, and it is currently bombing at "## create
address data, one per county" near the bottom (I think because the tiger parent
addr table doesn't match the table generated by shp2pgsql.

I will probably also add code to set up an optional basic geocoder install at
the top.

No warranty, blah, blah, blah.  

The idea is that you just change a few parameters at the top and then run it for
your state.  It would be *far* easier to write code to SQL to generate a bunch
of "X=Y\n" lines than what it does now.

I also prettified it and wrapped in BEGIN/END blocks whenever I thought 
possible.

Voila:  https://gist.github.com/885803

And if anyone has ideas or patches, please send them (it would be really cool to
figure out a "pull request" on github,...)



___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] "Linux" geocoder script ?

2011-03-26 Thread fork
Paragon Corporation  pcorp.us> writes:


> You might want to also look at the script in the legacy_import folder of
> tiger_2010.

> That was a script set up by Steve Frost for 2008 when he reworked the tiger
> geocoder to work with the new shp format.  We couldn't use that because the
> client we needed to get this to work for 
> Was a windows client and that script is Linux centric.

Yeah, I looked -- extremely interactive (yuck).  

(One pendantic note -- "sh" or "bash" are *Unix* centric, not linux -- they are
the standard on Freebsd, etc).

 
> So check out the function - loader_load_staged_data in tiger folder   and
> you'll see what I mean

I use  it -- I basically generated a script with the select statement and then
started to work it over.  I think the problem is that Tiger 10 has a very
different schema than the parent table in tiger_data.  Not sure yet

> > The idea is that you just change a few parameters at the top and then run
> it for your state.  It would be *far* easier to write code to SQL to
> generate a bunch of "X=Y\n" lines than what it does now.
> I like the idea of putting more parameters at the top, the reason we didn't
> and stored many of  the parameters in the table is because that is where the
> Linux/Windows/Unix code breaks apart and is different

I think the loader function can hide some of that. Also, there is no way to mix
batch and sh scripts, you might as well keep them totally separate...

> and our objective was
> to strive to create
> Something that could be used on all platforms (not just Linux).  Honestly
> that was our frustration with prior loader scripts is that most of our
> clients were on windows and needed it to work on windows and it didn't so
> they didn't use the geocoder.

I am glad those scripts work too.  The Unix / sh scripts though arent anywhere
near production ready.  Anywhere you see something like "%VAR%", that is a batch
file syntax that will throw an error in sh.  So, create_gecoder.sh just breaks
(I have a patch I will send later).
 
>   The only piece that is 
> truly cross platform is plpgsql (and also partly shp2pgsql) so that is why
> most of the variable specific stuff is kept in the tables 
> loader_platform, loader_variables
> 
> so that we could as much as possible abstract away the non-crossplatform
> commandline and not require people to install perl or any other additional
> items

In the unix world you can assume that a Posix "sh" is installed -- it's like the
.bat file of Dos/Windows -- you cant even boot without it.  That's what my
script is written it.

> 
> Thanks,
> Regina
> http://www.postgis.us

No, thank you for getting it this far! I would just like to be able to use it on
my favorite operating system too ;)

___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] Sorting/ordering linestrings

2011-03-30 Thread fork
Charles Galpin  lhsw.com> writes:

> Does anyone have any bright ideas on how to sort linestrings (with postgis 
>or  anything else for that matter).

You could sort them based on their beginning and ending lat's and long's, and
then connect them if they are within a certain tolerance, probably using 
a loop.  

You might also want to make a distance matrix and iteratively merge "close
enough" linestrings.

However, if you can give us some specifics about your problem (schemas, 
typical geometries and attributes) we might come up with something more
 useful and less hand-wavy.

> 
> Thanks,
> charles
> 




___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] add a rank to population statistics- is this a case for a sequence?

2011-04-07 Thread fork
Robert Buckley  yahoo.com> writes:

> 
> Hi,I have a table containing population statistics.I would like to have an
column which automatically updates the rank for each dataset. Would I somehow
use a sequence to calculate this, or is there another way to do this?thanks,Rob

Off the top of my head, I would build a trigger that updates the rank on any
insert/ update/ delete, and I would use  a "window function" [1] to determine
the new rankings.

A sequence just keeps incrementing dumbly, so it wouldn't be a good calculating
thing.

[1] http://www.postgresql.org/docs/current/static/tutorial-window.html



> 
> ___
> postgis-users mailing list
> postgis-users  postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
> 




___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] release of 2.0?

2011-04-08 Thread fork
Paolo Cavallini  faunalia.it> writes:

> Oh! Much later than I hoped - too bad.
> Thanks.

I find running the current version via SVN to be not very painful, and worth
trying if you need a special function.



___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] Geocoder (from extras)

2011-04-29 Thread fork
Paragon Corporation  pcorp.us> writes:

> Jonathan,

I don't know how useful, but here is (more or less) what I am using to load 
data:

https://gist.github.com/885803

It is the third file in this "gist", named "tiger_postgis_loader.sh"

You still have to edit the top to set up which state, but seems to work well.  I
will see if I have an update lying around on my home machine (Mac OS X with
newish GNU tools in /usr/local).

The other two files are to be used in working out a command line so one can load
with "load.sh --state=WA" and have it just work.  That isn't finished yet.

___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] Geocoder (from extras)

2011-04-29 Thread fork
fork  gmail.com> writes:

> 
> It is the third file in this "gist", named "tiger_postgis_loader.sh"

How about with the anchor link:

https://gist.github.com/885803#file_tiger_postgis_loader.sh

___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] Distance constraints on spatial points

2011-05-03 Thread fork
Sairam Krishnamurthy  gmail.com> writes:

> Any idea about how to place this distance constraint on
> the spatial point field?

A trigger in PL/PGSQL?

http://www.postgresql.org/docs/9.0//static/plpgsql-trigger.html

Sorry that I don't have a more developed example at hand.

___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] Distance constraints on spatial points

2011-05-03 Thread fork
Sairam Krishnamurthy  gmail.com> writes:

> 
> Thanks. But how do I specify the code to raise an error if the distance is 
> not met ? 

You probably want to write a PLPGSQL function with a SELECT statement that
returns the min(st_distance(NEW.the_geom, a.the_geom)), and raise an exception
if it is below a certain amount.  You might need to multiply by constants to get
the return value into your prefered units. Then you need to set up a trigger to
call it on an insert.

If you don't know how to write PLPGSQL, you need to learn ;)... or maybe
somebody else can help with example code, but even more or less knowing how to
do it, it would take me an hour to write working code, and I cant spare the time
(tho it would be fun).

Or you need to ask a more specific question after posting the code you have
tried -- that would be best.


___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] Distance constraints on spatial points

2011-05-03 Thread fork
fork  gmail.com> writes:

> 
> Sairam Krishnamurthy  gmail.com> writes:
> 
> > 
> > Thanks. But how do I specify the code to raise an error if the distance is 
> > not met ? 

This might help:
 
> You probably want to write a PLPGSQL function with a SELECT statement that
> returns the min(st_distance(NEW.the_geom, a.the_geom)), 

http://www.postgresql.org/docs/9.0//static/plpgsql-statements.html#PLPGSQL-STATEMENTS-SQL-ONEROW

> and raise an exception
> if it is below a certain amount.  

http://www.postgresql.org/docs/9.0//static/plpgsql-errors-and-messages.html


___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] Bounding box intersect on multiple spatial tables

2011-05-24 Thread fork

> What I don't know how to do is to write a query that retrieves
> ALL spatial data (point, line and polygon layers/tables) in the database 
> within
> the specified search area.

My first thought is that you need to query the system tables to get a list of
tables and geo columns in (say) a schema dedicated to handling arbitrary data  .
 Then for each data table, you can create a dynamic query using the returned
table and column names and a bounding box or st_within() function.  Then you can
execute that and append it to a list that the user choose from.  You would need
to do it in a procedural language so that you can dynamically create a SQL
string and execute it -- PL/PGSQL would be my choice -- read the postgres docks
for looping and dynamic queries. 

Sorry that that is a bunch of handwaving -- I don't think this is a trivial
exercise, so I can't knock out the code.  

Here is an example of querying system tables, though: 

select * from information_schema.tables where table_schema =
'data_tables_of_possible_interest'.

If you are going to be adding lots of tables, it might be worth keeping a meta
table with their bbox, a description, etc; then you could just query that.  You
would have to maintain it along with each table change, though.

___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] Tiger Geocoder 2010 setup issues

2011-06-28 Thread fork
Daniel Weitzenfeld  gmail.com> writes:

> 
> Hi,
> I'm trying to setup the TIGER Geocoder, following the readme here:
> http://svn.osgeo.org/postgis/trunk/extras/tiger_geocoder/tiger_2010/README
> I'm setting it up on a centos 5.5 server.

As a completely different approach, not yet organized, here is some code I 
wrote:

https://gist.github.com/885803#file_tiger_postgis_loader.sh

It probably won't run as-is, or be completely obvious, and it will probably
require you edit which state you are downloading near the top of the script, but
it might be helpful nevertheless.  I would happily answer any questions about
it.  I had hoped to get it to be purely command line driven (instead of fiddling
with variables in the script itself), but I haven't had time.

___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] PostGIS query layer in ArcMap - error readingOID

2011-07-08 Thread fork
Paul Ramsey  opengeo.org> writes:

> 
> Well you should certainly be able to work around it by creating your
> table using the "WITH OIDS" keywords to enabled OIDs on that table.

http://www.postgresql.org/docs/9.0/static/sql-altertable.html

search for "set with oids"

> Just shame you would have to.

It's not like ESRI actually wants anybody to use PostGIS, much less discover how
much easier it is than their garbarge 

___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


[postgis-users] Tiger Geocoder return values

2011-08-16 Thread fork
Hi all,

Using the tiger geocoder, I basically want to update a table with addresses to
also include the geocoded points.  While the example in the docs definitely
works, it is a bit convoluted and tricky.  So here is my first question:  Does
anyone have a simpler pattern they follow when updating a table with geocodes
than the multiple CTE's and subselects and aliasing used in the example?

I have also been thinking about a couple of different approaches and wanted to
know if anyone thought they would be useful:

1.  How about a polymorphic version of geocode() that returns a "geocode" type
basically defined as {norm_addy, rating, geomout}?  Then one could have a column
in a table, run an update statement like 

create table mytab (addr text, mygeocode geocode, mypoint geom);
UPDATE mytab set mygeocode=geocode(addr, 1);
UPDATE mytab set mypoint=mygeocode.geomout where mygeocode.rating<10;

I could write such a thing and submit a patch -- it would be a new couple of
functions and a type definition I think.

2.  Alternatively, one might also write a polymorphic version which allows one
to pass through an ID that is given a column in the return table; one could use
this to join directly after creating the geocode table.  

Any thoughts?  Would this be useful?  Any improvements to the above ideas that
might be nice?  I might not be thinking through the problem of returning
multiple rows and types enough

And Regina -- I will send you my name once I dig up your email.  We have
corresponded before.  I have nothing particularly interesting to hide, I just
hate to see my stupid questions all attached to my real name ;).

___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] OT Understanding slow queries

2011-08-25 Thread fork
Charles Galpin  lhsw.com> writes:

> explain select count(l.*) 
> from links l, source_link ld where l.link_id = ld.link_id;

Can you try this returning some sort of value (like the keys) instead of a
count(*)?  count(*) can be pretty slow in Postgres, sometimes 
(I think) forcinga seq scan.

I am not particularly confident this will fix your problem, 
but it is worth a shot.

I would also experiment with DISTINCT and LIMIT, after
 making sure ANALYZE has been run appropriately.

___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] OT Understanding slow queries

2011-08-25 Thread fork
Ben Madin  remoteinformation.com.au> writes:

> does this just apply to count(*), or is count(id) just as bad? I was
originally a MySQL user and count(*)
> could be very efficient there.

My understanding is that Postgres does not keep record length for any of its
tables internally, so there is no way to get a count without seq scanning.  The
trade off is that inserts deletes are faster but a very common query is much
slower.  I don't know if the planner could benefit in any way from the count
being available, though.

The lists say to use a trigger on inserts and deletes to update a metadata table
if you really do need to know how many elements are in it exactly, but that is a
far less frequent need than you may think (for example an EXISTS can get you an
answer to "are there any records" more quickly than a count(*)).  I think you
can do a quick and rough estimate by doing some math with the table size on
disk, but I never have.  

It is unfortunate that the first (rather lame) "benchmark" anyone tries to do
with a new database is run "select count(*) from x" -- I am sure lots of people
have been turned off from PG because this particular query is slow compared to
MySQL. 

(MySQL always wins in the more hollywood competitions against PG, but fails in
the long run, IMHO) 



___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] OT Understanding slow queries

2011-08-25 Thread fork
Charles Galpin  lhsw.com> writes:


> All of your feedback has been most helpful.  Yes this query is contrived but I
*thought* it was
> representative of a worst case scenario that might be similar to future data
sets and it's likely not.  

I think we are all glad to help.  The count(*) assumption is reasonable enough
to be made by LOTS of people.  

One thing -- while we hope that you ask lots of questions on this list, would
you not "top posting", and trimming out non-germane text?  Threading and
trimming make a conversation MUCH easier to follow.

Also -- if you are developing an app that will be rolled out later or that is
somewhat academic, I would consider Postgres on trunk if it has features you
really need.  It is easy to build, just make sure you back up your data...



___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] OT Understanding slow queries

2011-08-25 Thread fork
Charles Galpin  lhsw.com> writes:

> My apologies

Hehe -- none necessary -- welcome to the light side. 

> I would consider Postgres on trunk if it has features youreally need.
> 
> Sadly it's for immediate production use and I'm forced to use windows which
limits my version choices a bit given my lack of skill under windows to build
postgis :(

Yeah, so much for index only queries ;)

You ask interesting questions -- don't be a stranger.


___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] PostGIS 2.0.0 Released

2012-04-03 Thread fork
Paul Ramsey  opengeo.org> writes:

> PostGIS 2.0.0 is complete and available for download.

Hats off to everyone -- this is a big day!

___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] Editing with arcgis without ArcSDE

2012-04-04 Thread fork
Robert Buckley  yahoo.com> writes:

> Anyway. does anyone else know of any other software tools that
>  enable connections with ArcGIS for editing geometries?
> 
> Thanks for any tips,

QGIS edits postgis layers pretty well, in my limited experience.  That is no
help if you are committed to ArcGI$, but it's free so it might be worth a try. 
I  have had better luck with the  development build rather than the stable
build, and you can choose it on the OSGEO installer thingy.

> 
> Rob
> 
> 
> ___
> postgis-users mailing list
> postgis-users  postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
> 




___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


[postgis-users] DE-9IM question

2012-05-08 Thread fork
Does anyone know of an exhaustive reference of DE-9IM matrices, with pictures?

Context:

I just finished classifying a bunch of polygons based on their relationship to
enveloping poly's in another layer (census blocks and census city boundaries,
respectively).  The regular old st_within() and friends weren't enough, so I
calculated all the DE-9IM's, counted them (yay for GROUP BY and real
databases!), and made sure I knew what was going on for each of the matrices
returned (7 total).  Then I classified my block polys based on the strings.

I found it CRAZY how many different types of DE-9IM's could be returned, even
with just polygons and very well aligned boundaries (credit to the US Census
Bureau's geography division).  Only a few of the matrices in my data were
actually described in the few docs I could find.  Besides the seven in my data,
there are at least four more that can be generated by various combinations of
overlapping polygons.

It would have been much easier to do this project if I had been able to
reference a list of possibilities along with pictures.  It would be even better
if I could be confident that such a list was exhaustive.

Does anyone have a reference?

If not, I could continue to work on an atlas of DE-9IM matrices, at least for
polygons, and submit it somewhere if it were helpful.  Any ideas for where that
might go? (I don't have a blog and don't want to start one).  Maybe just the
wikipedia entry?

For those who don't know, a DE-9IM matrix is the output of st_relate(geo1,
geo2), and there is an excellent intro in the docs.  Fascinating stuff really.

Tx

___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] DE-9IM question

2012-05-08 Thread fork
Sandro Santilli  keybit.net> writes:

> http://en.wikipedia.org/wiki/DE-9IM
> http://postgis.org/documentation/manual-svn/using_postgis_dbmanagement.html#DE-9IM

Those either aren't exhaustive (postgis) or don't have pictures (wiki).  I would
like to be able to look up "FF2F1F212" and see a picture of it. 

I think a difference is that I am not interested in using a matrix to implement
a function like st_within(), but rather I am querying a database looking for
relationships and how to deal with them.  In my case, also, the query will never
return a string with wildcards in it, because it will give me the exact
relationship. (Maybe the above links are exhaustive if you count wildcards,
though...)

Sorry -- I tried to make clear that I had already read the docs that are easily
available.  Thanks for the explicit links though.

___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] DE-9IM question

2012-05-08 Thread fork
fork  gmail.com> writes:

> I found it CRAZY how many different types of DE-9IM's could be returned, even
> with just polygons and very well aligned boundaries (credit to the US Census
> Bureau's geography division).  Only a few of the matrices in my data were
> actually described in the few docs I could find.  

For a flavor, look at Table 3 here:

http://www.cise.ufl.edu/~mschneid/Research/papers/BS01ER.pdf

Note that these matrices are boolean for the intersection, and there are 32 of
them.  One can tweak them so that the max dimension on the boundaries is either
0 (a point) or 1 (a line) and create more matrices using the full definition of
DE-91M; see #33.

I am mostly just entertaining myself with mathematical patterns, but I think the
topological matrices might be useful in trying to figure out how to simplify
slivers and weird things.

I also think one's intuition about "within" might not stand up to closer
scrutiny via mathematical formalisms like this.  The only way I could figure out
my blocks-in-cities problem was to abandon st_within() etc and go for a list of
specific DE-9IM's based on the data.

If I feel bored/ ambitious I will try to create a useful atlas.  I don't think
one exists...

___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] DE-9IM question

2012-05-09 Thread fork
Martin Davis  telus.net> writes:

> 
> Have a look at:
> 
> http://www.vividsolutions.com/jts/tests/index.html
> 
> This is a visual interface to the JTS Test Suite, which has a very 
> complete collection of DE-9IM cases.  

Interesting!  Seems exhaustive to me.  Two comments:  Did you prove
exhaustiveness - seems like there should be a way to make a combinatorial
argument about how many possible Clementini matrices are possible (9^4 == 6561,
less impossible combinations)?  Also - it might be easier to do confirm
exhaustiveness with simpler shapes, at least for part of the tests.  Still,
looks great, and comforts me that you are testing that hard. 

> As was mentioned, you can use the JTS TestBuilder to build and inspect 
> test  cases.  You can drag-and-drop Test Suite XML files onto the 
> TestBuilder, so it's easy to inspect the cases in the XML tests.

That is cool!

> I'm not sure if Wikipedia would appreciate being flooded with DE-9IM 
> test cases - it doesn't seem like quite the right place for it.  The 
> Vivid site is a good reference as long as it stays up.

I will continue to think about this.  I probably don't have time to do fiddle
with this in any systematic way, but a table with every possible matrix, a
picture, and simple code to generate it might be pretty useful.
 

___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


Re: [postgis-users] importing excel spreadsheet

2012-07-24 Thread fork
Kauth, Matthew  eb.com> writes:

> Hi all.  I’m working on a project with my job and have created an excel 
> spreadsheet consisting of over 1000 polygon coordinates.  
> Per postgres I have 
> the coordinates in the following fashion 
> long,lat;long,lat;long,lat,  and so on.

What do you mean "per postgres"? This format isn't a standard that I know of.  A
link would be interesting.
  
> My question, if someone can help, is how do I import this
> spreadsheet into 
> postgres 9.1?

In outline, in case you have never done this before:

* Save the spreadsheet as tab-delimited text (Excel == yuck).  

* Process this file to change the coordinates into "well known text" format (I
would script the conversion with awk) and save as a new file.  Script little
clean ups here as well.

* Open the new text file in a real text editor to inspect and clean.

* Load this new file into Postgres with the COPY statement.  

* Then convert the WKT column to a geometry column with ST_GeomFromEWKT().

WKT example:
http://postgis.refractions.net/documentation/manual-svn/using_postgis_dbmanagement.html#OpenGISWKBWKT

If you get stuck, try to give us an example of your data (cut and paste or use
pastebin) and what steps exactly you are doing.  If the above doesn't make any
sense or is too high level, ask more specific questions about each step.  Note
that I am assuming you have access to a functional Unix-like command line.  If
not ... get a real computer ;) ...



___
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users