Hi

Here is my short experience with Mapguide Open Souce and Maestro. I found some problems and some solutions. Perhaps you found the same problems and perhaps some of my solutions may be helpful to you and I hope some of your's may help me. I think Its all about coordinate systems.

Software versions:
Autodesk Map 3D 2006
Oracle 11g
Mapguide Open Source 2.0.2
Maestro 1.0.9.23854
SL-King FDO Oracle Provider 0.8.7

Problem 1:
When creating a layer in Maestro pointing to Oracle I can preview the geometry but when I insert that layer in a map, I can't see anything. I already tried several coodinate systems but no one works. The Oracle SRID is 82176. Adding layers from sdf files with coordinate system XY, thay work just fine <CoordinateSystem>LOCAL_CS["Non-Earth (Meter)",LOCAL_DATUM["Local Datum",0],UNIT["Meter", 1],AXIS["X",EAST],AXIS["Y",NORTH]]</CoordinateSystem>.

Solution 1:
In Maestro I edited the map xml and deleted the coordinate system, leaving only the xml tags like this: <CoordinateSystem></CoordinateSystem>

Problem 2:
Can't select any feature from Oracle connections on the map. I can only select features from sdf files. May be it has something to do with previous problem.

Solution 2:
not found yet.

Problem 3:
Creating a raster layer in Maestro, it doen't recognize the boundaries of the files. I tried tiff/tfw, jpg/jgw, and ecw/tab files but always got the extents -10000000,10000000.

Solution 3:
With gdalinfo I produced a list of the correct coordinates and then I created a config file and uploaded it in Maestro. This works very well but I got problem 4

Problem 4:
Can't apply solution 3 for a second layer because I get a error message from Maestro saying that the resource config already exists in the server.

Solution 4:
not found yet.

Here is my batchfile for creating the config file for Maestro:
@echo off
:input
set INPUT=
set /P INPUT=enter folder? %=%
if "%INPUT%"=="" goto input
:gdalinfo
creating file %INPUT%\coords.txt...
if exist %INPUT%\coords.txt del %INPUT%\coords.txt
for /f "tokens=* delims= " %%A in ('dir %INPUT%\*.jpg /b') do (
echo %%~nA.jpg
gdalinfo.exe -nomd %INPUT%\%%~nA.jpg >> %INPUT%\coords.txt
echo ----------------------------------------------- >> %INPUT%\coords.txt
)
:gdal2xml
gdal2xml.exe %INPUT%
set INPUT=
set MILITARES=

And the C# command prompt program that I called gdal2xml.exe for converting the gdalinfo report coords.tx for Maestro config xml format:
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Collections;

