I'm working on a php project.
I'm provided with some data like race,height,weight,martial status,etc.
Based on these inputs, I want to draw a vector image, which can be a svg or any format.
Is it possible to do so? If it is possible, how can I do that?
I can't put some set of images and use them according to the data as, i have very huge data.
I want to draw a vector image dynamically based on the data.
Please help.
Related
Hello I was wondering if anyone knew how to apply filters on an image using sharpjs(preferably) or any image processing lib with a nodejs SDK using only a colorMatrix. The two inputs I have are the input image and the 4 x 5 color matrix and I want to transform the input image using the color matrix. For context, I can do transformations in the web browser canvas API using feColorMatrix tag but I want to actually manipulate the image on the backend now. Has anyone got any experience with this?
I'm working on a system to draw points in a picture, the user with a touch screen will draw points in the picture, these points are going to be stored in the database in a format like this:
The system is working pretty well, but I have a new challenge. I would like to show all the points per reference in my backend, interactively. I would like to ask you if someone knows a library to do the job?, my backend is sending it into the view a JSON with the points concerning. Just to add more details, one piece could have X quantity of problems and X quantity of points per problem. Qlikview provide a solution to this problem, but we are not able to use the service.
Thanks for your help.
You can use HTML5 Canvas to render picture and draw lines, points etc on it.
Documentation
Similar thread
Is it possible to make a Custom shape (Using Mouse) on the Google Map using Gmap library in C# and then save it into the database and on the client request draw the stored shape on Google Map again? Is there any possibility for doing such operation in any other library or in Gmap (I am not expecting the code. Just an overview of doing it.)?
Oh Boy....this is absolutely doable! And I do it on day to day basis! Let me share how I achieve it. Another thing to keep in mind that this works for Google Maps and Bing Maps.
First, you have to represent Maps as not just coordinates but as collection of small squares. Now what do I mean by that?!
Have a look at this following picture. It's image of Czech Republic on google maps.
Now Czech Republic a.k.a Czechia, on google maps can be seen as collection of smaller square images or grids. You need to understand this concept very well in order to make this idea work. Now take a look at the following image where it shows how the image of Czechia on Google Maps can be visualised as collection of small square boxes or grid. These small square boxes hold images of parts of Czechia.
If you want to Zoom into a co-ordinate Xm,Ym (Easting:Xm, Northing:Ym), which is a place in Czechia and the name of that place is "Hermanuv Mestec" (as shown in the above picture) then you need to choose the bounding small box with co-ordinates (X1,Y1),(X1,Y2),(X2,Y1)&(X2,Y2), and fetch the underlying images in that box. This feature to fetch underlying images within that bounding box is actually Zooming In. So when you Zoom In or in other words fetch the underlying images within that bounding box, you get something as the following image:
Now, I hope you got the underlying concept of how Zoom In or Zoom Out (reverse process) and mapping co-ordinate system works if you want to achieve what you want to achieve because this concept is very important to grasp before you proceed.
You need to write a program which can do this transformation. And as of your question how to achieve this as follows:
Step 1: Use a Panel (Control) on Windows Form or WPF or asp.net application, which you are building.
Step 2: Use GMap Library in C# to fetch the image within a bounding box as mentioned above and populate/draw that image on the Panel.
Step 3: Have a function that tracks mouse events on the panel. This function/method will track the X,Y position of mouse move event on the panel and use Panel Drawing tools to draw objects on the panel based on this.
Step 4: Write another program to transform these mouse X,Y positions on the panel to co-ordidnates on the map. This piece/part of the program is important because this is what enables you to translate your representation of small square image breakdowns of maps into panel drawable objects, so that you can draw them again and again in future if saved properly in the database.
Step 5: When you draw an abject on the panel you track the X,Y mouse bounds on the panel and transform those points into co-rodinates using your custom program and then you save the co-ordinates in the database table.
Thats it! And in case you need to draw the same object saved in the database, you first need to fetch/draw the google maps image on the panel again, then need to fetch that shape of the object from the database by fetching the co-ordinates of that object saved in the database table, use your translation program to convert those co-ordinates into panel drawable points and draw the object back on the same panel.
Now, you can write this translation program (Easting Northing co-ordinates to Drawing Panel co-ordinates) yourself, which might take good few months or at least some time. Or you can buy customised program specialised to achieve this exact same function for a good amount of price.
Hope this helps.
You can also achieve this with Google Maps drawing object with JavaScript as mentioned in another answer but the issue is with the translation and saving the coordinates in the database. It's much faster and responsive in this aforementioned method. Anyway, this is how I do this, so kind of personal opinion.
Technologies required for the aforementioned technique is as follows:
Google Map Library/Bing Map Library (whichever you choose)
C# with .Net Framework 3.5 or above (.net framework lesser than this is also fine but may require bit more lines of code to achieve some functionality if you want to achieve complexity in this)
SQL Server Management Studio or anything equivalent depending on
the type of database and query you are planning to use.
I think you want to make a map overlay, and you can use Goggle Drawing Tools in conjunction with your map. See: https://developers.google.com/maps/documentation/javascript/examples/drawing-tools
This will create the overlay. Presumable you could write javascript code that would save the coordinates and attributes of the overlay to a hidden field once you hit a "Save button" . Then after form submission you could save this info to a database using standard techniques, and then when rendering the map the next time, insert the overlay info into the javascript output by your page,
I am not going to spend the time making this for you, but this is the approach I would take.
steps:
1) Get the geometry/shape out from google api.
2) Send/post to server using some popular exchange format, GeoJSON or WKT
3) Prepare a server's service/asp/web service to accept the request and translate/validate those geometries into Oracle SDO_Geometry user define type/struct.
4) Use some C# oracle library,
a) create Connection,
b) create command with parameter,
c) Initial an OracleObject, assign all the required properties like SDO_GTYPE, SDO_SRID.
d) Assign the OracleObject to the the named parameter in the command.
e) Execute the command and commit.
Hope this help.
I'm making a game for a school project, and we have been tasked to create a game using the HappyFunTimes plugin for Unity. For the game my group is making, we need to generate a random sprite image in a C# script in Unity, and get the sprite to display in the upper middle of the phone's controller screen. Unfortunately, at this point in my education I'm only familiar with C# so I'm having trouble working through the HappyFunTimes's game-pad code. Any help would be appreciated.
I don't know how to generate an image in Unity. I know last time I checked there was no easy 2D API for direct rendering (as in draw a line, draw a rectangle, draw a circle, etc...)
You can render a scene to a texture though, see render texture, render to it, and then get the data out.
Or if you could just create an array and set values if it's a small image. (for example the gravatar images here on SO or a QR code).
Once you have the data you'd need to base64 encode it there should be some C# functions to do that. Then you can send it to the phone. On the phone you'd need to decode it, put it in an ImageData then you can copy it into a canvas with putImageData
You can then either display that canvas as is, OR, use it to draw into another canvas, OR, generate a dataURL for an image. All of that will have to be in JavaScript/HTML/CSS not C#
... although you could make C# send a dataURL directly and skip the decoding, imagedata, and canvas parts. Just assign the image's src property to the dataURL
So basically I have use SVG/javascript/PHP so that when a user clicks on a PNG image it takes the coordinates and uses these to plot a small black square on the PNG image, it's really very simple.
However, I was wondering if it's possible if you have the PNG in tags within the SVG element, and the filled square on top of the PNG image (made using SVG 'rect'), to save this as 1 single PNG?
You should probably go through a simple canvas tutorial. I suggest checking the Mozilla (mdn) tutorials. Canvas isn't very hard to work with. For a quick idea of what you will need, check out this tutorial about drawing a rectange and to save the image you can access the canvasElement.toDataURL() method to get a base64 encoded string of the image on the canvas. To save to user you can location.href=dataURL; or post it to a sever using ajax.