I have a spatial database in Sql server and I am working in asp.net mvc.
My project must show stored shape in web page that uses openlayers js and user must see and edit shapes and send the result to server.
I want to know how can I send data to my map and receive new data from it and save data to database.
Is there any library that work for me?
Is is not important that it must be open source
thanks a lot
There are (at least) two solutions available to you:
either you use openLayers "save" strategy, that you attach to your WFS vector layer, where you draw features and it saves your features for you with the help of your mapServer
or you save your features (which I prefer) yourself. Just serialiaze your VectorLayer.features feature collection, translate geometries using OpenLayers.Format.WKT parser to get the WKT of your geometries and then use simple INSERT, UPDATE to put your WKT into your database and convert it back to geometry with the help of a spatial function. (you didn't mention the type of your SQL server, so I put here an MS SQL example string in C#
string insertString = "INSERT INTO myTable(geometry) VALUES(geometry::STGeomFromText('" + objFeature.WKTString + #"',5514)";
Related
I did some research and the web has taken me all over the place and I still haven't found a suitable solution or guide to what I am trying to achieve.
I read up a similar post to what I am asking. Except that's #php
Retrieving Image in SQL Server (varbinary)
Update:
The "conventional" way is the create file directory and file path. This was my initial method to get the front end up and running for the user.
My sup actually advised that I use this hash method nonsense which he can't even explain properly to me.
A user must be able to insert an image on the form, generate a report displaying the image as well.
How does the varbinary work to link sql and Access for what I am trying to achieve? I am currently playing around with my development to resolve it.
Any clarification?
I have no other way of putting this question after my first edit.
This is the form
For each form entry a user should insert a picture to support the Findings.
A VARBINARY field in SQL server is a field that stores binary data, and is often used for storing files. You can fit entire files in this field.
If you have a VARBINARY field in SQL server, and create a linked table in Access to the table with that field, it gets interpreted as an OLE object, since OLE objects are binary data too.
You can use the Bound object frame control in Access to save images into OLE objects, both as an image (which is displayable), or as a package. This does not require any code. You can right click the field -> Insert Object -> Bitmap Image to insert bitmap images into an OLE field. However, this stores OLE object data along with the image data, which makes it very hard to work with using code, and nearly impossible in non-vba applications. Using this approach is only justifiable if you're sure you're going to stick with Access for the lifetime of the database, in my opinion.
I've shared an example on working with VBA code and the OLE object here, but that uses hacky code that executes GUI operations. It's nearly impossible to port to other applications. I recommend you use the next way instead.
Alternatively, you can directly store binary data in the OLE object/Varbinary field. This makes it a lot easier to deal with using VBA code or any future application, since it's just the file data stored in the field, there's no OLE object data stored with it. I've shared code to load binary data in a field and save it back to disk here.
The hard part of this puzzle, if you're just working with binary image data, is displaying the image to the user. I've shared 3 approaches here, with code for one one of them. However, that's quite complex VBA code.
We are searching for a solution for the following problem:
We gather some data on our website via an HTML form. This data shall be used for creating a form which in the end shall be printed and physically signed. The data is stored in an MSSQL database.
We don't know which is the best and easiest to implement approach. We thought about having a PDF template and replacing some tags with the values of the database, creating a custom view and print it with 3rd party software or even use an SSRS server.
The most important points are the following:
easy to use for the user
the user shall not be able to change the document after he downloaded it
the document should not be stored on the server (we prefer to have the document created only in the RAM)
if we have to use third party software it should be free of charge
the implementation effort should be as little as possible
Kind regards
There is a requirement in my project where we need to design a system which can collect data through Web API and then use the data to compare and copy the received data to an existing SQL Server DB. I want to know if anyone has already worked on such requirement and if yes then what is the best way to design it? I am currently thinking of below two options. Please let me know which one is better and if there is any other option.
My algorithm will be as - fetch the data through web api -> compare the data -> save mismatched data to a particular table -> copy new data to the existing tables.
The two options I am currently thinking of are-
1) Use a windows service which will run once in a day and execute above algo.
2) Use SSIS package which will run once in a day and execute above algo.
If anyone has used either of this solution, please guide me to an article or blog which can be helpful to me.
I have similar project requirement before. What I achieved is in SSIS.
Brief steps:
Using C# script to get the return data (http://json2csharp.com/ is an easy way to return C# class based on your JSON components)
using third party dll, install Newtonsoft.Json to deserialize the JSON
Assign the results in C# script to each pre defined variable (be careful with the data type)
Compare the result with the existing table in data flow task.
Let me know if you have any questions
There is a use case in which we would like to add columns from the data of a webservice to our original sql data table.
If anybody has done that then pls do comment.
Shadowfax is correct that you should review the How to Ask guide.
that said, Spotfire offers this feature in two ways:
use IronPython scripting attached to an action control to retrieve the data. this is a very rigid solution that offers no caching, and the data must be retrieved and placed in memory each time the document is opened. I'll leave you to the search feature here on SO; I've posted a sample document somewhere.
the ideal solution is to use a separate product called Spotfire Advanced Data Services. this data federation layer can mashup data and perform advanced, custom caching based on your needs. the data is then exposed as an information link in Spotfire Server. you'll need to talk to your TIBCO sales rep about this.
I would use a Web Server to consume the Web Service and write it to your DB.
But here is the hard way:
Step 1: Use IronPython Script to retrieve WS Data, and form a Data Table or Document Property (https://www.tibco.com/blog/2014/03/03/streaming-xml-and-json-data-from-the-web-directly-into-spotfire-clients-using-script-controls/)
Step 2: Write a Stored Procedure in your DB and use IronPython to call the procedure (using a button, so this will be a manual step) and pass the Data Table or Document Property as parameter. (Here is an ironpython alternative: http://spotfired.blogspot.com/2014/04/write-back-to-database-from-spotfire.html)
To give you the question first: I want to know if it is possible to create a stored procedure or something in SQL Server that intercepts and translates SELECT, INSERT, and UPDATE commands. Now for the explanation:
I am writing a web application to replace an old desktop app. Its a business app which is basically a database interface with reports and searches and all the good ol' CRUD. The new and old apps need to live in harmony together since some customers may be using the old and new together to access the same DB.
My problem is that the original database format stores most data in a single blob of text (1 nvarchar(MAX) field). I want to add functionality to search on fields stored in the blob, but it will be cumbersome and slow. I would like to update the database format without changing the desktop app at all, hence the question above.
It occurs to me that I could do this on the client by writing a wrapper class for the data access object and then do a bulk replace in the client code to reference the wrapper, but I want to know what my options are on the server as well.
In case anyone wants to know, the old app is in VB6 and the new in C#.
EDIT
Alright, so it looks like if I do anything on the server side we are looking at adding stored procedures and then updating the client VB6 code to reference the stored procs. Do something like a bulk replace of SELECT with sp_oldselect ... To return the data in a different format. I'm guessing a client-side wrapper would be the best solution for the time-being. Old apps die hard.
You can create a bunch of views for the old client and let it to query those views. It will be slow as hell in most cases, but it can 'replace' the select query. For updates and insert.. well.. instead of triggers on the views could help is some cases, but it will require lots of processing.
However my suggestion is to provide exactly the same functionality in the web app and deprecate the desktop app. When the desktop app's share is low enough, stop supporting it. From this point, you are (mostly) free to add new functions, upgrade the database schema, etc.
I agree with JonH, that alot can go wrong here, but you can try and read up on the INSTEAD OF Triggers in MS SQL server here: https://technet.microsoft.com/en-us/library/ms179288(v=sql.105).aspx