Babu,
This syntax is correct for inserting into a text field, but it won't
create a polygon for you. Ultimately you will want to build the full
string representation as you've shown it...
>> POLYGON ((103.89888293296089 1.418753631284916, 103.91762259776536
>> 1.407041340782123, 103.90778427374302 1.3850222346368715,
103.88904460893855
>> 1.389238659217877, 103.89888293296089 1.418753631284916))
For example:
INSERT INTO "New" (poly) VALUES (ST_GeomFromText('POLYGON
((103.89888293296089 1.418753631284916, 103.91762259776536
1.407041340782123, 103.90778427374302 1.3850222346368715,
103.88904460893855 1.389238659217877, 103.89888293296089
1.418753631284916))', -1);
You can leave out the -1 (the SRID) but you really should be setting it
as various functions and services may get confused if the SRID isn't
set. In this case the poly field must be of type geometry. I would
also recommend against using uppercase characters in table names. Most
common tools to connect to PostGIS will properly handle them, but it's
non-standard and may cause surprises in the future.
I highly recommend the workbook for 2007, it's a great introduction with
a very logical flow to it. You'll be much more confident working with
PostGIS after going through it.
--
Mark
Jody Garnett wrote:
I was not aware of the INSERT INTO "New" syntax - indeed I am not sure
I understand it.
I usually use the well-known-text ("wkt") representation of a
geometry; and call a function to create the required data structure.
Have a look at the postgis workbook here for the details on how to
hack this stuff using SQL:
- http://www.foss4g2007.org/workshops/W-04/
It will take a couple of hours to do the workbook but you should try
going through it before proceeding.
Jody
On Mon, Mar 30, 2009 at 8:46 PM, prasad babu <[email protected]> wrote:
Thanks a lot Jodi. you are making me very good.I am able to insert the data
into database now. But the problem is I am very new to postgresql.. Now I
am inserting each and every coordinate into polygon,Is this is the right
way? Is there any way to insert polygon directly into the database,I mean
The synatax of my postgresql polygaon is
(INSERT INTO "New"(
poly)
VALUES ('2,4,7,8,13,56');
Is there any other way to store polygon as it as we are getting as a
geomentry in our program
POLYGON ((103.89888293296089 1.418753631284916, 103.91762259776536
1.407041340782123, 103.90778427374302 1.3850222346368715, 103.88904460893855
1.389238659217877, 103.89888293296089 1.418753631284916))
Why I am asking all this because ,Weather I may get any problem while
retriveng the data from the database ?
plese suggest me ..
Thanks in advance..
Babu.
On Mon, Mar 30, 2009 at 11:49 AM, Jody Garnett <[email protected]>
wrote:
The format the data comes in is called "features"; part of a feature
is a geometry; the other part is attributes (like the data values
about the polygon).
The export to shapefile operation example shows how to put an
operation on a "FeatureSource"; you can use the feature source api to
retrieve a feature collection; and from there you can go through each
feature and place it in your database.
The ShapefileExport actually does this work; it creates a new
shapefile and copies the features into it. For more examples of
working with feature collections see the geotools wiki:
- http://docs.codehaus.org/display/GEOTDOC/08+FeatureCollection
Jody
On Mon, Mar 30, 2009 at 2:43 PM, prasad babu <[email protected]>
wrote:
Thanks a lot jodi, Yes I looked at the operations Section and I have
creataed a new operation named as "exp to database" and I have written
a new
class for that and I am able to call that class, But here in my program
I have liitlebit confusion, I mean in which format we will get the
data programitically in my class.I did not see any coordinates in the
program. I am trying to create a new table once user clicks the "exp to
database" tab and planning to store the polygons or ? in to the table.
is it the right way?
Sorry for my confusion..
Thanks in advance
babu
On Mon, Mar 30, 2009 at 11:18 AM, Jody Garnett <[email protected]>
wrote:
I gone through the ShpExport plugin and I have changed
accordingly,But
my
question here is how can I get the data from Map.
The operation is available when you right click on a layer. Check the
plugin.xml file and look for a section on "operations".
I mean I can create a postGis table manually here,But how I can paste
the
data into table,Is there any predefined code in the shpexport class.
First I
will finsih stroing the data into database then i will try how to
fetch
it.
you want me to write query to fetch the data?
Correct; the code example should show how to perform a query. Indeed
their are a few examples to this effect.
Jody
_______________________________________________
User-friendly Desktop Internet GIS (uDig)
http://udig.refractions.net
http://lists.refractions.net/mailman/listinfo/udig-devel
_______________________________________________
User-friendly Desktop Internet GIS (uDig)
http://udig.refractions.net
http://lists.refractions.net/mailman/listinfo/udig-devel
_______________________________________________
User-friendly Desktop Internet GIS (uDig)
http://udig.refractions.net
http://lists.refractions.net/mailman/listinfo/udig-devel
_______________________________________________
User-friendly Desktop Internet GIS (uDig)
http://udig.refractions.net
http://lists.refractions.net/mailman/listinfo/udig-devel
_______________________________________________
User-friendly Desktop Internet GIS (uDig)
http://udig.refractions.net
http://lists.refractions.net/mailman/listinfo/udig-devel