Creating WKT strings with Openlayers

Source: Internet
Author: User

            var polygon = OpenLayers.Geometry.Polygon.createRegularPolygon (new OpenLayers.Geometry.Point (6,), 2, 0);            var feature = new OpenLayers.Feature.Vector (polygon);            var wkt_c = new OpenLayers.Format.WKT ();            var wktstring = wkt_c.write (feature);            var projection = new Openlayers.projection ("epsg:4326");            var Testarea = Polygon.getgeodesicarea (projection). toFixed (2);            var Testarea = Polygon.getgeodesicarea (). toFixed (2); default:epsg:4326

The data is created, presumably like this:

"POLYGON ((6.027164 49.524078,6.088064 49.680508,5.948726 49.772232,5.941587 49.91943,6.03742 50.064381,6.147439 50.130783,6.211109 50.166946,6.312177 50.134426,6.340263 49.998951,6.525142 49.858585,6.734586 49.815399,6.715019 49.685902,6.603117 49.621159,6.636707 49.462303,6.57162 49.490456,6.315996 49.495625,6.027164 49.524078)) "

  

  

Creating WKT strings with Openlayers

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.