How to secure my GeoJSON data? - php

I am trying to create a website that display Google map mark up with my proprietary data (in form of multiple polygons) on top of it.
I have been studying Google Map API and found the only way to do it is to publish my proprietary data in GeoJSON file then use the following api function to load the data to Google map: map.data.loadGeoJson(xxxxxx);
This means I need to publish my proprietary data by web service in GeoJSON format. However, I don't want users to download my proprietary data and use it for another purpose other than my site. This is similar to a website which allows video streaming but not allowing download the whole video offline.
How can I achieve the purpose? Can I use some language like PHP to generate the map (with markup) at server then send to web client in form of HTML? Or if I cannot achieve this by Google Map API, can other map API support it (like Bing?)
Thanks very much for your help!!!!
Code Mon key

One option is to turn your data into a tile layer. This will limit the user to only seeing an image of the data but would not give them access to the raw data. In a worse case scenario they would only be able to take the images and view the data and not do any kind of analytics against it unless they manually trace all the data.
As an added benefit of rendering the data as a tile layer, you will be able to visualize a lot more data. I've built a few systems that can render 500M rows of polygon data on a map using this approach. The cool thing, if you store the data in a spatial database like SQL Azure, you can easily make your data interactive by taking the point a user clicks on a map and searching the database for any shapes that intersect with that point.
I wrote a simple blog post on how to create a web service that does this many years ago here: https://rbrundritt.wordpress.com/2009/11/26/dynamic-tile-layers-in-the-bing-maps-silverlight-control/
There is also a good open source project here that uses ASP.NET: http://ajaxmapdataconnector.codeplex.com/
I have a whitepaper that is a lot more up to date than my blog post that will be published soon. If you email me at ricky_brundritt at Hotmail.com, I'll send you a draft copy.

Related

Loading several thousands of images efficiently

I am developing a website that uses Google Maps.
The map has 4000-5000 markers.
Upon the client enters the website the server determines all "active" markers and sends a JSON document telling the client information about each marker and what marker-icon to use (a url to an image on the server, ex: icon: '/icon/xxx.png').
The website loads instantly but it takes about 5 seconds until all markers are shown since the client has to fetch those ~5000 images.
The images can change so the server only knows when the client ask for it, exactly which image each marker uses.
How can I speedup this process?
Can I dynamically create a spritesheet of some sort or pack all those files and let the client unpack them for faster loading?
The server backend is PHP för this part.
You can indeed create a spritesheet, or if they are relatively simple in style, you can also create them dynamically as SVGs within your page code, and when you declare each marker, you give it a path defined in SVG within your JS (as served by your main page, or a static file containing functions for many of them).
SVG info here:
https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Paths
Some good examples in this prior answer : How to use SVG markers in Google Maps API v3
A spritesheet is a good way to do this if the total number is relatively unchanging, and each client is likely to use a large subset of the sprites.
The downside of a spritesheet in my experience is maintenance - combining a code and an art workflow can be a bit of a pain!

How to keep Text data consistent in IOS app and website ?

Its known fact that we can use Json/XML parsing or Database to maintain a limited amount of data consistent on a given application and Website at any given time.
However, the dilemma is a project having few display textlines 3k-4k that are supposed to be consistent on both(App and website)on a selected UI, these text files may change at any given point of time. What will be the optimized method or steps of implementation for this technique?
Just my bit would be to store the data in on server as a text file and later use the website or the app to parse the given text file at given location to display it

MongoDB - REST API Architecture For Images

I have thousands of Images (wihch are less then 16MB in size) in RAW BINARY DATA in MONGODB with its Meta-Data in JSON as Date, Time, Location etc from the Small Satellite (BSON Documents). I have to make REST API which can query the Images with its respective Meta-Data. Following things needs to be taken under observation.
Data = Data Screenshot
User's will query the Meta-Data with RestAPI, based on time, location etc.
Server will get the Request from Cilent with Query and DO Image-Processing and Returns the Images
Image Processing will be done on Server Side.
Requested Images will travel through RESTAPI from Server to Client with the GET Request.
NOTE : Just see the Attached Picture to Get the Idea of the DATA.
Tools Used : Data-Base = MongoDB
Questions
Which Server Side Programming Language is More feasible? PHP, Python or Node.js?
How I could do Image-Processing in this scenario? With Libraries on PHP, Python or Node.js?
Which Technology to be Used for making REST API for MongoDB which is best with Binary Data and Images.
How Images will travel from Server to client i-e In binary data. and then Renders at Client Side.
NodeJS and Python are equally suited for basic image processing. I would make a server side language determination more on the expertise of your team and/or current environment in that regard.
With Python PIL or Pillow is the primary image library to use. I've used https://github.com/aheckmann/gm for NodeJS which was not difficult to do basic image processing.
(and 4) In terms of retrieving images from an API I typical using a typical REST/CRUD set up to get the metadata and put the image one level deeper using by adding .../image? to the endpoint. For example:
GET ../picture/<id>
Would return the picture metadata with the image url included.
GET ../picture/<id>/image?<processing params>
Would return the image itself.
If you are making a web application using the <img> tag and the correct image URL is sufficient for displaying the image.
I would also recommend storing the images on the filesystem directly (not in the database) unless you have a specific reason to store them in the database. It tends to simplify both you storage code and retrieval since you don't need to deal with sending a BLOB to the database. Nginx (https://www.nginx.com/resources/wiki/modules/upload/) for example lets you set file upload location so literally just need to get the filename from the headers and copy/rename it to the location you want to store the file permanently. This also lets you easily remap a URL to the location on the filesystem. The biggest benefit is that it lets the webserver worry about the upload and download and you just have keep track of the filename in your code.
According to your questions, I will give you answer one by one.
nodejs is better as they have more then 15000 modules.
you can do image processing by using nodejs modules like sharp, Jimp and many more.
MongoDB is a document-oriented NoSQL database (Big Data ready). It stores data in JSON-like format and allows users to perform SQL-like queries against it, and nodejs is best for this purpose.
for this there are number of modules for travels from server to client, like webcamjs.

