Focal Point Banner
Community Center Education Summit Technical Support User Groups
Let's Get Social!

Facebook Twitter LinkedIn YouTube
Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED] ESRI Map by City
Go
New
Search
Notify
Tools
Reply
  
[SOLVED] ESRI Map by City
 Login/Join
 
Guru
posted
I am trying to do a ESRI map by city. I got a state map to work and tried to modify that for a city. Here is may code. Can anyone help on what I need to modify? There is very little documentation.


GRAPH FILE HOLDLMAP
SUM HHIQYSA
BY STATE
BY CITY
ON GRAPH PCHOLD FORMAT JSCHART
ON GRAPH SET LOOKGRAPH BUBBLEMAP
-*ON GRAPH SET LOOKGRAPH BUBBLEMAP
-*ON GRAPH SET LOOKGRAPH CHOROPLETH
ON GRAPH SET STYLE *
*GRAPH_JS
legend: {visible:true},
mapProperties: {
engine: 'leaflet',

leaflet: {
overlayLayers: [{
title: 'United States of America',
dataLookup: 'properties.cities',
layerInfo: {
maxZoom: -1,
minZoom: -1,
type: 'regions'
},
type: 'tdg',
url: function(){ return tdgchart.getScriptPath() + 'map/US.json'}
}],
controls: [
{control: 'L.Control.Layers'},
{
control: 'L.Control.Scale',
options: {
imperial: true,
metric: true }
}
],
baselayers: [{
title: "ArcGIS_World_Street_Map",
layerInfo: {
maxZoom: 6,
minZoom: 6,
attribution: function(){ return "&|copy; Information Builders | " +
"Map Tiles: &|copy; Esri";}
},
url: function(){ return 'http://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer/tile/{z}/{y}/{x}';}
}]
}
},
legend: {visible:true},
bubbleMarker: {maxSize: '10%' },
series:[{series:0, marker:{color: 'teal', border:{color: 'navy', width:1}},label: 'Sales'}],
title: {visible: true, text: 'AG Sales'} ,
*END
ENDSTYLE
END

This message has been edited. Last edited by: <Kathryn Henning>,


WebFocus 8.1.5
iSeries/Windows
DB2/SQL/Access
Dev Studio
App Studio
Maintain
ReportCaster
 
Posts: 341 | Location: Pembroke NH/Jericho NY | Registered: June 15, 2011Reply With QuoteReport This Post
Expert
posted Hide Post
Hi Jay,

Almost one that got away!

Change "type" to type: 'cities'

and "dataLookup" to dataLookup: 'properties.city_name',

The reason for these changes is that, within US.json, there are two layers - Cities and Regions. These are identified in the code by the "type".

The next piece you want to use is what property to use - in your case you are using City so you want "city_name" for the data lookup parameter.

Good luck

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.06 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
 
Posts: 5617 | Location: United Kingdom | Registered: April 08, 2004Reply With QuoteReport This Post
Expert
posted Hide Post
For those that want to check this out at city level, here is an example using the base code from Jay but with GGSALES data (and no restriction on initial zoom level!).

If you want to see the result of the restriction on locality used by Jay, just uncomment the max and min zoom - you'll see St. Louis showing data as this is the only City within Jay's zoom settings.

GRAPH FILE GGSALES
SUM COMPUTE MDOLLARS/D12.2 = DOLLARS / 1000000; AS 'Dollars (M)'
BY ST
BY CITY
ON GRAPH PCHOLD FORMAT JSCHART
ON GRAPH SET LOOKGRAPH BUBBLEMAP
ON GRAPH SET STYLE *
*GRAPH_JS
 legend: {visible:true},
mapProperties: {
 engine: 'leaflet',

	leaflet: {
	overlayLayers: [{
	title: 'United States of America',
	dataLookup: 'properties.city_name',
	layerInfo: {
	maxZoom: -1,
	minZoom: -1,
	type: 'cities'
	},
	type: 'tdg',
	url: function(){ return tdgchart.getScriptPath() + 'map/US.json'}
	}],
	controls: [
 {control: 'L.Control.Layers'},
 {
 control: 'L.Control.Scale',
 options: {
 imperial: true,
 metric: true }
 }
 ],
	baselayers: [{
	title: "ArcGIS_World_Street_Map",
	layerInfo: {
-*    maxZoom: 6,
-*    minZoom: 6,
	attribution: function(){ return "&|copy; Information Builders | " +
	"Map Tiles: &|copy; Esri";}
	},
	url: function(){ return 'http://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer/tile/{z}/{y}/{x}';}
	}]
	}
},
legend: {visible:true},
bubbleMarker: {maxSize: '10%' },
series:[{series:0, marker:{color: 'teal', border:{color: 'navy', width:1}},label: 'Sales'}],
title: {visible: true, text: 'AG Sales'} ,
*END
ENDSTYLE
END


