[OpenLayers-Users] Alternative to Tab-separated Values File?

Mr. Puneet Kishor punk.kish at gmail.com
Sat Oct 29 09:40:52 EDT 2011


On Oct 29, 2011, at 4:27 AM, Arnie Shore wrote:

> Certainly.  But how to get OL to consume that data format versus the text file is my question?
> 


See `OpenLayers.Format.GeoJSON` and `OpenLayers.Layer.Vector`

Here is a code stub to get you going (this one draw the layer on top of a Google basemap; the projections have been defined elsewhere):

	var geojson_format = new OpenLayers.Format.GeoJSON({
		"internalProjection": proj.google,
		"externalProjection": proj.latlng
	});

	var lyr = new OpenLayers.Layer.Vector(a.name, {
		// styleMap defined elsewhere
		styleMap: new OpenLayers.StyleMap(styleMap)
	});
	map.addLayer(lyr);
	lyr.addFeatures(geojson_format.read(data);

> AS
> 
> On 10/29/2011 12:41 AM, David Fawcett wrote:
>> Arnie,
>> 
>> Are you looking for something like GeoJSON?
>> 
>> http://geojson.org/
>> 
>> David.
>> 
>> 
>> On Oct 28, 2011, at 3:44 PM, Arnie Shore<ashore3 at verizon.net>  wrote:
>> 
>>> The tab separated values file for vector and text is somewhat inconvenient in a number of ways, frankly.  Is there some alternative method of scripting the values to define these features?  Like providing a Javascript array instead?
>>> 
>>> Thanks, all.

--
Puneet Kishor



More information about the Users mailing list