[mapguide-users] Retrieve fields names and attributes from Postgres table

ar_gaeta ar_gaeta at yahoo.it
Mon May 30 07:06:36 EDT 2011


Hi all,
I'm searching a way to know the fields name and attribute of a specified
layer in a map.
I've tried some ways:

1) The string:

http://localhost/mapguide/mapagent/mapagent.fcgi?OPERATION=DESCRIBEFEATURESCHEMA&VERSION=1.0.0&LOCALE=en&RESOURCEID=Library%3A%2F%2FSamples%2FSheboygan%2FData%2FParcels.FeatureSource&SCHEMA

works very good, but how can I embedded this in a script in java? And how
can I specified a single layer?


2) I've tried to write this script (in java):

<<
MgLayer layer = (MgLayer)map.GetLayers().GetItem(layername);
String layer_Id = layer.GetFeatureSourceId();
String layerclass = layer.GetFeatureClassName();
MgResourceIdentifier resourceID = new
MgResourceIdentifier("Library://prova_basic/Load
procedures/postgres_local.FeatureSource");

MgStringCollection classNames = new MgStringCollection();
classNames.Add(layerclass);

String xml = featureService.DescribeSchemaAsXml(resourceID, "public",
classNames);

out.println(xml);
>>

I don't receive any error, but also I didn't receive the string xml that I'm
expecting!!
What I'm doing wrong?

I've found this post: "Getting a layers available field names?", in this
forum, but I didn't find it useful (maybe it is too complicated for me), and
there wasn't any code to help me to understand how to build the script I
need.

I would like to know for the specified layer only the field name and his
attribute (integer, string, etc.).

Thanks very much for any help

I'm on MGOS 2.2, Windows 7, Apache/Tomcat.

Riccardo

--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/Retrieve-fields-names-and-attributes-from-Postgres-table-tp6418612p6418612.html
Sent from the MapGuide Users mailing list archive at Nabble.com.


More information about the mapguide-users mailing list