How do I make a join (joined a .csv to a shape file attribute table) permanent? - gis

Joined population to municipalities. Now I want to work out (using field calculator in Geoprocessing) pop/km^2. However the join is not permanent so the calculation doesn't work.

Joins are by default temporary. Once you have joined the two, you must save it as a new layer using "Save Layer to File". Then you will be able to use the field calculator on this new file.

Related

Access combo box for DB mapping table 2-1 Table relation

I've run into a bit of a snag with a project I'm working on, and being new to Access I don't know if what I want to do is possible without VBA. I've looked around but all I can find are answers related to showing multiple columns, not controlling multiple fields in my DB.
To paint a picture I have a mapping system set up in my DB to help me distinguish the name and type of data is held in a table.
The setup is as follows:
-Data table is "LineItems" with an ID and the line data (think typical excel format)
-Mapping table is "LineItem_Mapper" with LineItem_ID, DataType, and Entity_ID
-A helper table "Data_Type" with ID and Name
-two "Entity" tables with differing properties both have ID and Name
The reason for the split is on data type is that the two types of data behave differently. One type has a parent child relation, and the other is a standalone row. I want to preserve this structure in my DB and feel I have done so with this mapping.
Now, on to the issue I'm running into. In my Access data entry form I want to use a combo box, as the options a user may chose for each line when entering are finite. However, this combo box is affecting the Mapping table above. I have been able to populate the box with my desired list with a custom query built from my 2 entity tables, but I don't know how to get Access to create or update the Mapping table using this box.
what I want to happen is when I chose something in the box, a line is created (or changed) in the mapping table with all 3 columns being populated. first the LineItem_ID for the line I am populating, and then the DataType and Entity ID to reflect the proper mapping.
Can Access do this on its own? Or do I need to do this with VBA?
As requested by the OP converting my commend as an answer (with a little bit more detail):
By far your best option is to use VBA. I doubt there is another way and even if there is it would be so convoluted it would be unworkable and unmanageable.
This should get you started:
In the combo box properties go tot the events tab and in After Update or On Change (look up the difference between the two events to see which behavior you prefer) click the down arrow and select [Event Procedure], then click on the … button. This will create a VBA module for you complete with the function that runs when the selected event is triggered.
You can use DoCmd.RunSQL "[Access SQL INSERT statement]" to add records to tables.
You can use Me.[MyComboBoxName] to get the current value of the combo box. Similarly the value of anything else in your active form.
You can use DLookup to get the value of any record in your tables.
Hopefully these will give you a relatively quick start.

Joining date and time field in Tableau

I'm working on project that has data warehouse implemented. The fact table has datetime stored in the format:
2015-01-31 23:10:49.4020000
Date Dimension has the dates included in the following format:
2015-01-01 00:00:00.000
Time Dimension is storing the time in the following format:
23:10:49 AM
Now, I have to make analysis using Tableau software, for which I need to join the two dimensions with the Fact table. I'm trying to create custom sql for creating a join, unfortunately I'm not able to do so.
Can anyone share how should I join the fact table with both the dimensions?
You are essentially looking for combining multiple tables using either Join Or Data Blending.
In tableau, you can combine data that exists across multiple tables or files by creating joins. Using joins to combine tables allows you to analyze data that have a relationship with each other.
Complete articles depicting all these steps can be found here
Connect to data and create your data source according to the examples
in Connecting to Data Sources.
After you select the file, database, or schema, double-click or drag a table to the join area of the data source page.
Double-click or drag another table to the join area. The join dialog box opens.
Add one or more join conditions by selecting a field from one of the available tables used in the data source, a join operator, and a field from the added table. Inspect the join condition to make sure it reflects how you want to connect the tables.
For example, in a data source that has a table of order information and another for users information, you could join the two tables based on the Region field that exists in both tables. Select the type of join.
When finished, click the "x" icon to close the Join dialog box.
In your case, You should go for these joins instead of Data blending. This is because, Data Blending does not create row level joins and is not a way to add new dimensions or rows to your data.
Data blending should be used when you have related data in
multiple data sources that you want to analyze together in a single
view. For example, you may have Sales data collected in an Oracle
database and Sales Goal data in an Excel spreadsheet. To compare
actual sales to target sales, you can blend the data based on common
dimensions to get access to the Sales Goal measure.
You can refer this article for more details

SSAS Cube Creation - Database Views

