I have a Problem where I could not find an easy solution and I am looking for some ideas or tipps.
I am working with SAS on a project which result should be a map of europe, where the countries get colored after a certain algorithm. I use the maps.europe data and the %annomac and %maplabel macros to label the countries.
This works pretty fine, except for Portugal and Spain - because theese countries have island far away from the coastside, the calculated centroid from %maplabel of the country is not in the center of the country:
Unfortunately I just can cut portugal completely out of the map but not the Islands
I have tried already this method:
Try to cut the parts of the map via gproject which contains the islands - this delievered unexplaniable results to me (just showing some parts of europe, even if I set the parameters extremly wide)
and now I am a bit stuck.
I already thought about this ideas:
Comnbining the map.europe with the map.spain and and map.portugal where I delete the islands before, but I am not sure how to do that that the labeling and all still works for theese combined data.
Is it possible to set the label points for portugal and spain manually and overwrite the data from the %maplabel macro?
Or is there an even easier solution?
Thanks for your help and best regards
stephan
I'm not familiar with those macros, but given how GMAP works, I would indeed override the annotate dataset. You may want to read up on how annotate datasets work, but in general:
The GMAP statement will have an option, annotate= and some dataset. Find that dataset, let's say it's called ANNODS.
Then look at that dataset. Identify a row that has function=text and label=PORTUGAL. That is the row you need to modify the x/y coordinates of in order to move the label around (x1 and y1). You might need to play around with this some to get the right coordinates.
Then run the PROC GMAP, and you should have a newly moved-over Portugal.
Related
I have some data from workplaces with some different work areas, I need to extract a list for each workplace with their corresponding availables working areas, I have an example of some kind of attempt really close what I wanted. I use this formula but with more data will be long time to do it =IF(D2=$G$1, "Yes", "No"). I want to do it more automatic with some formulas but I don't know where to start.
Give a try on below formula. Put the formula to G1 cell then drag down as needed.
=TRANSPOSE(IFERROR(FILTER($D$2:$D$16,$A$2:$A$16=F2,$D$2:$D$16<>""),""))
I am trying to plot a simplified map for pedestrians in my university campus using Osmnx library with python 2.7.
So far, I have this Image of the plot and as you can see, it is plotting sidewalks on both sides of the street. I was planning on removing one side of the sidewalks from this.
However I'm confused what logic to approach this with?
So far, I have created a custom filter to plot only footways
custom_walk = ('["area"!~"yes"]["highway"="footway"]["foot"!~"no"]["service"!~"private"]{}').format(ox.settings.default_access)
G = ox.graph_from_bbox(top, bottom,right, left, custom_filter= custom_walk)
ox.plot_graph(G_projected,save = True,filename = "maps", show = False,node_size=5,node_color='#FFFFFF',node_edgecolor='#FFFFFF',edge_color='#cccccc',bgcolor = "#000000",node_zorder=3,dpi=300, edge_linewidth=5,use_geom=True)
ox.simplify.clean_intersections(G,tolerance=100)
What I am trying to understand is does Osmnx have relations for footways in a way that will tell me their relative position to the nearest street (if they are on the east or the north side of the street (that way I can keep a standard on what sidewalks are visible)? Or if there is a simpler logic at this?
Thanks!
What I am trying to understand is does Osmnx have relations for footways in a way that will tell me their relative position to the nearest street (if they are on the east or the north side of the street (that way I can keep a standard on what sidewalks are visible)? Or if there is a simpler logic at this?
The answer is no, OSMnx doesn't know where the sidewalk is in relation to the nearest street. One option might be to just identify the sidewalk edges you don't want, make a list of their OSM IDs, then remove them from the graph.
I want to build a website with a map based on openstreetmap that colors buildings based on a their potential average annual yield of solar power. I have the energy data for individual houses.
My question is now, can I assign each house (identified by street name and number) a value and the house can then be colored based on this value in the browser?
I have little to no experience with openstreetmap and would be happy about hints into the right direction.
So you need a OSM dataset and filter it for building=* ways to get the building outlines (e.g. with osmosis). Then you do create a second run to filter for addr:= tags of nodes and merge them with the building outlines from step 1. Be aware of conflicts and that one building can have multiple addresses. So now you have a dataset with normalized addresses and need to create a lookup structure like hashmap to get a mapping for your solar data: addr:street x addr:housenumber -> building id
(very raw idea on how to do it)
IMHO the mixing of external datasources to the copyleft open database license makes that you need to relicense your dataset also under ODbL.
Also keep in mind that not every address is currently at OSM and the existing ones can be wrong!
Using Google Spreadsheets. Here's an attempt to replicate my table needs:
2012-08-30 food $15 expensive dinner
2012-08-30 food $10 pizza!
2012-08-30 other $30 that damn painting
2012-09-02 home $40 can't remember
2012-09-02 other $5 toilet paper
2012-09-02 home $2 buying new flowers
I can already do 2 things with it, but it is so far from optimal it becomes negligible.
First, Using SUMIF:
food $25 <- SUMIF(B:B;"food";C:C)
other $35
home $42
Then, combining it with ARRAYFORMULA:
food home other
2012-08-30 $25 $0 $30 <- ARRAYFORMULA(SUMIF(A:A&B:B;2012-08-30&"food";C:C))
2012-09-02 $0 $42 $5
See where this can become too big? Well...
I want to do 2 graphic charts out of this. Of course, the main one is the second:
A pie, from the first example. On using the SUMIF, I need to explicitly, write "food" there (or reference, whatever). Could that be done automagically filling every tag found?
While I can live without this, it may be the answer to the second, main question;
A plot or timeline, from the arrayformula. It should trace each tag in a plot along the time.
Is it even possible to be done? If not, any suggestions? I'm keen to start scripting if needed (and worth it). Or move away from google. Or from spreadsheets all together (lastly). Python maybe? Ruby?
Or maybe I'll just leave it as it is, if it's tooooo much trouble.
Using QUERY, you can generate the first table (with headers) using:
=QUERY(B:C;"select B, sum(C) where B != '' group by B label B 'Category', sum(C) 'Total'";0)
and this should be fairly easily plotted as a pie chart. You can select a range for the chart that is much longer than the current table to accommodate growing data, and the pie chart will conveniently ignore blank rows.
The second table can be generated using:
=QUERY(A:C;"select A, sum(C) where A is not null group by A pivot B";0)
and you can experiment with various chart types to achieve the desired visualisation.
edit
To provide a table that populates with zeros instead of blanks as per your comment; assuming the upper left (blank) cell of the table is I1, then in I2:
=SORT(UNIQUE(A:A))
and in J1:
=TRANSPOSE(SORT(UNIQUE(B:B)))
and then in J2:
=ArrayFormula(IF(I2:I*LEN(J1:1);MMULT(I2:I=TRANSPOSE(A:A);(J1:1=B:B)*C:C);IFERROR(1/0)))
Note this will populate CONTINUE functions to the far bottom and far right of the spreadsheet, over-writing everything in their path. So probably best to have a sheet dedicated to this table.
In general, Spreadsheets are not Databases, and this is a task for which you are fast approaching needing a database. However, as luck would have it (depending on how you look at it, anyhow), Google Spreadsheets actually do have some database-like access APIs, so you can probably do what you want:
http://googleajaxsearchapi.blogspot.com/2008/03/introducing-latest-ajax-api-google.html
https://developers.google.com/chart/interactive/docs/querylanguage
http://blog.ouseful.info/2009/05/18/using-google-spreadsheets-as-a-databace-with-the-google-visualisation-api-query-language/
How can I implement yelp like search?
There are 2 types of searches on yelp.
Simple search using the zip code, city and state in U.S.
I'm using PostgreSQL and wonder if there is good dataset that I can use that has city, state and zip code. I was hoping to find a good geo shape file and use geoDjango where I can just use, say Store.objects.filter(coordinates__in=cityNameORZipCode).
There seem to be some zip code database that I can use, but I really don't know where I can find a good city, state. The last option is to create my own cityname and state table and link to Stores, but not sure if this is smart thing to do.....hm.
Yelp has map search.
If you zoom in or out the google map, it searches local businesses according to the map area you are viewing. Think this is amazing. How can I do this?
It's looking dark right now. Please shed me some light.
You're asking a very broad and unanswerable question, but a good place to start for data in the U.S. is at the Census Bureau. For example:
State and State Equivalent Areas
County and County Equivalent Areas
The full list:
http://www.census.gov/geo/www/cob/bdy_files.html