<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
You just have to change the ll84Wkt to the new map WKT.<br>
For good measure, you should also change the string "LL84",<br>
but I don't think it is required.<br>
<br>
You can read the map WKT directly from the MapDefinition XML.<br>
You can also read the WKT from a FeatureSource, using the
SpatialContext information.<br>
<br>
If you have data in LL84 and a map in UTM, data should be re-projected
automatically by <br>
MapGuide, meaning that you don't have to change anything.<br>
<pre class="moz-signature" cols="72">Regards, Kenneth Skovhede, GEOGRAF A/S
</pre>
<br>
<br>
girish kumar bv skrev:
<blockquote
cite="mid:20090519131517.60254.qmail@f4mail-235-242.rediffmail.com"
type="cite">Hi all,<br>
<br>
i am using projected coordinate system in my new map how to change the
below code to accomodate this. Instead of ll84 i am using wgs84 and UTM<br>
<br>
<%--<br>
-This file contains methods to create a temporary feature source and
a temporary layer.<br>
<br>
--%><br>
<%@ page contentType="text/html; charset=UTF-8" %><br>
<%@ page import="org.osgeo.mapguide.*" %><br>
<%@ page import="java.util.*" %><br>
<%@ page import="java.io.*" %><br>
<%@ page import="javax.xml.parsers.*" %><br>
<%@ page import="javax.xml.transform.*" %><br>
<%@ page import="javax.xml.transform.dom.*" %><br>
<%@ page import="javax.xml.transform.stream.*" %><br>
<%@ page import="org.w3c.dom.*" %><br>
<br>
<%!<br>
// Create a temporary Feature Source to store the parcel marker
locations.<br>
<br>
<br>
<br>
void CreatePropertyMarkerFeatureSource(MgFeatureService featureService,
MgResourceIdentifier parcelMarkerDataResId) throws MgException<br>
{<br>
String ll84Wkt = "GEOGCS["LL84",DATUM["WGS_1984",SPHEROID["WGS
84",6378137,298.25722293287],TOWGS84[0,0,0,0,0,0,0]],PRIMEM["Greenwich",0],UNIT["Degrees",1]]";<br>
<br>
MgClassDefinition propertyMarkerClass = new MgClassDefinition();<br>
propertyMarkerClass.SetName("PropertyMarker");<br>
MgPropertyDefinitionCollection properties =
propertyMarkerClass.GetProperties();<br>
<br>
MgDataPropertyDefinition idProperty = new
MgDataPropertyDefinition("ID");<br>
idProperty.SetDataType(MgPropertyType.Int32);<br>
idProperty.SetReadOnly(true);<br>
idProperty.SetNullable(false);<br>
idProperty.SetAutoGeneration(true);<br>
properties.Add(idProperty);<br>
<br>
MgDataPropertyDefinition PropIdProperty = new
MgDataPropertyDefinition("PROPERTY_ID");<br>
PropIdProperty.SetDataType(MgPropertyType.String);<br>
PropIdProperty.SetLength(512);<br>
properties.Add(PropIdProperty);<br>
<br>
MgDataPropertyDefinition ImageProperty = new
MgDataPropertyDefinition("IMAGE");<br>
ImageProperty.SetDataType(MgPropertyType.String);<br>
ImageProperty.SetLength(512);<br>
properties.Add(ImageProperty);<br>
<br>
<br>
MgGeometricPropertyDefinition locationProperty = new
MgGeometricPropertyDefinition("Location");<br>
locationProperty.SetGeometryTypes(MgGeometryType.Polygon);<br>
locationProperty.SetHasElevation(false);<br>
locationProperty.SetHasMeasure(false);<br>
locationProperty.SetReadOnly(false);<br>
locationProperty.SetSpatialContextAssociation("LL84");<br>
properties.Add(locationProperty);<br>
<br>
<br>
MgDataPropertyDefinition OwnerNameProperty = new
MgDataPropertyDefinition("OWNER_NAME");<br>
OwnerNameProperty.SetDataType(MgPropertyType.String);<br>
OwnerNameProperty.SetLength(512);<br>
properties.Add(OwnerNameProperty);<br>
<br>
<br>
MgPropertyDefinitionCollection idProperties =
propertyMarkerClass.GetIdentityProperties();<br>
idProperties.Add(idProperty);<br>
<br>
propertyMarkerClass.SetDefaultGeometryPropertyName("Location");<br>
<br>
MgFeatureSchema propertyMarkerSchema = new MgFeatureSchema();<br>
propertyMarkerSchema.SetName("PropertyMarkerSchema");<br>
propertyMarkerSchema.GetClasses().Add(propertyMarkerClass);<br>
<br>
MgCreateSdfParams sdfParams = new MgCreateSdfParams("LL84",
ll84Wkt, propertyMarkerSchema);<br>
<br>
featureService.CreateFeatureSource(parcelMarkerDataResId,
sdfParams);<br>
}<br>
<br>
// Create a temporary Layer to display the parcel markers.<br>
<br>
MgLayer CreatePropertyMarkerLayer(MgResourceService resourceService,
MgResourceIdentifier parcelMarkerDataResId, String sessionId) throws
MgException, Exception<br>
{<br>
// Load the ParcelMarker layer definition template into<br>
// a JSP DOM object, find the "ResourceId" element, and<br>
// modify it's content to reference the temporary<br>
// feature source.<br>
<br>
<br>
DocumentBuilderFactory factory =
DocumentBuilderFactory.newInstance();<br>
DocumentBuilder builder = factory.newDocumentBuilder();<br>
Document document = builder.parse(new
File(getServletContext().getRealPath("/") + "xyz" + File.separator +
"propertymarker.xml"));<br>
NodeList nodes = document.getElementsByTagName("ResourceId");<br>
Node resNode = nodes.item(0);<br>
Node resContent =
document.createTextNode(parcelMarkerDataResId.ToString());<br>
resNode.appendChild(resContent);<br>
<br>
// write the modified layer XML definition into a byte stream<br>
//<br>
TransformerFactory tFactory = TransformerFactory.newInstance();<br>
Transformer transformer = tFactory.newTransformer();<br>
ByteArrayOutputStream bos = new ByteArrayOutputStream();<br>
DOMSource source = new DOMSource(document);<br>
StreamResult result = new StreamResult(bos);<br>
transformer.transform(source, result);<br>
<br>
// Save the updated layer definition to the session repository
using the<br>
// ResourceService object.<br>
<br>
byte[] layerDefinition = bos.toByteArray();<br>
MgByteSource byteSource = new MgByteSource(layerDefinition,
layerDefinition.length);<br>
byteSource.SetMimeType(MgMimeType.Xml);<br>
<br>
MgResourceIdentifier tempLayerResId = new
MgResourceIdentifier("Session:" + sessionId +
"//PropertyMarker.LayerDefinition");<br>
<br>
resourceService.SetResource(tempLayerResId, byteSource.GetReader(),
null);<br>
<br>
// Create an MgLayer object based on the new layer definition<br>
// and return it to the caller.<br>
<br>
MgLayer propertyMarkerLayer = new MgLayer(tempLayerResId,
resourceService);<br>
propertyMarkerLayer .SetName("PropertyMarker");<br>
propertyMarkerLayer .SetLegendLabel("Property Marker");<br>
propertyMarkerLayer .SetDisplayInLegend(true);<br>
propertyMarkerLayer .SetSelectable(true);<br>
<br>
return propertyMarkerLayer ;<br>
}<br>
%><br>
<br>
<br>
<table
style="font-family: Verdana; font-size: 11px; line-height: 15px;"
border="0" cellpadding="0" cellspacing="0" height="57" width="644">
<tbody>
<tr>
<td><a moz-do-not-send="true"
href="http://sigads.rediff.com/RealMedia/ads/click_nx.ads/www.rediffmail.com/signatureline.htm@Middle?"
target="_blank"><img moz-do-not-send="true"
src="http://sigads.rediff.com/RealMedia/ads/adstream_nx.ads/www.rediffmail.com/signatureline.htm@Middle"></a></td>
</tr>
</tbody>
</table>
<pre wrap="">
<hr size="4" width="90%">
_______________________________________________
mapguide-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:mapguide-users@lists.osgeo.org">mapguide-users@lists.osgeo.org</a>
<a class="moz-txt-link-freetext" href="http://lists.osgeo.org/mailman/listinfo/mapguide-users">http://lists.osgeo.org/mailman/listinfo/mapguide-users</a>
</pre>
</blockquote>
</body>
</html>