ThinkGeo.com    |     Documentation    |     Premium Support

Info access from Windows Form

Im using Web Edition (not Services Edition), and of course, all the users access the site using web browsers. But i have a small Windows Forms program running on the server 24x7, this program need to extract location info like streets, population...etc that can easily be accessed on Web Edition by the users. Is there any way for this Windows Form program to access the info?


Ric



Ric, 



So I think generally, what you want is to share data between a web application and a windows application. One thing I’m not sure is where does the windows application get data from, from users’ input, or directly from the data which web application is using? 



If that is from user’s input, that needs the communication between the 2 applications. One of the simplest way is whenever a user write something, the web application also write it on a file, and the windows application keep checking if something new is on the file. :) Sure there is many advanced ways about the processes communications you can google it easily I think. If you want to get the data from some file, can you let me know what file you have and what data you want, I can show you some code then. 



Thanks, 



Ben 

 



Ben,


The WindowsApp is running on same or different server which hosts the Map Suite. It is continuously monitoring user inputs from different devices sent by the users. One such devices is a modem. When the modem receives queries from users asking the information about a certain location, the WindowsApp will then retrieve from MapSuite the info needed, then sends it back to the users who sent the query.


in other words, the WindowsApp must have a way of querying MapSuite something like "what city is this point in?" like this:


Collection<Feature> Cities = Citiesayer.QueryTools.GetFeaturesContaining(myPoint,ReturningColumnsType.AllColumns);


then it will get answer as a string and send it back to the users. This sounds like a web service, but there seems no way to write a web service using MapSuite Web edition. i guess MapSuite Services Edition might be a solution, but purchasing both editions will make my project's price too high.


Any solution for this?


Ric



Ric, 
  
   I see what you are trying to do.  We have done some similar stuff with vehicle tracking.  Our scenarios was to take in points from a GPS unit reporting in a windows service then do calculation such as the closest city, reverse geo-coding etc.  This runs in as a windows service and not a website. We also have a website side of things as well.  We would love to see you buy a Services Edition license as well but if all you need to do is to access layers and do spatial queries then the Web Edition is all you need.   
  
   The Web Edition itself is made up of a WebEdition.dll which houses all the web specific stuff, this is what you need on the web side.  There is also a MapSuiteCore.dll I think, or something with Core in it.  This is where all the core libraries such as Shapes, FeatureSource, ShapeFileFeatureLayer etc are housed.  The WebEdition.dll references it but you can use it by itself outside of a web process.  I am pretty sure that core dll has everything you need for the windows application side of things. 
  
   A note on licensing though.  If you have the process doing the spatial queries on a different machine than the website then you need to license an additional server.  These are allot cheaper than the standard developers toolkits.  The MapSuiteCore.dll will not run unless the machine has a valid runtime license installed on it. 
  
 I hope this helps and let me know if you have any other questions.  I monitor this forum every now and then and if I am not here I am sure Ben can help. 
  
 David

Thanks David. Ben has been, and still is a great help on my learning of your product. Yes i just want to do simple spatial queries using WindowsApp, and having Services Edition running just for that would be an overkill (at least for the start). In the future when my clients require that, or the query load becomes heavy, thats the time i need to set up dedicated servers for dedicated spatial queries. At this starting phase, i would like to make it simple and using Web Edition on 1 server.


Can someone show me how to do that? i tried setting up a web service to serve spatial queries, but can't figure out how to define layers like i did in websites.


Ric


 



Ben, 



i forgot to mention in my above question that when the Windows Application make spatial queries, the user concerned is not on his laptop, therefore no browser is running. So the WinApp is alone to interact with MapSuite Web Edition and will then send the query results back to the user. 



Ric



Ric, 


Thanks for the good words on me, especially in front of David:)
 
As what David mentioned, you can use the MapSuiteCore.dll by itself outside of a web process. Here is a sample in which input latitude and longitude, it returns the countries containing that point.
 
Any queries just let me know.
 
Thanks,
 
Ben

280-GetFeaturesContaining.zip (13.4 KB)

Ben, 
  
 What you sent is a Windows Application that do the spatial query of calling QueryTools.GetFeaturesContaining. My problem is, i will be querying the server (with Web Edition installed) using a browser, not using a Windows Appp. In other words, the server is wunning Web Edition serving the requests of the browsers. Seems like i should make a web service that returns the query result to the browser, but i can’t find a way to do it… 
  
 Ric

Ben, any info on this? According to David (pls see his replies above), the MapSuiteCore.dll can be used by itself, but i don’t know how to use it for spatial queries… 
  
 Ric

Ric,


I think this is what you want. Let me know for more queries. If you want to use it on another machine, please see David's comments about licensing.


Thanks,


Ben


 



284-GetFeatureContainging2.zip (27.3 KB)

Yes Ben, this is what i was looking for! thank you!

Let me know for more queries.  Ric