Creating PictureMarkerSymbols with raw SVG tags or with Dojo GFX

4706
4
05-10-2015 03:45 AM
omega_cancer
Occasional Contributor II

I am generating SVGs on client side at runtime so I want to use it as PictureMarkerSymbols.

PictureMarkerSymbols takes the URL property of SVG to draw SVG symbol, Is there any other way to create SVG based PictureMarkerSymbols like to create it from:

1. Raw SVG tags

<svg>
<rect x='0', y ='0',  width='100', height='100' />
</svg>

or

2. Making use of Dojo GFX like 

Vector Graphics with Dojo&apos;s GFX - Dojo Toolkit Tutorial

// Create a rectangle
var rectangle = surface.createRect({ x: 100, y: 50, width: 200, height: 100 })
    .setStroke("yellow");
gfxFx.animateStroke({
    shape: rectangle,
    duration: 500,
    color: { start: "yellow", end: "pink" },
    width: { end: 15 },
    join:  { values: ["miter", "bevel", "round"] }
});

Dojo is being used by ESRI so it should support Dojo GFX

Any help would be very much appreciated.

Thanks

0 Kudos
4 Replies
RobertScheitlin__GISP
MVP Emeritus

Abdul,

   Have you seen this sample?  SVG and CSS using D3 | ArcGIS API for JavaScript

omega_cancer
Occasional Contributor II

Yes I have seen it.

Sorry for the dumb question but it only renders circles on map. How can I make it work with SVG tags please.

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Abdul,

   OK, I can not find an example of using a raw SVG as input. If you can obtain the SVG path string then you can use the Symbol.setPath method. If you have some standard SVGs that you use then you can use this website to get the paths for those SVGs

SVG To RaphaelJS Converter - Ready.Set.Raphael. Beta 2

omega_cancer
Occasional Contributor II

I have came across Raphael and SnapSVG.

Thanks for the reply. 

0 Kudos