[OpenLayers-Users] KML/GML from text file?

Robert Sanson SansonR at asurequality.com
Sun Apr 27 16:44:47 EDT 2008


Yes, managed to get it to work. I have some Java code that pulls a
geometry out of a database (SDE) and writes it to a local file system
file. Seems OL is fairly fussy about the structure of the GML file.
Anyway, here is the OL code:
 
var fbnd = new OpenLayers.Layer.GML("Farm boundary", "./farmfiles/" +
farmid + ".xml", {style: farm_style});
                    map.addLayer(fbnd);
 
And here is a sample GML (I experimented with GML structure using one
of the OL examples that writes out GML to a text box, then emulated
that):
 
<wfs:FeatureCollection xmlns:wfs="http://www.opengis.net/wfs">
  <gml:featureMember xmlns:gml="http://www.opengis.net/gml">
    <feature:features
xmlns:feature="http://mapserver.gis.umn.edu/mapserver"
fid="OpenLayers.Feature.Vector">
      <feature:geometry>
        <gml:Polygon>
          <gml:outerBoundaryIs>
            <gml:LinearRing>
              <gml:coordinates decimal="." cs=", " ts=" ">
                1821412.509, 5534791.015 1821458.847, 5534735.59
1821598.037, 5534849.028 1821614.701, 5534862.607 1821673.566,
5534910.58 1821659.449, 5534927.465 1821655.449, 5534932.249
1821627.218, 5534966.016 1821412.509, 5534791.015
              </gml:coordinates>
            </gml:LinearRing>
          </gml:outerBoundaryIs>
        </gml:Polygon>
      </feature:geometry>
    </feature:features>
  </gml:featureMember>
</wfs:FeatureCollection>

Kind regads,
 
Robert Sanson

>>> "Burgholzer,Robert" <rwburgholzer at deq.virginia.gov> 25/04/2008 5:30
a.m. >>>

Has anyone loaded a simple KML/GML layer from a local text file?  Maybe
this is trivial * Thanks!r.b.Robert W. BurgholzerSurface Water
ModelerOffice of Water Supply and PlanningVirginia Department of
Environmental Qualityrwburgholzer at deq.virginia.gov804-698-4405Open
Source Modeling Tools:http://sourceforge.net/projects/npsource/


Click here to report this email as spam.
------------------------------------------------------------------
The contents of this email are confidential to AsureQuality. If you have received this communication in error please notify the sender immediately and delete the message and any attachments. The opinions expressed in this email are not necessarily those of AsureQuality. This message has been scanned for known viruses before delivery. AsureQuality supports the Unsolicited Electronic Messages Act 2007. If you do not wish to receive similar communications in future, please notify the sender of this message.
------------------------------------------------------------------


This message has been scanned for malware by SurfControl plc. www.surfcontrol.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20080428/c779e578/attachment.html


More information about the Users mailing list