SVG + DB
Submitted by 18MARIE on Sun, 2006-05-28 19:40.
::
Hello,
I'd like to put up(poster) the architecture of a water_network and the information
necessary is in data base ,SO I'd like to know how I can do that with SGV?
i.E how I can create a map on a web site ,getting information from DB,
I d like to have some references for SVG, bc i'don't know it and the relation
between it and the BD,
I 've forgot to tell you that I'm doing the web site in PHP.
Thanks
If you're getting the map data from the database then turning in to SVG, then there isn't really a direct relationship between the database and the SVG.
First make sure that you know how to get the data from your database into your PHP code. After that you can use PHP methods to write out that information as SVG.
If you give a little more information about your application, someone mught be able to give you a more specific answer.
hth
Agree with there isn't really a direct relationship between the database and the SVG. but there need more references for SVG online, like examples with PHP. I think I need this too.
-----
software reviews
An open standard for vector-based graphics offers a new way to put images on Web pages. The Scalable Vector Graphics standard has been in progress at the W3C for more than two years. Like many developing technologies, it was not immediately useful. Slowly, applications began supporting SVG. Things became really interesting in June 2000, when Adobe released plugins for both Microsoft Internet Explorer and Netscape Navigator.
SVG is more than just another way to put graphics on a Web page, but as I spend a lot of time building Web applications, this aspect is what caught my attention. PHP has allowed direct manipulation of graphics since an interface to the GD library was added several years ago. There are ways to generate GIF, JPEG, PNG, PDF and even Flash. But SVG is different in one important way: it's an XML language. All those other graphics formats use a binary format. Opening an SVG image in a text editor reveals friendly, familiar XML.
And what better programming language than PHP for generating dynamic SVG images? After all, PHP has proven itself perfectly suited to generating markup languages. I read through the SVG specification and converted the pie chart example from Core PHP Programming from JPEG to SVG.
Set up your client
You'll need to install the Adobe SVG plugin, or find some other way to view SVG images. The W3 maintains a list of SVG Implementations. The Adobe plugin works on IE and Navigator for both Windows and Macintosh. Unfortunately, support for other operating systems is sketchy at best. Mozilla has limited support for SVG. There are two competing Java toolkits: CSIRO SVG Toolkit and the Apache Group's Batik SVG toolkit.
A release candidate of version 2.0 of Adobe's plugin was released in March 2001. If you use IE or Navigator, download the installer. You simply double-click on the installer. The plugin is free for personal use, but the source code is not available.
SVG is XML
Like any XML language, SVG conforms to a certain structure defined by XML and the SVG DTD. If you're not experienced with writing XML documents, the most important idea to realize is that you can't get away with breaking the rules as you can with HTML. The W3 page on XML has many links to documents to help you learn XML, if needed. I'm assuming you're comfortable with XML.
The latest version of the candidate recommendation is an adequate reference to the SVG tags. I haven't experimented with gradients or filters. There's much more to SVG than I will discuss here.
SVG documents are using image/svg-xml for MIME type, although this isn't approved yet. It's recommended that SVG documents use an .svg extension, but if we send a proper Content-type header, this shouldn't matter. Our files will have a .php extension, of course, but we'll use header() to send the MIME type.
Generating SVG
In Chapter 19 of Core PHP Programming, I explained how to create a pie chart using the image functions. The example code generated a JPEG based on an array of values. The values are based on an imaginary survey of people's favorite meats. For example, 99 people said they liked beef best. A pie chart showed this value as a portion of the pie. Converting this script into an SVG generator seemed like a good way to take SVG for a spin.
The pie chart is a set of wedges: two straight sides and an arc. In order to draw the wedges using the image functions, I had to draw two lines radiating from the center of the chart. I then connected them with an arc, and filled the interior. The GD library has a special function for drawing filled polygons, but they are defined by an array of points. There's no practical way to draw a polygon with a curved side.
SVG does support polygons with curved sides. In fact, it supports cubic Bezier curves, quadratic Bezier curves and elliptical arcs. The foundation of the filled polygon is the path tag. The d attribute of this tag contains a series of commands for a cursor. You can instruct it to move to a point, draw a straight line from the current position to another point, or draw a curve to another point. You can also end with a command to close the polygon by connecting the current position to the starting point.
Using SVG in the real world
SVG has many appealing qualities. The SVG file is only 1992 bytes, which is quite small. When I tried saving the same image a GIF, it was almost four times larger. PNG was worse. I could probably reduce the SVG file substantially by removing the comments, using classes instead of embedded styles, and then compressing it. The Adobe plugin knows how to deal with gzipped SVG images.
Another aspect of SVG images is one they share with Flash animations. Since they are vector-based, you can zoom in and zoom out with no loss of quality. That's why it has "scalable" in its name.
Text that's part of an SVG image is available for copying into your clipboard. That's something unexpected for a graphic format.
Despite these outstanding features, the biggest problem with SVG is the lack of support. The Adobe plugin allows the majority of Web surfers to view SVG images, but at the cost of downloading a big installation file. Until SVG support comes as part of the standard browser installation, SVG images can't be used on most Web pages. However, in the context of an intranet, you can ask someone to download the plugin before viewing a special chart.
________________
Submited by : Recetas
Post new comment