I am in the process of setting up a new cube. This cube is going to be very similar to a cube that exists except it will contain only data where the date is not in the past.
The current table has data that is past and present. 1 idea was to create a database view on this table and include any rows where the date was >= getdate() but I don't think you can select a database view when setting up a cube, is this right? Another option would be to create a new database table that includes only those records with a present or future date.
The final option would be to filter the current cube but I think I would prefer a fresh cube with only this data as it will be predominantly used by users in excel pivot tables so I want to avoid any filters/mdx if possible.
What would be the way of achieving this?
Thanks
You can most definitely add a view in your SSAS DSV. You can select views or tables in the object chooser dialog box. You can also write a named query. Many people advise that you should always use views in your DSV for your cube. It creates a layer between the cube and the physical tables.
Another approach is to use the existing cube as a source for a Power Pivot model and filter the dates in the data model in Excel and then provide that model/Excel file to your users.

Lotus Domino NotesSQL ODBC & SQL 2008 query

I'm trying to work at getting the same information from a couple different sources but have hit a wall in trying to use NotesSQL and SQL 2008. What I am trying to do is to retrieve info from a couple different views on Domino servers. One view is a default view, the other is a created one.
One method I have used is Powershell, where I get the database, then select the view, get the first document & then iterate through the rest of the view grabbing fields that I need. The view I have selected is the People view.
I was trying to replicate this same thing using SQL 2008, using the NotesSQL driver, setting up an ODBC connection, and then creating a linked server to that Notes database. I am using the following query to select from the People view:
select * from openquery(MyNotesServer,'Select * from People')
However, what is returned from this view isn't what I am able to see when I use Powershell & then iterate through the documents returned in that view. Powershell shows 100+ columns in it, while SQL only returns 5 columns. Additionally, they're named "_12", "17" etc. Some fields (which may be custom, I don't know) have a meaningful name. Of the fields shown, I can select them by name ("_12", etc) but cannot select anything else. The number of rows (SQL) is the same as the number of documents in the view (Powershell $view.Allentries.Count).
Querying the view that was created (3 fields):
select * from openquery(MyNotesServer,'Select * from MyCreatedView')
returns all the fields in that view, and they are named as they are in the view.
In T-SQL querying the People view, how do you get the names of the columns that I know are there as I discovered in my Powershell script? They don't appear to be named the same thing, so how do you retrieve more than the 5 returned when you select * from the view? I have read through the Notes documentation & examples, but haven't been able to figure out what is mapped to where.
The reasoning behind this is wanting to utilize SQL & a notes.id file instead of running a script. Also, I want to make use of an already existing global view instead of views that may be accessible only to their author.
You can use select * from Person. Person is a form name, not a view name. Notes and Domino are not relational. The NSF file is a document database. The views in it are pre-built indexes that already have an implicit select. I.e., the "People" view selects all documents created with the "Person" form.
The above query bypasses the use of a view and will give you all the fields for all documents created with the the Person form.
Actually, come to think of it, the better query would be select * from Person where type='Person'. That's because the People view in Domino uses type="Person" instead of form="Person" in its selection formula. It is theoretically possible to have a document created with the Person form but with the Type field set to a different value. This variation will insure that you always get the same list that you see in the Person view.
But: In either case, it will be inefficient. The NotesSQL driver will have to do a full database search instead of simply reading the index of an existing view. It's going to search using the Notes formula SELECT Form="Person" & Type="Person". I really cannot recommend this, unless you are querying against a small Domino Directory database.
The best practice is to create a view containing all the fields that you really need, and do your query against that view.
First, in the Lotus Notes documentation, you'll find "columns" when you read about views, not fields.
Second, the columns have configured an option called "Programmatic Name". In that option, you can put an "alias". Lotus Notes puts values by default as "$12", "$17", etc. The thing is NotesSQL changes "$" by "_". That's the reason why you see "_12", "_17, etc.
How do you get the original names? As far as I remember (I don't have Lotus Notes near to make a verification) you can't. But, you can create another view with the columns with the data you need, and put appropiate names. The easy way to do it is copy/paste the view, delete the columns you don't need, and change that you want.

GIS: need to add data to a shape file

I tried posting this question earlier but was unsuccessful so I'm trying again
I imported a shape (set of points) file into postgres and have a table (hist_info) with additional data also in postgres. I tried creating a VIEW with data that I need from each files but for a reason I can't figure out as to why my GIS layer (created in geoserver) is blank. A SELECT * FROM new_view shows there is data in the table created by the VIEW....
So my questions are
1. What data must I include in the VIEW in order for the newly created VIEW will display as points and show the added data when a point is clicked on?
What is the best way to combine the two files so that I can display the data from the hist_info table when someone click on one of the points on the map displayed in their browse?
Thanks for the help!!
Regards
Chris
You need to insert a record in the geometry_columns table or GeoServer won't read your view's geometry. Have a look at this:
http://docs.geoserver.org/stable/en/user/data/postgis.html#publishing-a-postgis-view