I would like to deploy an instance of TerriaJS on my site for the purpose of 3D (with 2D-fallback) geospatial mapping. I am a bit confused as to how to actually "deploy" TerriaJS on my site. I am very familiar with Leaflet... pretty much just include the leaflet.js file, create a div, and off you go. However, I am running through the wiki on TerriaJS's github page and all I see is a bunch of NodeJS.
What am I missing? I am able to get the map to run with NPM and I see a nice 3D map (running inside of a node web server instance), but that doesn't do me any good as I want to be able to embed the map on my web site.
If anyone has a nice (plain English) tutorial or starting point, that would be awesome.
Thanks.
The Node-based web server that we usually use with TerriaJS only does a few things:
It serves up the static HTML, JavaScript, and CSS that make up the application.
It includes a simple service at /proxy that allows TerriaJS to access geospatial data servers that don't support CORS.
It includes another service at /convert that uses OGR to transform geospatial vector data (e.g. shapefiles) to GeoJSON for display by the TerriaJS client.
Of these, only the first is required. So, you can copy the wwwroot directory of a working TerriaJS application up to whatever web server runs your site and it will run there just as well as it does on the Node-based server. You'll have to make sure that all of your geospatial data is either on the same server or is hosted on servers that support CORS, and shapefile conversion won't be supported, but other than that you should be good to go.
Embedding TerriaJS in an existing web page is a bit trickier. You'll want to start with the index.js, index.html, and index.less files in the TerriaJS app you started with (NationalMap maybe?) and modify them to suite your needs. You'll need to use the gulp-based build process. But once that is all done, you can just copy the files up to your web server as before.
Depending on your needs, you may also consider embedding TerriaJS on your page in an iframe rather than building it into the page directly. You can control the content of the catalog and customize some basic aspects of the UI by specifying parameters to the URL. You can also control it by posting cross-window messages as described here.
Finally, it's possible to use TerriaJS without the provided user interface, e.g. by providing your own. This is a pretty advanced scenario, though, so probably best to post a separate question if you want to go down that road.
Related
I'm starting out on my Node.JS journey and I discovered a fantastic boilerplate over at https://github.com/azouaoui-med/pro-sidebar-template. I'm unsure though how to turn the static html into a web app. Just wondering how someone with more experience would do this?
Do I take the html and translate it into a PUG template file? I'm guessing to then make the onclick / links actually run some code, i'd need to point them at the routes setup in the web app?
Sorry to ask such inexperienced questions, web apps seem to take a vastly different approach to the desktop apps i'm familiar with programming
I'm wanting to create a web app that runs on a server, which I will later put on the desktop via electron.
thanks
The project you have is using browser-sync which indirectly uses NodeJS to run a local server and host the web application files.
Do I take the HTML and translate it into a PUG template file?
I am not sure about this question unless you specifically want to use server-side rendering I am not sure I would recommend this to start with especially if you plan to later convert this to a desktop application.
[Note* - Assuming you are referencing this library PUGJS in statements above ]
Now For this requirement I'm wanting to create a web app that runs on a server, which I will later put on the desktop via electron.
This will require you to make your data serving layer which is most commonly called backend separate from that of the data viewing layer which is most commonly referred to as front-end. Thus a case for using the same data layer across different types of clients viz. A web application and/or A desktop application ( electron if you choose so )
Step 1 - Define what sort of web application architecture you want to follow or use. This will be based on your project and business requirements. From what information I have so far I would suggest a simple client-server architecture where your frontend or web-application is the client which makes REST API calls to the backend (API Server) and thus produces a meaningful result.
Step 2 - Start with the creation of 2 projects a frontend where your HTML, CSS JS, etc will be and a simple NodeJS script to serve this static web app when deployed on the server. I am going with NodeJS since the context of this question is suggesting the same.
Step 3 - The other project which will only be an API Server or Backend. This server will provide only REST API to the frontend. This server will talk to the database and provide other services like authentication and logging etc. You can use expressJS for this also in the frontend project.
Here is a simplistic representation of the client-server model which you can reference.
Some additional links for you to digest.
What is the difference between a web application and a client/server application?
https://medium.com/codiumclub/web-application-architecture-part-1-guide-to-become-full-stack-developer-cc9526a3519b
i want to make Content Management System that can run on nodejs code.help me out in this project .I know that cms is written in php but i want to add the functionalities with the help of nodejs or expressjs.help me in connecting the cms application with nodejs .
CMS is a type of application, and is not uniquely written in PHP. Developing the entire content management system is a large project with many moving parts. To get a sense for how involving it is, you can take a look at this example project where somebody walks you through one particular way of implementing a content management system in NodeJS. However, your implementation will vary depending on your goals of the CMS you are looking to develop.
I want to build a website using the MEAN stack and my database schema will be defined using Mongoose. This website will have an admin site, in which I will have all the CRUD operations for the data displayed by the frontend website. As the object model will be the same, if I'm using Java or C# I would compile this classes in a Jar or Dll and use it in my frontend site, along with the DB definitions and repositories (say hibernate)
What will be a recommended approach for reuse this object model in this MEAN scenario? Is it common to have another "folder" in my express setup? What if I want to run the admin site on another port?
I see you have no response yet, one example; Here is a nice scaffold that im working with which uses also JS, not C or Java and is a fairly good example of what your looking for i think. This will help you expedite, expand and go in which direction you want from there, by being a very adjustable MEAN stack scaffold using MOngoose, having CRUD examples, and even Bootstrap Jade SASS front end to help facilitate if you want to use it.
You would separate out your admin site as one of the MVC sections, and so forth, just like you would on any other MVC site pretty much, you can just follow the code standards in the documentation there.
VS2013 update 5, MVC5 using Areas
I have a stand-alone function programmed for a website. The functionality is a specific user interface to collect survey responses in a particular way. It has several controllers, a model and a group of views. The functionality is completely contained in an Area of the project, except for the Shared _Layout file that provides the main menu for consistency.
'Is it possible for me to' / 'how do I' compile this Area into a single or set of .dll file(s) that I could then add conveniently to other websites? I'm assuming creating something for transfer/download is very standard functionality. For example, I used Elmah.MVC for this site. What I want to do is pretty much create a package that can be downloaded in a similar way to how we integrate Elmah.MVC into a site. (Be certain I'm not talking about creating error logging software, I'm only using Elmah.MVC as an example of software that is easily integrated into other website applications.)
I've never compiled any website functionality into a .dll(s) for use elsewhere and would appreciate either some specific guidance, or perhaps what would be easier is to provide a link with a good step by step tutorial or explanation for how to do this. Most of what I've found on the web describes bits and pieces of doing this, but it's not enough for me to feel confident with it.
It seems to me there are a lot of 'moving parts' to taking a particular piece of an MVC application and turning it into something that is easily added to other projects.
A particular issue I don't quite grasp is the difference in downloaded packages between getting code and getting just the .dll(s). For instance, when I download an MVC5 site, I get controllers, models and views, but when I download Elmah I get a .dll and no code files. Also, I do understand the concept of transforms, but I'm just struggling right now with even getting from my programmed application into a 'package' regardless of the transforms that make it easy to integrate into another website.
These are just some of my questions I have about how to perform this particular process in developing deliverable and/or shareable software.
What you are looking to do is create a portable MVC Area project. A Portable Area is a set of reusable multi page functionality can be dropped into an application to provide rich functionality without having to custom build functionality that is literally the same in every application. An MVC Portable Area is really just a dll that contains the views, controllers, scripts, etc… needed to use in a website that is either a Web Forms website or an MVC website. A developer can use them for a reusable widget or a complete engine. I have actually used them for both. Here is a link with some basic info to get started. http://elegantcode.com/2012/04/06/mvc-portable-areas/
I am building a website using nodejs and express. How to make divisions in a page dynamic? Is Jade used for that? if not how to do it?what is angularjs used for? Please help i searched a lot on google and i couldn't get a clarity in the usage of them.
Jade creates the html used in the browser on the server-side. The browser executes a request to the web-server, the web-server executes Jade, which will generate the html that will be sent to the browser. This server-side content generation has been very common in the last ~20 years, but it has quite some cons when building rich internet application. Mostly this has to do with performance and client state tracking.
AngularJS is a client-side MVC/MVVM like framework to build so called Single Page Applications (SPA), which allows you to have the complete user interface flow, all content generation and state tracking to be done at the client side. It even allows you to build offline applications. From the developer point of view this feels much more like building a desktop application where the client knows the state of the user interface. From the user point of the view the website will respond much smoother and snappier because the UI is all generated locally.
Note: SPA does not mean that you can only have one page in your website.
It's a technical term where the browser downloads one page (~/index.html), which contains the complete or partial web application. The user technically never leaves this page, but the content (pages) is dynamically swapped in and out from this placeholder page.
To most common way to provide data to a SPA is via RESTful web services. AngularJS comes with builtin support for REST.
Some developers combine server-side content generation techniques with AngularJS, but there's actually no real need for this.
Jade is used as a template engine on both server-side and client-side. Yes, it can update a page dynamically, you just have to compile your jade templates to a javascript functions (using jade -c or something similar).
Yes, you can use angular.js with it, but I see no real need to use two template engines in your project. Suggesting to just stick with jade, unless you know what are you doing.