Follow-up: [OpenLayers-Users] registering an SVG "image"

Andreas Hocevar ahocevar at opengeo.org
Thu Mar 31 10:40:33 EDT 2011


You may want to have a look at OpenLayers.Layer.Vector and OpenLayers.Feature.Vector. This will give you exactly what you want, without the need to programmatically create SVG. OpenLayers will render the vectors using SVG, Canvas or VML, depending on the browser you are using.

Andreas.

On Mar 31, 2011, at 16:37 , Mr. Puneet Kishor wrote:

> I am examining the SVG layer at http://dev.openlayers.org/addins/InlineXhtml/trunk/examples/example2_layer1.svg as referred to in the ScalableInlineXhtml example below. How does one generate an SVG layer like that?
> 
> I am a beginner with SVG, and have been using mainly the jQuery SVG plugin for creating SVGs. I am assuming that every time the user clicks zoomin or zoomout on an OL map and changes the map extent, a new, correctly scaled SVG has to be regenerated, although perhaps that is not required when panning the map. Is that assumption correct?
> 
> Here is my use case -- I have a bunch of gridded data, and right now I am generating GIFs on the server and sending them as OL.Layer.Image layers. I'd rather just send the data to the browser, and have the browser generate the gridded visualization (just a bunch of squares colored with different values) via SVG. I have been doing some performance testing and the performance is pretty good, allows interactivity, makes for nice looking visualizations, and offloads the work from my server to the user's high powered by highly under-utilized computer.
> 
> On Mar 31, 2011, at 8:33 AM, Mr. Puneet Kishor wrote:
> 
>> 
>> On Mar 31, 2011, at 6:01 AM, Andreas Hocevar wrote:
>> 
>>> Hi,
>>> 
>>> you may want to have a look at this addin: http://trac.osgeo.org/openlayers/wiki/Addins/InlineXhtml
>> 
>> 
>> Andreas, I am quite sure the above is what I want, many thanks for the pointer. However, looking at the examples, I am confused about the following -- the examples seem to use SVG layer generated on the server. I am generating the SVG layer right in the user's browser. So, I need something like the following
>> 
>>   var svgLayer = function(whatever) (
>>       return svg;
>>   );
>> 
>>   var aus_states = new OpenLayers.Layer.ScalableInlineXhtml(
>>       "Australia States",
>>       svgLayer(whatever),
>>       new OpenLayers.Bounds(98.0859375,-55.322265625,171.9140625,5.322265625),
>>       new OpenLayers.Size(840, 690),
>>       {isBaseLayer: false, opacity: '0.6'}
>>   );
>> 
>> In other words, instead of the "url" parameter to the initialization, I want to give it an svgLayer created right in the browser. Is that possible?
>> 
>> 
>>> 
>>> Regards,
>>> Andreas.
>>> 
>>> On Mar 31, 2011, at 07:02 , Mr. Puneet Kishor wrote:
>>> 
>>>> Perhaps the answer to the following is obvious, but I would appreciate a nudge in the right direction.
>>>> 
>>>> I have a Google base layer on which I am overlaying a few WMS layers, and an Image layer. Everything is working mostly fine. Now, I would like to add an SVG layer to the mix. I am creating an SVG layer using some JavaScript code. How do I register this SVG "image" so it positions and overlays correctly on the OL map even when zooming in/out or panning?
>>>> 
>>>> Many thanks,
>>>> 
>>>> Puneet._______________________________________________
>>>> Users mailing list
>>>> Users at lists.osgeo.org
>>>> http://lists.osgeo.org/mailman/listinfo/openlayers-users
>>> 
>>> 
>>> 
>>> -- 
>>> Andreas Hocevar
>>> OpenGeo - http://opengeo.org/
>>> Expert service straight from the developers.
>>> 
>> 
> 
> _______________________________________________
> Users mailing list
> Users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/openlayers-users

-- 
Andreas Hocevar
OpenGeo - http://opengeo.org/
Expert service straight from the developers.



More information about the Users mailing list