Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [udig-devel] Free spaital database

--000e0cd6ae309e2f1d04666299be
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

Thanks a lot Marks.. I can insert the polygons now...

On Tue, Mar 31, 2009 at 7:40 AM, Mark Leslie <mark.leslie@xxxxxxxxxxxx>wrote:

> 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 <prasad.konduru2@xxxxxxxxx>
>> 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 <jody.garnett@xxxxxxxxx>
>>> 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 <prasad.konduru2@xxxxxxxxx
>>>> >
>>>> 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 <jody.garnett@xxxxxxxxx
>>>>> >
>>>>> 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
>

--000e0cd6ae309e2f1d04666299be
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

Thanks a lot Marks.. I can insert the polygons now...<br><br>
<div class=3D"gmail_quote">On Tue, Mar 31, 2009 at 7:40 AM, Mark Leslie <sp=
an dir=3D"ltr">&lt;<a href=3D"mailto:mark.leslie@xxxxxxxxxxxx";>mark.leslie@=
lisasoft.com</a>&gt;</span> wrote:<br>
<blockquote class=3D"gmail_quote" style=3D"PADDING-LEFT: 1ex; MARGIN: 0px 0=
px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">Babu,<br>This syntax is correct =
for inserting into a text field, but it won&#39;t create a polygon for you.=
 =A0Ultimately you will want to build the full string representation as you=
&#39;ve shown it...=20
<div class=3D"im"><br><br>&gt;&gt; POLYGON ((103.89888293296089 1.418753631=
284916, 103.91762259776536<br>&gt;&gt; 1.407041340782123, 103.9077842737430=
2 1.3850222346368715, 103.88904460893855<br>&gt;&gt; 1.389238659217877, 103=
.89888293296089 1.418753631284916))<br>
<br></div>For example:<br><br>INSERT INTO &quot;New&quot; (poly) VALUES (ST=
_GeomFromText(&#39;POLYGON ((103.89888293296089 1.418753631284916, 103.9176=
2259776536 1.407041340782123, 103.90778427374302 1.3850222346368715, 103.88=
904460893855 1.389238659217877, 103.89888293296089 1.418753631284916))&#39;=
, -1);<br>
<br>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&#39;t s=
et. =A0In this case the poly field must be of type geometry. =A0I would als=
o recommend against using uppercase characters in table names. =A0Most comm=
on tools to connect to PostGIS will properly handle them, but it&#39;s non-=
standard and may cause surprises in the future.<br>
<br>I highly recommend the workbook for 2007, it&#39;s a great introduction=
 with a very logical flow to it. =A0You&#39;ll be much more confident worki=
ng with PostGIS after going through it.<br><br>--<br><font color=3D"#888888=
">Mark</font>=20
<div>
<div></div>
<div class=3D"h5"><br><br>Jody Garnett wrote:<br>
<blockquote class=3D"gmail_quote" style=3D"PADDING-LEFT: 1ex; MARGIN: 0px 0=
px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">I was not aware of the INSERT IN=
TO &quot;New&quot; syntax - indeed I am not sure<br>I understand it.<br><br=
>
I usually use the well-known-text (&quot;wkt&quot;) representation of a<br>=
geometry; and call a function to create the required data structure.<br><br=
>Have a look at the postgis workbook here for the details on how to<br>
hack this stuff using SQL:<br>- <a href=3D"http://www.foss4g2007.org/worksh=
ops/W-04/" target=3D"_blank">http://www.foss4g2007.org/workshops/W-04/</a><=
br><br>It will take a couple of hours to do the workbook but you should try=
<br>
going through it before proceeding.<br><br>Jody<br><br>On Mon, Mar 30, 2009=
 at 8:46 PM, prasad babu &lt;<a href=3D"mailto:prasad.konduru2@xxxxxxxxx"; t=