T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.06 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
 
Posts: 5617 | Location: United Kingdom | Registered: April 08, 2004Reply With QuoteReport This Post
Guru
posted Hide Post
I did get this to work, except it shows 1 bubble for the state of Massachusetts when I selected only Massachusetts cities. Do we have access to a map layer that shows cities. Also because I had city names that are valid in other states, how do I limit the map only to display a bubble in Massachusetts.


WebFocus 8.1.5
iSeries/Windows
DB2/SQL/Access
Dev Studio
App Studio
Maintain
ReportCaster
 
Posts: 341 | Location: Pembroke NH/Jericho NY | Registered: June 15, 2011Reply With QuoteReport This Post
Expert
posted Hide Post
quote:
map layer that shows cities
This is what the changes would do. Did you try the example? Try removing BY STATE from your code (you don't really need it there?).

quote:
it shows 1 bubble for the state of Massachusetts when I selected only Massachusetts cities
I am guessing that this may be because you are still pointing at a state level?

quote:
how do I limit the map only to display a bubble in Massachusetts
If you mean only to show bubbles for cities that exist in Massachusetts then I would guess "WHERE STATE EQ 'Massachusetts';"

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.06 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
 
Posts: 5617 | Location: United Kingdom | Registered: April 08, 2004Reply With QuoteReport This Post
Expert
posted Hide Post
quote:
how do I limit the map only to display a bubble in Massachusetts
Might a custom GeoJSON file be the answer? Have a word with Tech Support to see whether this might be an option / solution (and also how to do it).

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.06 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
 
Posts: 5617 | Location: United Kingdom | Registered: April 08, 2004Reply With QuoteReport This Post
Guru
posted Hide Post
I believe "state" is needed, because when I select a city that is used in every state in the country. How does the map know what state I am referring too?


WebFocus 8.1.5
iSeries/Windows
DB2/SQL/Access
Dev Studio
App Studio
Maintain
ReportCaster
 
Posts: 341 | Location: Pembroke NH/Jericho NY | Registered: June 15, 2011Reply With QuoteReport This Post
Guru
posted Hide Post
Waiting on the ESRI expert to call me.


WebFocus 8.1.5
iSeries/Windows
DB2/SQL/Access
Dev Studio
App Studio
Maintain
ReportCaster
 
Posts: 341 | Location: Pembroke NH/Jericho NY | Registered: June 15, 2011Reply With QuoteReport This Post
Gold member
posted Hide Post
Adding

 WHERE ST EQ 'MA'; 


Gives me a bubble right on top of Boston


WebFOCUS App Studio 8103
Windows7
All outputs
 
Posts: 58 | Location: London, UK | Registered: May 09, 2011Reply With QuoteReport This Post
Guru
posted Hide Post
That is because it is the capital of Massachusetts. Try a different city that is in multiple states and even though I select only the state of MA. It will display on the capital of all the states that that city resides in. I would like it to display only in MA if I am only selecting MA cities.

I have already proved it to the support Tech that contacted me, but he wasn't an ESRI expert.


WebFocus 8.1.5
iSeries/Windows
DB2/SQL/Access
Dev Studio
App Studio
Maintain
ReportCaster
 
Posts: 341 | Location: Pembroke NH/Jericho NY | Registered: June 15, 2011Reply With QuoteReport This Post
Guru
posted Hide Post
Upon some further researching and discussions, it appears the maps I am using will zoom down into streets like I was looking for. The other problem is that I need to build a JSON file that has all of the cities in it. Also this JSON, if it contains multiple states, need to have both the city and the state in one field. You can only use one field for a dataLookUp.

The JSON files that IB gives us only has one city (capitol) for each state or has the county boundries for a select state.

Does anyone have a JSON or know where I can get a JSON that has the coordinates for every city and state?

This message has been edited. Last edited by: Jay Potter,


WebFocus 8.1.5
iSeries/Windows
DB2/SQL/Access
Dev Studio
App Studio
Maintain
ReportCaster
 
Posts: 341 | Location: Pembroke NH/Jericho NY | Registered: June 15, 2011Reply With QuoteReport This Post
Expert
posted Hide Post
quote:
Might a custom GeoJSON file be the answer?

Hi Jay,

Hence my comment. I think that what you need is the name attribute within the GeoJSON file to be a combination of the State and City - something like -
{
  "type": "FeatureCollection",
  "features": [
{"type": "Feature","geometry": {"type": "Point","coordinates": [   -84.420604,     33.767713] }, "properties": {"code": "GAAtlanta", "name": "Atlanta", "description": "Atlanta in the State of GEORGIA"}},                                                    
{"type": "Feature","geometry": {"type": "Point","coordinates": [   -71.033333,     42.366667] }, "properties": {"code": "MABoston", "name": "Boston", "description": "Boston in the State of MASSACHUSETTS"}},                                                
{"type": "Feature","geometry": {"type": "Point","coordinates": [   -87.633333,     41.883333] }, "properties": {"code": "ILChicago", "name": "Chicago", "description": "Chicago in the State of ILLINOIS"}},                                                   
{"type": "Feature","geometry": {"type": "Point","coordinates": [   -95.366667,     29.983333] }, "properties": {"code": "TXHouston", "name": "Houston", "description": "Houston in the State of TEXAS"}},                                                      
{"type": "Feature","geometry": {"type": "Point","coordinates": [  -118.233333,     34.050000] }, "properties": {"code": "CALos Angeles", "name": "Los Angeles", "description": "Los Angeles in the State of CALIFORNIA"}},                                         
{"type": "Feature","geometry": {"type": "Point","coordinates": [   -89.969640,     35.129186] }, "properties": {"code": "TNMemphis", "name": "Memphis", "description": "Memphis in the State of TENNESSEE"}},                                                  
{"type": "Feature","geometry": {"type": "Point","coordinates": [   -73.916667,     41.316667] }, "properties": {"code": "CTNew Haven", "name": "New Haven", "description": "New Haven in the State of CONNECTICUT"}},                                            
{"type": "Feature","geometry": {"type": "Point","coordinates": [   -73.978004,     40.705631] }, "properties": {"code": "NYNew York", "name": "New York", "description": "New York in the State of NEW YORK"}},                                                 
{"type": "Feature","geometry": {"type": "Point","coordinates": [   -81.383333,     28.550000] }, "properties": {"code": "FLOrlando", "name": "Orlando", "description": "Orlando in the State of FLORIDA"}},                                                    
{"type": "Feature","geometry": {"type": "Point","coordinates": [  -122.433333,     37.766667] }, "properties": {"code": "CASan Francisco", "name": "San Francisco", "description": "San Francisco in the State of CALIFORNIA"}},                                     
{"type": "Feature","geometry": {"type": "Point","coordinates": [  -122.300000,     47.650000] }, "properties": {"code": "WASeattle", "name": "Seattle", "description": "Seattle in the State of WASHINGTON"}},                                                  
{"type": "Feature","geometry": {"type": "Point","coordinates": [   -90.633333,     38.650000] }, "properties": {"code": "MISt. Louis", "name": "St. Louis", "description": "St. Louis in the State of MISSOURI"}}                                                
  ]
}


There are many sites where you can gather lat and long values for cities worldwide, just google "latitude longitude cities usa".

I have done this with other countries, created a flat file from the data, created a synonym and then used WF to compile the GeoJSON file. All very simple.

I might talk to Kathleen about a 30 minute lunchtime demo on this?

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.06 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
 
Posts: 5617 | Location: United Kingdom | Registered: April 08, 2004Reply With QuoteReport This Post
Guru
posted Hide Post
Yes! You are correct. I finnaly figured it out. I did some of the google research last weekend and got some data and I started using WF to create my JSON.

I originally assumed that IB had given us a JSON with all US cities in it, but I found out that was an incorrect assumption.

Thank You!


WebFocus 8.1.5
iSeries/Windows
DB2/SQL/Access
Dev Studio
App Studio
Maintain
ReportCaster
 
Posts: 341 | Location: Pembroke NH/Jericho NY | Registered: June 15, 2011Reply With QuoteReport This Post
Expert
posted Hide Post
Once you have your GeoJSON file you might want to check it using this site - http://geojsonlint.com/

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.06 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
 
Posts: 5617 | Location: United Kingdom | Registered: April 08, 2004Reply With QuoteReport This Post
Expert
posted Hide Post
Also note that I have found the need to "tweak" latitude and longitude values given on some of these sources to position them with improved accuracy! Note New Haven above - it should be -72.9nnnnn

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.06 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
 
Posts: 5617 | Location: United Kingdom | Registered: April 08, 2004Reply With QuoteReport This Post
Guru
posted Hide Post
Thank you for your suggestions.


WebFocus 8.1.5
iSeries/Windows
DB2/SQL/Access
Dev Studio
App Studio
Maintain
ReportCaster
 
Posts: 341 | Location: Pembroke NH/Jericho NY | Registered: June 15, 2011Reply With QuoteReport This Post
  Powered by Social Strata  
 

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED] ESRI Map by City

Copyright © 1996-2018 Information Builders, leaders in enterprise business intelligence.