[postgis-users] [Fwd: Re: [pgrouting-users] How to join Two points (latitudes and langitudes) in postgis?]

Stephen Woodbridge woodbri at swoodbridge.com
Tue Mar 2 20:49:45 PST 2010


Please reply to the list so other can benefit from the discussion.

-------- Original Message --------
Subject: 	Re: [pgrouting-users] How to join Two points (latitudes and
langitudes) in postgis?
Date: 	Tue, 2 Mar 2010 16:12:48 -0500
From: 	SIDDHESH GANDHI <siddheshgandhi at gmail.com>
To: 	Stephen Woodbridge <woodbri at swoodbridge.com>
References:
<5d08242a1003021128q10baab4ci1d7e126e1edec462 at mail.gmail.com>
<4B8D6A6F.3030208 at swoodbridge.com>



Thank you for your reply.

Sorry I thought I am posting in postgis group.

1) I didnt get any error message but I didnt get required line when I
imported required table in QGIS.
E.g. Suppose I provide latitude and longitude of boston and some other
city in MA and form a linestring. Now I start QGIS and import this
linestring from that table. After this I add a vector layer of MA state.
This should result in generation of linestring from boston to that city,
but it does not show this.

If I try to put Points having lattitude and longitude and superimpose it
on MA state shapefile, I can see points at right location in that shapefile.

So I was asking if I am wrong in drawing linestring?

2) Yes, it is there in database.
3) Contraints-
CONSTRAINT enforce_dims_the_geom CHECK (ndims(the_geom) = 2),
   CONSTRAINT enforce_geotype_the_geom CHECK (geometrytype(the_geom) =
'LINESTRING'::text OR the_geom IS NULL),
   CONSTRAINT enforce_srid_the_geom CHECK (srid(the_geom) = 4326)

Can you tell me in short, what do constraints do?

Thanks Again
Siddhesh


On Tue, Mar 2, 2010 at 2:43 PM, Stephen Woodbridge
<woodbri at swoodbridge.com <mailto:woodbri at swoodbridge.com>> wrote:

     Siddhesh,

     This is probably more of a postGIS list query than a pgRouting query.

     1) you did not say what error messages you might have gotten!
     2) is the line in the database after you insert it?
     3) what constraints to you have on the table for SRID?
     4) you might want to ask on the QGIS list also

     -Steve

     SIDDHESH GANDHI wrote:

         Hi all,
         I am trying to join 2 points on earth (SRID 4326) by a line but
         somehow I m not able to see that in QGIS.

         I have taken some latitudes and longitudes and created points.
         When I create POINT column and load these points, I can see them
         on QGIS at exact same locations. (Boston, MA will be at same
         position where it is now wrt MA state shapefile)

         Now when i try to join two points (E.g. Boston and Some other
         place in MA), it does not appear on QGIS.

         I tried following queries for linestring construction -
         1) insert into sridline (the_geom) values
         (ST_setSRID(ST_MakeLine(ST_MakePoint(42.5667212,
         -70.987212),ST_MakePoint(44.5667212, -70.987212)),4326));
         Other thing I tried is :
         2)  insert into sridline (the_geom) values
         (GeomFromText('Linestring(42.342305 -71.04858,42.278325
         -70.874176)',4326));

         For generating POINT :
         UPDATE sridpoint
                SET the_geom = ST_SetSRID(ST_Point(
         longitude,latitude),4326);

         I can draw linestring when SRID = -1 but with SRID, I am facing
         problems.
         Please let me know if someone is aware of how to generate
         linestring when SRID is specified.

         Thanks
         Siddhesh


 
------------------------------------------------------------------------

         _______________________________________________
         Pgrouting-users mailing list
         Pgrouting-users at lists.postlbs.org
         <mailto:Pgrouting-users at lists.postlbs.org>
         http://lists.postlbs.org/mailman/listinfo/pgrouting-users






More information about the postgis-users mailing list