[OpenLayers-Users] draw a line on a map?
Christopher Schmidt
crschmidt at metacarta.com
Mon Apr 14 16:20:08 EDT 2008
On Mon, Apr 14, 2008 at 01:14:52PM -0700, geoman wrote:
>
> I'm new to OpenLayers; I'm evaluating it for a current project. I'm going to
> be getting WKT for road segments from a database, and I want to highlight
> those segments on a map. However, I haven't been able to get past this
> error:
> Error: uncaught exception: [Exception... "String contains an invalid
> character" code: "5" nsresult: "0x80530005
> (NS_ERROR_DOM_INVALID_CHARACTER_ERR)" location:
> "http://openlayers.org/api/OpenLayers.js Line: 554"]
The WKT format returns Features, not geometries.
> var wkt = "LINESTRING(-73.9444 40.75921,-73.96892 40.76396)";
> var geometry = parser.read(wkt);
> var feature = new OpenLayers.Feature.Vector(geometry);
Should just be:
> var wkt = "LINESTRING(-73.9444 40.75921,-73.96892 40.76396)";
> var feature = parser.read(wkt);
Regards,
--
Christopher Schmidt
MetaCarta
More information about the Users
mailing list