Re: [postgis-users] Converting Multilinestrings to Linestrings
Leigh, If your multilinestrings contain more than one linestring each, then use ST_Dump instead of ST_GeometryN. You'll probably want to create a new table as well to explode the single row into multiple rows. Then to insert into the new table the insert would be INSERT INTO newtable(field1,field2, original_gid, the_geom) SELECT field1, field2, gid, (ST_Dump(the_geom)) .geom FROM oldtable; http://www.postgis.org/documentation/manual-svn/ST_Dump.html Leo and Regina http://www.postgis.us -Original Message- From: postgis-users-boun...@postgis.refractions.net [mailto:postgis-users-boun...@postgis.refractions.net] On Behalf Of strk Sent: Friday, May 07, 2010 6:06 AM To: PostGIS Users Discussion Subject: Re: [postgis-users] Converting Multilinestrings to Linestrings On Fri, May 07, 2010 at 02:57:09AM -0700, Leigh Holcombe wrote: > Is there a way to force linestring data to be imported as a linestring > instead of as a multilinestring? Yes, shp2pgsql -S > Is there a way to transform all the multilinestrings in a dataset into linestrings? 1. Drop the type constraint (enforce_geotype_) 2. Update the geometries 3. Re-insert the type constraint 4. Update the geometry_columns record > Is there a way to convert a multilinestring into a linestring easily > and quickly on the fly (I'm doing PHP/LAPP programming)? ST_GeometryN(the_geom, 1) gives you the first LINESTRING of the (pseudo)set. --strk; () Free GIS & Flash consultant/developer /\ http://strk.keybit.net/services.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] getting past the 254 character limit of .DBFs
Have you thought about Sqlite/Spatialite? It gives you a single-file relational database without the .dbf limitations. You can import shapefiles, edit the data in QGIS or other applications. You can hit it with tabular and spatial queries from several programming languages, etc. David. On Fri, May 7, 2010 at 3:09 PM, Stephen Woodbridge wrote: > David Benjamin Lang Lang wrote: >> >> I'm trying to join a table to a shapefile. This table has three or >> four columns that are longer than the 254 character limit, so when I >> convert the table into a .DBF I lose a large portion of my data. I >> had hoped to use pgsql2shp as a work-around but that didn't work. >> >> My end product will eventually be displayed online, so I'm thinking >> that I could connect to the data using the webpage rather than the >> map, and use the map as the method for linking the two, but I'd >> rather not have to make each of the offending cells contain a refence >> to another table. >> >> Aside from postgres and postgis I've been using ArcMap and ArcCatalog >> along with Excel. >> >> Any help is appreciated. David > > The 254 char limit is just that! It is a limit in the spec you can not get > around it in a shapefile. I think DBF file have the ability to define a memo > field that can hold large blobs of text, but I have never seen one in a > shapefile and I'm not sure that they are even support in the shapefile spec. > > You probably need to think about solving this problem outside the domain of > shapefiles. > > -Steve W > ___ > 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] getting past the 254 character limit of .DBFs
David Benjamin Lang Lang wrote: I'm trying to join a table to a shapefile. This table has three or four columns that are longer than the 254 character limit, so when I convert the table into a .DBF I lose a large portion of my data. I had hoped to use pgsql2shp as a work-around but that didn't work. My end product will eventually be displayed online, so I'm thinking that I could connect to the data using the webpage rather than the map, and use the map as the method for linking the two, but I'd rather not have to make each of the offending cells contain a refence to another table. Aside from postgres and postgis I've been using ArcMap and ArcCatalog along with Excel. Any help is appreciated. David The 254 char limit is just that! It is a limit in the spec you can not get around it in a shapefile. I think DBF file have the ability to define a memo field that can hold large blobs of text, but I have never seen one in a shapefile and I'm not sure that they are even support in the shapefile spec. You probably need to think about solving this problem outside the domain of shapefiles. -Steve W ___ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users
Re: [postgis-users] Dot Density idea
Martin, Assuming you wanted feedback - from an epidemiologists perspective, I like the first one - Complete Spatial Randomness is an important concept to avoid engendering a perception of order or clustering, and I'm thinking as long as the relative 'dot-density' is correct for each polygon, the CSR approach is less like to lead people to think the dots are located on significant points - in the context of obscuring actual locations etc this is important. If you want it more regular, then maybe you don't need to randomise it - or maybe this just means the function needs a user parameter to be able to set the level of randomisation - From 0 (completely ordered) to 1 (completely Random) (... to 2.5 completely clustered?) Just my thoughts - also for my money, I wouldn't change dot sizes. very confusing. cheers Ben On 07/05/2010, at 6:11 , Martin Davis wrote: > Check out this blog post for some images of different kinds of random point > fields: > > http://lin-ear-th-inking.blogspot.com/2010/05/more-random-points-in-jts.html > > Martin Davis wrote: >> Sounds like it could work - with maybe a bit of fiddling to deal with cases >> where the grid cells overlapped the polygon only slightly? >> Random perturbation by cell radius can still result in some points being >> very close together. (And I think this would also be an issue where only a >> small part of each grid cell overlapped the polygon). This may or may not >> be desirable. Perhaps a further check could be made to reduce the radius >> for points where this occurs. Or maybe some sort of simulated annealing >> process could be use to push the points into a more even distribution. >> >> M >> >> Paul Ramsey wrote: >>> Even-yet-random :) nice requirement. How about just starting with a >>> regular grid and then perturbing the elements randomly with a radius >>> of a cell size? You can use the area of the polygon and number of >>> needed points to calculate the appropriate cell size and go from >>> there. >>> >>> P >>> >>> On Thu, May 6, 2010 at 10:28 AM, Martin Davis >>> wrote: >>> Good point about the need for even distribution of the points. That seems like a whole lot harder to code than simply randomly placing points in a polygon. Does anyone have any pointers to algorithms for producing this effect? George Silva wrote: > The really big problem with dot density is that dots can overlap > themselves, > masking the real number, so if anything will be developed in this area, > the > points should be > > A) evenly distributed > or > B) randomly distributed, but with some sort of "colision" tests, so there > is > no or little overlap. > > This is a interesting idea, especially if we could make a materialized > view > with those points, which could be added to GIS software for presentation. > > George > > On Thu, May 6, 2010 at 1:53 PM, Sufficool, Stanley < > ssuffic...@rov.sbcounty.gov> wrote: > > > >> Looks nasty, but it might work: >> >> select >> st_line_interpolate_point( >> st_intersection( >> the_geom, >> st_makeline( >> st_pointn(st_exteriorring(the_geom), (rand1.rand * >> st_npoints(st_exteriorring(the_geom)))::int), >> st_pointn(st_exteriorring(the_geom), (rand2.rand * >> st_npoints(st_exteriorring(the_geom)))::int) >> ) >> ) >> ,rand3.rand >> ) >> from insert_your_table_name_here, >> (select random() as rand, generate_series(1,1000) as point_number) as >> rand1 >> JOIN (select random() as rand, generate_series(1,1000) as point_number) >> as >> rand2 >> ON rand1.point_number = rand2.point_number >> JOIN (select random() as rand, generate_series(1,1000) as point_number) >> as >> rand3 >> ON rand2.point_number = rand3.point_number >> WHERE st_geometrytype( >> st_intersection( >> the_geom, >> st_makeline( >> st_pointn(st_exteriorring(the_geom), (rand1.rand * >> st_npoints(st_exteriorring(the_geom)))::int), >> st_pointn(st_exteriorring(the_geom), (rand2.rand * >> st_npoints(st_exteriorring(the_geom)))::int) >> ) >> ) >> ) = 'ST_LineString' >> AND oid = 5030 /* Enter your own OID here */ >> limit 100 >> >> >> >> >> >>> -Original Message- >>> From: postgis-users-boun...@postgis.refractions.net >>> [mailto:postgis-users-boun...@postgis.refractions.net] On >>> Behalf Of Martin Davis >>> Sent: Thursday, May 06, 2010 8:56 AM >>> To: John Abraham; postgis-users@postgis.refractions.net; Martin Davis >>> Subject: Re: [postgis-users] Dot Density idea >>> >>>
[postgis-users] getting past the 254 character limit of .DBFs
I'm trying to join a table to a shapefile. This table has three or four columns that are longer than the 254 character limit, so when I convert the table into a .DBF I lose a large portion of my data. I had hoped to use pgsql2shp as a work-around but that didn't work. My end product will eventually be displayed online, so I'm thinking that I could connect to the data using the webpage rather than the map, and use the map as the method for linking the two, but I'd rather not have to make each of the offending cells contain a refence to another table. Aside from postgres and postgis I've been using ArcMap and ArcCatalog along with Excel. Any help is appreciated. David ___ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users
[postgis-users] configure: libpq error
Hi, after I've installed (on fedora) postgres 8.4 from binaries, proj and geos from source; I've tried to install postgis 1.5 from source but configure has thrown error "could not find libpq"; libpq exists in postgres /lib directory and I've execute configure with -pg_config, -geos_config and -proj_dir (please don't consider syntax error in the options), I've added libqp's path to PATH variable. I've seen a post with this problem dated March 1st, but it seems that the reply has not gave a solution. What are the common solutions to this problem? Copy the library in another path? To add any configuration to any file? To install something that I've not installed? Thanks in advance for any help and suggestions!! Bye bye Ludovico ___ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users
Re: [postgis-users] Converting Multilinestrings to Linestrings
On Fri, May 07, 2010 at 02:57:09AM -0700, Leigh Holcombe wrote: > Is there a way to force linestring data to be imported as a linestring instead > of as a multilinestring? Yes, shp2pgsql -S > Is there a way to transform all the multilinestrings in a dataset into > linestrings? 1. Drop the type constraint (enforce_geotype_) 2. Update the geometries 3. Re-insert the type constraint 4. Update the geometry_columns record > Is there a way to convert a multilinestring into a linestring easily and > quickly > on the fly (I'm doing PHP/LAPP programming)? ST_GeometryN(the_geom, 1) gives you the first LINESTRING of the (pseudo)set. --strk; () Free GIS & Flash consultant/developer /\ http://strk.keybit.net/services.html ___ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users
[postgis-users] Converting Multilinestrings to Linestrings
Hello, I'm pretty new at PostGIS, and this is my first post to the users list. I recently uploaded a street network into my database using the shp2pgsql function, in order to do some georeferencing for a transportation project. The streets network is composed of line segments going from intersection to intersection. I assumed these would be imported as linestrings. However, they have the geometry type multilinestring. Which seems inappropriate, because their format suggests that they are really just linestrings in disguise. To explain, here's a sample geometry: MULTILINESTRING((1275799.56 245381.12,1275819.04 246040.71)) Ultimately, what I'd like to do is a simple line_interpolate_point - which seems like it would work if I could just get rid of that MULTI. Is there a way to force linestring data to be imported as a linestring instead of as a multilinestring? Is there a way to transform all the multilinestrings in a dataset into linestrings? Is there a way to convert a multilinestring into a linestring easily and quickly on the fly (I'm doing PHP/LAPP programming)? Another thought was that I could do string parsing on the text, and then pass the data to line_interpolate_point as a string, rather than an object - does that even work? Thanks in advance for any advice you might have. Leigh Holcombe ___ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users
[postgis-users] Oracle Spatial and MAXFEATURES, not implemented?
I'm trying to limit the maximum number of features, as in the map file snippet below. MapServer is 5.6.3. Anyway, the number of features drawn is not limited, as expected, but thousands of shapes are processed. Indeed, enabling -all_debug 5, the query passed to Oracle looks like; --- msOracleSpatialLayerWhichShapes. Using this Sql to retrieve the data: SELECT pln_id, pln_id, the_geom FROM plant_data_map WHERE SDO_FILTER( the_geom, MDSYS.SDO_GEOMETRY(2003, :srid, NULL,MDSYS.SDO_ELEM_INFO_ARRAY(1,1003,3),:ordinates ),'querytype=window') = 'TRUE' msOracleSpatialLayerWhichShapes. Bind values: srid:25832 minx:666798.076923 miny:5169400.00 maxx:667551.923077 maxy:517.00 --- Indeed, almost 15,000 shapes arrive: --- msOracleSpatialLayerNextShape on layer 0x101363e0, row_num: 14934 msOracleSpatialLayerNextShape on layer 0x101363e0, Fetched 0 more rows (14934 total) msOracleSpatialLayerFreeItemInfo was called. --- Peeking at the source in maporaclespatial.c, it seems that layer->maxfeatures is never read and no limitation, maybe looking like "ROWNUM <= layer->maxfeatures" is added to the SELECT statement. Regards, Peter MAPFILE SNIPPET: LAYER #16- GROUP "pflanzennr_black_12" NAME "Pflanzennr" STATUS ON TYPE POINT PROJECTION "init=epsg:25832" END CONNECTIONTYPE oraclespatial CONNECTION "{MYUSER}/{MYPASSWD}" DATA "the_geom from plant_data_map using unique pln_id srid 25832" PROCESSING "CLOSE_CONNECTION=DEFER" SIZEUNITS meters LABELITEM "pln_id" MAXFEATURES 20 TOLERANCE 1 POSTLABELCACHE TRUE CLASS NAME "label" LABEL TYPE TRUETYPE PARTIALS TRUE FONT "verdana" COLOR 0 0 0 OUTLINECOLOR 255 255 255 SIZE 6 MINSIZE 6 MAXSIZE 8 POSITION CR FORCE TRUE END END END -- Dott. Peter Hopfgartner R3 GIS Srl - GmbH Via Johann Kravogl-Str. 2 I-39012 Meran/Merano (BZ) Email: peter.hopfgart...@r3-gis.com Tel. : +39 0473 494949 Fax : +39 0473 069902 www : http://www.r3-gis.com XING : http://www.xing.com/go/invita/8917535 ___ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users