Office 365 SharePoint site accessing data from external MySQL and/or PHP server

I can't seem to find any other info on this topic anywhere on the interwebz.
SharePoint 365 seems so powerful, looks like an awesome solution for a whole bunch of business IT requirements.
But everything is in ASP and XML, but all my data is inside an external MySQL server, accessible through PHP pages which process and spit out JSON objects. This has worked nice and tidy for all my other apps so far.
How can I get my SharePoint site (which is basically HTML CSS and JavaScript, right?) to hit my PHP server (with HTTP GET or POST) to access my JSON data (and then process and display it however I like)?
I know AJAX can't hit external servers, so on my SharePoint site I'd need something equivalent to cURL perhaps... but with the functionality of AJAX?
Another possibility I'd avoid would be to create some kind of middle-man page/file/app in SharePoint which can process the data locally via AJAX, and send/receive data to/from the external PHP server. But this would all be in C# or ASP, ughhh surely there's an easier way?
EDIT :
Came across this post regarding XML content, the best answer was to "create a custom .NET assembly" to parse the XML... I can't believe SharePoint with all its awesomeness wouldn't be able to handle external JSON content??
You are right that SharePoint at it's heart is just ASP.net engine rendering HTML, JS and CSS down to the browser. For SP to access your data, you would need to expose the MySQL data via a REST service. This could be written in any language since it is a service. It does not need to be C#, .net or ASP as all SP is doing is calling your endpoint and receiving the json data. So no reason you could not use PHP for this.
Once you have the service, you can create a javascript file to call it using jQuery and the $.ajax() or getJSON() method to get the data. You render the data onto the SharePoint page by adding the Script Webpart in the proper location. Once added, click the Edit Snippet link on the script webpart and insert html with a reference to script file and a div to write the results. There are many examples of how to do this type of request and parse the data on the web as it is not something specific to SharePoint. Place the javascript file in the SharePoint site. I typically put it in a custom folder in the _catalogs/masterpage library.
If you just need to display this external data on one page along side your SP data, like in a dashboard, this solution will work. If the external data needs to interact with the SP data or you need to place it in multiple locations, then you may want to look into building a SharePoint App and you can use PHP to do this. Here is a link to a sample project on GitHub. https://github.com/OfficeDev/PHP-App-for-SharePoint

Cross-platform data visualization software? (Preferably HTML/JS)

I am looking for cross-platform data visualization solution.
It should ideally work in web browsers and by extension on Android and iOS devices.
To go into more detail, I'd like for the server side to be able to accept data via HTTP POSTs (XML, JSON, etc), and then allow for themeable output of these data via widgets (Drupal-like) such as meters, graphs, plain text etc.
The data types should be configurable and easily created/modified.
Here is a quick example:
I want to show temperature from a bunch of sensors as a graph. The sensors can POST the data to a main server and the server can then be called from a browser to display a chewed-up and configurable graph.
Thanks for your input guys!
A little searching on google would yield a lot of libraries, My favorite being a html5 one called Rgraph http://www.rgraph.net/
High charts is another excellent solution. http://www.highcharts.com/
These are both html5 based.
You can check the combination of google spreadsheet for the DB/backend and Google Visualization for the frontend visualization.
Google GData API has a nice set of client libraries that make writing POST data into Google Spraedsheet a very simple task. Check out: http://code.google.com/apis/spreadsheets/data/3.0/developers_guide.html#CreatingListRows
ListEntry newEntry = new ListEntry();
newEntry.getCustomElements().setValueLocal(tag, value);
ListEntry insertedRow = service.insert(listFeedUrl, newEntry);
On the other end, It is rather easy to use the JavaScript libraries of Google Visualization to extract and present data from a published spreadsheet. It has a wide range of widgets ready to use. If you are missing any specific widget, you can use any JS library with some manipulation of the JSON data.
For simple example on the ability to turn a Google Spreadsheet to a live chart check: http://code.google.com/apis/chart/interactive/docs/spreadsheets.html#Google_Spreadsheets_as_a_Data_Source

Categories