arget=3D"_blank">prasad.konduru2@xxxxxxxxx</a>&gt; wrote:<br>
<blockquote class=3D"gmail_quote" style=3D"PADDING-LEFT: 1ex; MARGIN: 0px 0=
px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">Thanks a lot Jodi. you are makin=
g me very good.I am able to insert the data<br>into database now. But the p=
roblem is I am very new to postgresql.. =A0Now I<br>
am inserting each and every coordinate into polygon,Is this is the right<br=
>way? =A0Is there any way to insert polygon directly into the database,I me=
an<br>The synatax of my postgresql polygaon is<br>=A0(INSERT INTO &quot;New=
&quot;(<br>
=A0 =A0 =A0 =A0 =A0 =A0poly)<br>=A0 =A0VALUES (&#39;2,4,7,8,13,56&#39;);<br=
><br>Is there any other way to store polygon as it as we are getting as a<b=
r>geomentry in our program<br><br>POLYGON ((103.89888293296089 1.4187536312=
84916, 103.91762259776536<br>
1.407041340782123, 103.90778427374302 1.3850222346368715, 103.8890446089385=
5<br>1.389238659217877, 103.89888293296089 1.418753631284916))<br><br><br><=
br>Why I am asking all this because ,Weather I may get any problem while<br=
>
retriveng the data from the database ?<br><br>plese suggest me ..<br><br>Th=
anks in advance..<br><br>Babu.<br><br>On Mon, Mar 30, 2009 at 11:49 AM, Jod=
y Garnett &lt;<a href=3D"mailto:jody.garnett@xxxxxxxxx"; target=3D"_blank">j=
ody.garnett@xxxxxxxxx</a>&gt;<br>
wrote:<br>
<blockquote class=3D"gmail_quote" style=3D"PADDING-LEFT: 1ex; MARGIN: 0px 0=
px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">The format the data comes in is =
called &quot;features&quot;; part of a feature<br>is a geometry; the other =
part is attributes (like the data values<br>
about the polygon).<br><br>The export to shapefile operation example shows =
how to put an<br>operation on a &quot;FeatureSource&quot;; you can use the =
feature source api to<br>retrieve a feature collection; and from there you =
can go through each<br>
feature and place it in your database.<br><br>The ShapefileExport actually =
does this work; it creates a new<br>shapefile and copies the features into =
it. For more examples of<br>working with feature collections see the geotoo=
ls wiki:<br>
- <a href=3D"http://docs.codehaus.org/display/GEOTDOC/08+FeatureCollection"=
 target=3D"_blank">http://docs.codehaus.org/display/GEOTDOC/08+FeatureColle=
ction</a><br><br><br>Jody<br><br>On Mon, Mar 30, 2009 at 2:43 PM, prasad ba=
bu &lt;<a href=3D"mailto:prasad.konduru2@xxxxxxxxx"; target=3D"_blank">prasa=
d.konduru2@xxxxxxxxx</a>&gt;<br>
wrote:<br>
<blockquote class=3D"gmail_quote" style=3D"PADDING-LEFT: 1ex; MARGIN: 0px 0=
px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">Thanks =A0a lot jodi, Yes I look=
ed at the operations Section and I have<br>creataed a new operation named a=
s &quot;exp to database&quot; and I have written<br>
a new<br>class for that and I am able to call that class, But here in my pr=
ogram<br>I have liitlebit confusion, I mean in which format we will get the=
<br>data programitically in my class.I did not see any coordinates in the<b=
r>
program. I am trying to create a new table once user clicks the &quot;exp t=
o<br>database&quot; tab =A0and planning to store the polygons or ? in to th=
e table.<br>is it the right way?<br><br>Sorry for my confusion..<br><br>Tha=
nks in advance<br>
<br>babu<br>On Mon, Mar 30, 2009 at 11:18 AM, Jody Garnett &lt;<a href=3D"m=
ailto:jody.garnett@xxxxxxxxx" target=3D"_blank">jody.garnett@xxxxxxxxx</a>&=
gt;<br>wrote:<br>
<blockquote class=3D"gmail_quote" style=3D"PADDING-LEFT: 1ex; MARGIN: 0px 0=
px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">
<blockquote class=3D"gmail_quote" style=3D"PADDING-LEFT: 1ex; MARGIN: 0px 0=
px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">I gone through the ShpExport plu=
gin and I have changed<br>accordingly,But<br>my<br>question here is how can=
 I get the data from Map.<br>
</blockquote>The operation is available when you right click on a layer. Ch=
eck the<br>plugin.xml file and look for a section on &quot;operations&quot;=
.<br><br>
<blockquote class=3D"gmail_quote" style=3D"PADDING-LEFT: 1ex; MARGIN: 0px 0=
px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">I mean I can create a postGis ta=
ble manually here,But how I can paste<br>the<br>data into table,Is there an=
y predefined code in the shpexport class.<br>
First I<br>will finsih stroing the data into database then i will try how t=
o<br>fetch<br>it.<br>you want me to write query to fetch the data?<br></blo=
ckquote>Correct; the code example should show how to perform a query. Indee=
d<br>
their are a few examples to this effect.<br>Jody<br>_______________________=
________________________<br>User-friendly Desktop Internet GIS (uDig)<br><a=
 href=3D"http://udig.refractions.net/"; target=3D"_blank">http://udig.refrac=
tions.net</a><br>
<a href=3D"http://lists.refractions.net/mailman/listinfo/udig-devel"; target=
=3D"_blank">http://lists.refractions.net/mailman/listinfo/udig-devel</a><br=
></blockquote><br>_______________________________________________<br>User-f=
riendly Desktop Internet GIS (uDig)<br>
<a href=3D"http://udig.refractions.net/"; target=3D"_blank">http://udig.refr=
actions.net</a><br><a href=3D"http://lists.refractions.net/mailman/listinfo=
/udig-devel" target=3D"_blank">http://lists.refractions.net/mailman/listinf=
o/udig-devel</a><br>
<br><br></blockquote>_______________________________________________<br>Use=
r-friendly Desktop Internet GIS (uDig)<br><a href=3D"http://udig.refraction=
s.net/" target=3D"_blank">http://udig.refractions.net</a><br><a href=3D"htt=
p://lists.refractions.net/mailman/listinfo/udig-devel" target=3D"_blank">ht=
tp://lists.refractions.net/mailman/listinfo/udig-devel</a><br>
</blockquote><br>_______________________________________________<br>User-fr=
iendly Desktop Internet GIS (uDig)<br><a href=3D"http://udig.refractions.ne=
t/" target=3D"_blank">http://udig.refractions.net</a><br><a href=3D"http://=
lists.refractions.net/mailman/listinfo/udig-devel" target=3D"_blank">http:/=
/lists.refractions.net/mailman/listinfo/udig-devel</a><br>
<br><br></blockquote></blockquote>_________________________________________=
______<br>User-friendly Desktop Internet GIS (uDig)<br><a href=3D"http://ud=
ig.refractions.net/" target=3D"_blank">http://udig.refractions.net</a><br><=
a href=3D"http://lists.refractions.net/mailman/listinfo/udig-devel"; target=
=3D"_blank">http://lists.refractions.net/mailman/listinfo/udig-devel</a><br=
>
</div></div></blockquote></div><br>

--000e0cd6ae309e2f1d04666299be--


Back to the top