namespace gdal2xml
{   class Program
   {   static void Main(string[] args)
       {   if (args.Length < 1)
           {   Console.WriteLine("Must enter folder where is coods.txt");
           }
           else
{ Console.WriteLine("Processing file " + args[0].ToString() + "\\coords.txt..."); FileStream fileInput = new FileStream(args[0].ToString() + "\\coords.txt", FileMode.Open, FileAccess.Read); FileStream fileOutput = new FileStream(args[0].ToString() + "\\config", FileMode.Create, FileAccess.Write);
               String line;
               try
{ Console.WriteLine("Creating file " + args[0].ToString() + "\\config..."); //Pass the file path and file name to the StreamReader constructor
                   StreamReader sr = new StreamReader(fileInput);
//Pass the filepath and filename to the StreamWriter Constructor
                   StreamWriter sw = new StreamWriter(fileOutput);
sw.WriteLine("<?xml version=\"1.0\" encoding=\"utf-8\"?>"); sw.WriteLine("<fdo:DataStore xmlns:xs=\"http://www.w3.org/2001/XMLSchema\"; xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"; xmlns:xlink=\"http://www.w3.org/1999/xlink\"; xmlns:gml=\"http://www.opengis.net/gml\"; xmlns:fdo=\"http://fdo.osgeo.org/schemas\"; xmlns:fds=\"http://fdo.osgeo.org/schemas/fds\";>");
                   sw.WriteLine("    <gml:DerivedCRS gml:id=\"Default\">");
                   sw.WriteLine("    <gml:metaDataProperty>");
                   sw.WriteLine("      <gml:GenericMetaData>");
sw.WriteLine(" <fdo:SCExtentType>dynamic</fdo:SCExtentType>"); sw.WriteLine(" <fdo:XYTolerance>0.001000</fdo:XYTolerance>"); sw.WriteLine(" <fdo:ZTolerance>0.001000</fdo:ZTolerance>");
                   sw.WriteLine("      </gml:GenericMetaData>");
                   sw.WriteLine("    </gml:metaDataProperty>");
sw.WriteLine(" <gml:remarks>System generated default FDO Spatial Context</gml:remarks>");
                   sw.WriteLine("    <gml:srsName>Default</gml:srsName>");
                   sw.WriteLine("    <gml:validArea>");
                   sw.WriteLine("      <gml:boundingBox>");
sw.WriteLine(" <gml:pos>-10000000 -10000000</gml:pos>"); sw.WriteLine(" <gml:pos>10000000 10000000</gml:pos>");
                   sw.WriteLine("      </gml:boundingBox>");
                   sw.WriteLine("    </gml:validArea>");
                   sw.WriteLine("    <gml:baseCRS>");
                   sw.WriteLine("      <fdo:WKTCRS gml:id=\"Default\">");
sw.WriteLine(" <gml:srsName>Default</gml:srsName>"); sw.WriteLine(" <fdo:WKT>LOCAL_CS[\"*XY-MT*\",LOCAL_DATUM[\"*X-Y*\",10000],UNIT[\"Meter\", 1],AXIS[\"X\",EAST],AXIS[\"Y\",NORTH]]</fdo:WKT>");
                   sw.WriteLine("      </fdo:WKTCRS>");
                   sw.WriteLine("    </gml:baseCRS>");
sw.WriteLine(" <gml:definedByConversion xlink:href=\"http://fdo.osgeo.org/coord_conversions#identity\"; />"); sw.WriteLine(" <gml:derivedCRSType codeSpace=\"http://fdo.osgeo.org/crs_types\";>geographic</gml:derivedCRSType>"); sw.WriteLine(" <gml:usesCS xlink:href=\"http://fdo.osgeo.org/cs#default_cartesian\"; />");
                   sw.WriteLine("  </gml:DerivedCRS>");
sw.WriteLine(" <xs:schema xmlns:xs=\"http://www.w3.org/2001/XMLSchema\"; xmlns:fdo=\"http://fdo.osgeo.org/schemas\"; xmlns:gml=\"http://www.opengis.net/gml\"; xmlns:default=\"http://fdo.osgeo.org/schemas/feature/default\"; targetNamespace=\"http://fdo.osgeo.org/schemas/feature/default\"; elementFormDefault=\"qualified\" attributeFormDefault=\"unqualified\">");
                   sw.WriteLine("  <xs:annotation>");
sw.WriteLine(" <xs:appinfo source=\"http://fdo.osgeo.org/schemas\"; />");
                   sw.WriteLine("  </xs:annotation>");
sw.WriteLine(" <xs:element name=\"default\" type=\"default:defaultType\" abstract=\"false\" substitutionGroup=\"gml:_Feature\">");
                   sw.WriteLine("    <xs:key name=\"defaultKey\">");
sw.WriteLine(" <xs:selector xpath=\".//default\" />");
                   sw.WriteLine("      <xs:field xpath=\"FeatId\" />");
                   sw.WriteLine("    </xs:key>");
                   sw.WriteLine("  </xs:element>");
sw.WriteLine(" <xs:complexType name=\"defaultType\" abstract=\"false\" fdo:hasGeometry=\"false\">");
                   sw.WriteLine("    <xs:annotation>");
sw.WriteLine(" <xs:appinfo source=\"http://fdo.osgeo.org/schemas\"; />");
                   sw.WriteLine("    </xs:annotation>");
                   sw.WriteLine("    <xs:complexContent>");
sw.WriteLine(" <xs:extension base=\"gml:AbstractFeatureType\">");
                   sw.WriteLine("        <xs:sequence>");
                   sw.WriteLine("          <xs:element name=\"FeatId\">");
                   sw.WriteLine("            <xs:annotation>");
sw.WriteLine(" <xs:appinfo source=\"http://fdo.osgeo.org/schemas\"; />");
                   sw.WriteLine("            </xs:annotation>");
                   sw.WriteLine("            <xs:simpleType>");
sw.WriteLine(" <xs:restriction base=\"xs:string\">"); sw.WriteLine(" <xs:maxLength value=\"256\" />");
                   sw.WriteLine("              </xs:restriction>");
                   sw.WriteLine("            </xs:simpleType>");
                   sw.WriteLine("          </xs:element>");
sw.WriteLine(" <xs:element name=\"Image\" type=\"fdo:RasterPropertyType\" fdo:defaultImageXSize=\"1024\" fdo:defaultImageYSize=\"1024\" fdo:srsName=\"Default\">");
                   sw.WriteLine("            <xs:annotation>");
sw.WriteLine(" <xs:appinfo source=\"http://fdo.osgeo.org/schemas\";>"); sw.WriteLine(" <fdo:DefaultDataModel dataModelType=\"Bitonal\" dataType=\"Unknown\" organization=\"Pixel\" bitsPerPixel=\"1\" tileSizeX=\"256\" tileSizeY=\"256\" />");
                   sw.WriteLine("              </xs:appinfo>");
                   sw.WriteLine("            </xs:annotation>");
                   sw.WriteLine("          </xs:element>");
                   sw.WriteLine("        </xs:sequence>");
                   sw.WriteLine("      </xs:extension>");
                   sw.WriteLine("    </xs:complexContent>");
                   sw.WriteLine("  </xs:complexType>");
                   sw.WriteLine("  </xs:schema>");
sw.WriteLine(" <SchemaMapping provider=\"OSGeo.Gdal.3.2\" name=\"default\" xmlns=\"http://fdogrfp.osgeo.org/schemas\";>");
                   sw.WriteLine("    <complexType name=\"defaultType\">");
sw.WriteLine(" <complexType name=\"RasterTypeType\">"); sw.WriteLine(" <RasterDefinition name=\"images\">"); sw.WriteLine(" <Location name=\"" + args[0] + "\\\">");
                   int filecounter = 0;
string str = "", MinX = "", MinY = "", MaxX = "", MaxY = "";
                   //Read the first line of text
                   line = sr.ReadLine();
                   //Continue to read until you reach end of file
                   while (line != null)
                   {   //Read the next line
                       line = sr.ReadLine();
                       if (line != null)
                       {   if (line.Contains("Files:"))
{ str = line.Substring(line.LastIndexOf("\\") + 1, line.LastIndexOf(".") - line.LastIndexOf("\\") - 1); sw.WriteLine(" <Feature name=\"" + str + "\">"); sw.WriteLine(" <Band name=\"RGB\" number=\"1\">"); sw.WriteLine(" <Image frame=\"1\" name=\"" + str + ".jpg\">");
                               sw.WriteLine("                  <Bounds>");
                           }
                           else if (line.Contains("Upper Left"))
{ MinX = line.Substring(line.LastIndexOf("(") + 1, line.LastIndexOf(",") - line.LastIndexOf("(") - 1).Trim();
                               //Console.WriteLine("MinX=" + MinX);
MaxY = line.Substring(line.LastIndexOf(",") + 1, line.LastIndexOf(")") - line.LastIndexOf(",") - 1).Trim();
                               //Console.WriteLine("MaxY=" + MaxY);
                           }
                           else if (line.Contains("Lower Right"))
{ MaxX = line.Substring(line.LastIndexOf("(") + 1, line.LastIndexOf(",") - line.LastIndexOf("(") - 1).Trim();
                               //Console.WriteLine("MaxX=" + MaxX);
MinY = line.Substring(line.LastIndexOf(",") + 1, line.LastIndexOf(")") - line.LastIndexOf(",") - 1).Trim();
                               //Console.WriteLine("MinY=" + MinY);
sw.WriteLine(" <MinX>" + MinX + "</MinX>"); sw.WriteLine(" <MinY>" + MinY + "</MinY>"); sw.WriteLine(" <MaxX>" + MaxX + "</MaxX>"); sw.WriteLine(" <MaxY>" + MaxY + "</MaxY>");
                               sw.WriteLine("                  </Bounds>");
                               sw.WriteLine("                </Image>");
                               sw.WriteLine("              </Band>");
                               sw.WriteLine("            </Feature>");
                           }
                           filecounter++;
                       }
                   }
                   sw.WriteLine("          </Location>");
                   sw.WriteLine("        </RasterDefinition>");
                   sw.WriteLine("      </complexType>");
                   sw.WriteLine("    </complexType>");
                   sw.WriteLine("  </SchemaMapping>");
                   sw.Write("</fdo:DataStore>");
                   //Close the files
                   sr.Close();
                   sw.Close();
Console.WriteLine("Completed! Correct line 72 with correct server path: <Location name=\"" + args[0] + "\"\\>");
               }
               catch (Exception e)
               {   Console.WriteLine("Exception: " + e.Message);
               }
               finally
               {   //Console.WriteLine("Executing finally block.");
               }
               fileInput.Close();
               fileOutput.Close();
           }
       }
   }
}
_______________________________________________
mapguide-users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/mapguide-users

Reply via email to